Initial commit of Qualcomm's loc_api GPS library for the MSM platform.

Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/loc_api/Android.mk b/loc_api/Android.mk
new file mode 100755
index 0000000..cdb2dbd
--- /dev/null
+++ b/loc_api/Android.mk
@@ -0,0 +1,9 @@
+# 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 $(call all-subdir-makefiles)
diff --git a/loc_api/NOTICE b/loc_api/NOTICE
new file mode 100644
index 0000000..85b5740
--- /dev/null
+++ b/loc_api/NOTICE
@@ -0,0 +1,13 @@
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/loc_api/libloc_api-rpc/Android.mk b/loc_api/libloc_api-rpc/Android.mk
new file mode 100755
index 0000000..f5d4008
--- /dev/null
+++ b/loc_api/libloc_api-rpc/Android.mk
@@ -0,0 +1,66 @@
+#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 ($(BUILD_TINY_ANDROID),true)
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+RPC_INC:=rpc_inc
+
+AMSS_VERSION:=6356
+
+generated_files:= \
+	gen-$(AMSS_VERSION)/loc_api_clnt.c	\
+	gen-$(AMSS_VERSION)/loc_api_cb_xdr.c	\
+	gen-$(AMSS_VERSION)/loc_api_common_xdr.c \
+	gen-$(AMSS_VERSION)/loc_api_cb_svc.c \
+	gen-$(AMSS_VERSION)/loc_api_xdr.c \
+        gen-$(AMSS_VERSION)/loc_api_fixup.c \
+	src/loc_api_rpc_glue.c \
+	src/loc_apicb_appinit.c
+
+LOCAL_SRC_FILES:= $(generated_files)
+
+# removed from library build since the client should implement this code.
+#	src/loc_api_cb_server.c
+
+LOCAL_CFLAGS:=-fno-short-enums
+# LOCAL_CFLAGS+=-include $(RPC_INC)/commondefs.h 
+LOCAL_CFLAGS+=-include $(RPC_INC)/loc_api_common.h
+LOCAL_CFLAGS+=-DDEBUG
+# LOCAL_CFLAGS+=-DDEBUG -DVERBOSE
+
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= librpc
+LOCAL_STATIC_LIBRARIES:= libcommondefs-rpc
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc/$(RPC_INC)
+LOCAL_COPY_HEADERS:= \
+	$(RPC_INC)/debug.h \
+	$(RPC_INC)/loc_api_cb.h \
+	$(RPC_INC)/loc_api_common.h \
+	$(RPC_INC)/loc_api.h \
+	$(RPC_INC)/loc_api_fixup.h \
+	$(RPC_INC)/loc_api_rpc_glue.h \
+	$(RPC_INC)/loc_apicb_appinit.h      		     
+
+LOCAL_C_INCLUDES:= \
+	$(LOCAL_PATH) \
+	$(LOCAL_PATH)/$(RPC_INC) \
+	$(TARGET_OUT_HEADERS)/libcommondefs-rpc \
+	$(TARGET_OUT_HEADERS)/librpc
+
+LOCAL_MODULE:= libloc_api-rpc
+
+include $(BUILD_STATIC_LIBRARY)
+
+endif
diff --git a/loc_api/libloc_api-rpc/gen-6356/Makefile.xdr b/loc_api/libloc_api-rpc/gen-6356/Makefile.xdr
new file mode 100755
index 0000000..e6e863f
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/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:=rpc_inc
+
+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 \"$(RPC_INC)/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-6356/loc_api.xdr b/loc_api/libloc_api-rpc/gen-6356/loc_api.xdr
new file mode 100755
index 0000000..981266b
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api.xdr
@@ -0,0 +1,164 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+                             L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+  This is an AUTO GENERATED file that provides an xdr compatible definition of
+  the loc_api API.
+
+  ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+                              Edit History
+
+                             AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 
+
+=============================================================================*/
+/*=============================================================================
+$Header$ 
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+  rpc_loc_event_mask_type event_reg_mask;
+  rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+  rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+  rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+  rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+  rpc_loc_client_handle_type handle;
+  rpc_loc_ioctl_e_type ioctl_type;
+  rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+  rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+  rpc_uint32 toolvers;   /* Tool version */
+  rpc_uint32 features;   /* Features turned on in the code.
+                          * 0x00000001    ONCRPC Server Cleanup Support
+                          */
+  rpc_uint32 proghash;   /* Unique hash value for the API XDR definition */
+  rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+  rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+  rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+  rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+  rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+  rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+  rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+  rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00010001 )
+ */
+
+program LOC_APIPROG {
+  version LOC_APIVERS_0001 {
+
+    void
+      rpc_loc_api_null( void ) = 0;
+
+    rpc_loc_api_rpc_glue_code_info_remote_rets
+      rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+    rpc_loc_open_rets
+      rpc_loc_open( rpc_loc_open_args ) = 2;
+
+    rpc_loc_close_rets
+      rpc_loc_close( rpc_loc_close_args ) = 3;
+
+    rpc_loc_start_fix_rets
+      rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+    rpc_loc_stop_fix_rets
+      rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+    rpc_loc_ioctl_rets
+      rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+      rpc_loc_api_api_versions_rets
+      rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+  } = 0x00010001;
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00010001;
diff --git a/loc_api/libloc_api-rpc/gen-6356/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-6356/loc_api_cb.xdr
new file mode 100755
index 0000000..3f53504
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_cb.xdr
@@ -0,0 +1,90 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+                          L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+  This is an AUTO GENERATED file that provides an xdr compatible definition of
+  an api that represents the grouping of the different callback functions the
+  loc_api API supports.
+
+  ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+                              Edit History
+
+                             AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 
+
+=============================================================================*/
+/*=============================================================================
+$Header$ 
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+  rpc_uint32 cb_id;
+  rpc_loc_client_handle_type loc_handle;
+  rpc_loc_event_mask_type loc_event;
+  rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+  rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00010001 )
+ */
+
+program LOC_APICBPROG {
+  version LOC_APICBVERS_0001 {
+
+    rpc_loc_event_cb_f_type_rets
+      rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+  } = 0x00010001;
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00010001;
diff --git a/loc_api/libloc_api-rpc/gen-6356/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-6356/loc_api_cb_svc.c
new file mode 100755
index 0000000..3b94e62
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_cb_svc.c
@@ -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.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00010001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+	union {
+		rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00010001_arg;
+	} argument;
+	union {
+		rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00010001_res;
+	} result;
+	bool_t retval;
+	xdrproc_t _xdr_argument, _xdr_result;
+	bool_t (*local)(char *, void *, struct svc_req *);
+
+	switch (rqstp->rq_proc) {
+	case NULLPROC:
+		(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+		return;
+
+	case rpc_loc_event_cb_f_type:
+		_xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+		_xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+		local = (bool_t (*) (char *, void *,  struct svc_req *))rpc_loc_event_cb_f_type_0x00010001_svc;
+		break;
+
+	default:
+		svcerr_noproc (transp);
+		return;
+	}
+	memset ((char *)&argument, 0, sizeof (argument));
+	if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+		svcerr_decode (transp);
+		return;
+	}
+	retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+	if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+		svcerr_systemerr (transp);
+	}
+	if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+		fprintf (stderr, "%s", "unable to free arguments");
+		exit (1);
+	}
+	if (!loc_apicbprog_0x00010001_freeresult (transp, _xdr_result, (caddr_t) &result))
+		fprintf (stderr, "%s", "unable to free results");
+
+	return;
+}
diff --git a/loc_api/libloc_api-rpc/gen-6356/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-6356/loc_api_cb_xdr.c
new file mode 100755
index 0000000..51bb47f
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_cb_xdr.c
@@ -0,0 +1,49 @@
+/*  
+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.
+ */
+
+#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-6356/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-6356/loc_api_clnt.c
new file mode 100755
index 0000000..886e5e5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_clnt.c
@@ -0,0 +1,99 @@
+/*  
+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.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat 
+rpc_loc_api_null_0x00010001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_api_null,
+		(xdrproc_t) xdr_void, (caddr_t) argp,
+		(xdrproc_t) xdr_void, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+		(xdrproc_t) xdr_void, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_open_0x00010001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_open,
+		(xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_close_0x00010001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_close,
+		(xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_start_fix,
+		(xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_stop_fix,
+		(xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_ioctl,
+		(xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
+
+enum clnt_stat 
+rpc_loc_api_api_versions_0x00010001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+	return (clnt_call(clnt, rpc_loc_api_api_versions,
+		(xdrproc_t) xdr_void, (caddr_t) argp,
+		(xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+		TIMEOUT));
+}
diff --git a/loc_api/libloc_api-rpc/gen-6356/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-6356/loc_api_common.xdr
new file mode 100755
index 0000000..7ef6357
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_common.xdr
@@ -0,0 +1,803 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+                      L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+  This is an AUTO GENERATED file that provides an xdr compatible definition of
+  an api that represents the grouping of the different callback functions the
+  loc_api API supports.
+
+  ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+                              Edit History
+
+                             AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 
+
+=============================================================================*/
+/*=============================================================================
+$Header$ 
+=============================================================================*/
+
+
+
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_OPEN_VERSION = 0x00010001;
+const RPC_LOC_CLOSE_VERSION = 0x00010001;
+const RPC_LOC_START_FIX_VERSION = 0x00010001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00010001;
+const RPC_LOC_IOCTL_VERSION = 0x00010001;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00010001;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0001;
+typedef bool rpc_boolean;
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+  RPC_LOC_SESS_STATUS_SUCCESS = 0,
+  RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+  RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+  RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+  RPC_LOC_SESS_STATUS_USER_END = 4,
+  RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+  RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+  RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+  RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+  rpc_uint16 year;
+  unsigned char month;
+  unsigned char day_of_week;
+  unsigned char day;
+  unsigned char hour;
+  unsigned char minute;
+  unsigned char second;
+  rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+  rpc_loc_position_valid_mask_type valid_mask;
+  rpc_loc_session_status_e_type session_status;
+  rpc_loc_calendar_time_s_type timestamp_calendar;
+  rpc_uint64 timestamp_utc;
+  rpc_uint8 leap_seconds;
+  float time_unc;
+  double latitude;
+  double longitude;
+  float altitude_wrt_ellipsoid;
+  float altitude_wrt_mean_sea_level;
+  float speed_horizontal;
+  float speed_vertical;
+  float heading;
+  float hor_unc_circular;
+  float hor_unc_ellipse_semi_major;
+  float hor_unc_ellipse_semi_minor;
+  float hor_unc_ellipse_orient_azimuth;
+  float vert_unc;
+  float speed_unc;
+  float heading_unc;
+  unsigned char confidence_horizontal;
+  unsigned char confidence_vertical;
+  float magnetic_deviation;
+  rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+  RPC_LOC_SV_SYSTEM_GPS = 1,
+  RPC_LOC_SV_SYSTEM_GALILEO = 2,
+  RPC_LOC_SV_SYSTEM_SBAS = 3,
+  RPC_LOC_SV_SYSTEM_COMPASS = 4,
+  RPC_LOC_SV_SYSTEM_GLONASS = 5,
+  RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+  RPC_LOC_SV_STATUS_IDLE = 1,
+  RPC_LOC_SV_STATUS_SEARCH = 2,
+  RPC_LOC_SV_STATUS_TRACK = 3,
+  RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+  rpc_loc_sv_info_valid_mask_type valid_mask;
+  rpc_loc_sv_system_e_type system;
+  rpc_uint8 prn;
+  rpc_uint8 health_status;
+  rpc_loc_sv_status_e_type process_status;
+  rpc_boolean has_eph;
+  rpc_boolean has_alm;
+  float elevation;
+  float azimuth;
+  float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+  rpc_loc_gnss_info_valid_mask_type valid_mask;
+  float position_dop;
+  float horizontal_dop;
+  float vertical_dop;
+  rpc_boolean altitude_assumed;
+  rpc_uint16 sv_count;
+  rpc_loc_sv_info_s_type sv_list<RPC_LOC_API_MAX_SV_COUNT>;
+};
+
+struct rpc_loc_nmea_report_s_type {
+  rpc_uint16 length;
+  opaque nmea_sentences<RPC_LOC_API_MAX_NMEA_STRING_LENGTH>;
+};
+
+enum rpc_loc_status_event_e_type {
+  RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+  RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+  RPC_LOC_ENGINE_STATE_ON = 1,
+  RPC_LOC_ENGINE_STATE_OFF = 2,
+  RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+  case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+    rpc_loc_engine_state_e_type engine_state;
+  default:
+    void;
+};
+
+struct rpc_loc_status_event_s_type {
+  rpc_loc_status_event_e_type event;
+  rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+  RPC_LOC_SERVER_ADDR_IPV4 = 1,
+  RPC_LOC_SERVER_ADDR_URL = 2,
+  RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+  rpc_uint32 addr;
+  rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+  rpc_uint16 length;
+  opaque addr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+  case RPC_LOC_SERVER_ADDR_IPV4:
+    rpc_loc_server_addr_ipv4_type ipv4;
+  case RPC_LOC_SERVER_ADDR_URL:
+    rpc_loc_server_addr_url_type url;
+  default:
+    void;
+};
+
+struct rpc_loc_server_info_s_type {
+  rpc_loc_server_addr_e_type addr_type;
+  rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+  RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+  RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+  RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+  RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+  RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+  RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+  RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+  RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+  RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+  RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+  RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+  RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+  RPC_LOC_NI_PRESUPL_UTF8 = 2,
+  RPC_LOC_NI_PRESUPL_UTF16 = 3,
+  RPC_LOC_NI_PRESUPL_UCS2 = 4,
+  RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+  RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+  RPC_LOC_NI_PRESUPL_JIS = 7,
+  RPC_LOC_NI_PRESUPL_EUC = 8,
+  RPC_LOC_NI_PRESUPL_GB2312 = 9,
+  RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+  RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+  RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+  RPC_LOC_NI_SS_GERMAN = 12,
+  RPC_LOC_NI_SS_ENGLISH = 13,
+  RPC_LOC_NI_SS_ITALIAN = 14,
+  RPC_LOC_NI_SS_FRENCH = 15,
+  RPC_LOC_NI_SS_SPANISH = 16,
+  RPC_LOC_NI_SS_DUTCH = 17,
+  RPC_LOC_NI_SS_SWEDISH = 18,
+  RPC_LOC_NI_SS_DANISH = 19,
+  RPC_LOC_NI_SS_PORTUGUESE = 20,
+  RPC_LOC_NI_SS_FINNISH = 21,
+  RPC_LOC_NI_SS_NORWEGIAN = 22,
+  RPC_LOC_NI_SS_GREEK = 23,
+  RPC_LOC_NI_SS_TURKISH = 24,
+  RPC_LOC_NI_SS_HUNGARIAN = 25,
+  RPC_LOC_NI_SS_POLISH = 26,
+  RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+  RPC_LOC_NI_SUPL_UTF8 = 28,
+  RPC_LOC_NI_SUPL_UCS2 = 29,
+  RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+  RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+  RPC_LOC_NI_VX_OCTET = 0,
+  RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+  RPC_LOC_NI_VX_ASCII = 2,
+  RPC_LOC_NI_VX_IA5 = 3,
+  RPC_LOC_NI_VX_UNICODE = 4,
+  RPC_LOC_NI_VX_SHIFT_JIS = 5,
+  RPC_LOC_NI_VX_KOREAN = 6,
+  RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+  RPC_LOC_NI_VX_LATIN = 8,
+  RPC_LOC_NI_VX_GSM = 9,
+  RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+  RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+  RPC_LOC_VX_MS_BASED_ONLY = 2,
+  RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+  RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+  RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+  unsigned char requester_id_length;
+  opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+  rpc_loc_ni_notify_verify_e_type notification_priv_type;
+  unsigned char pos_qos_incl;
+  unsigned char pos_qos;
+  rpc_uint32 num_fixes;
+  rpc_uint32 tbf;
+  rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+  rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+  rpc_loc_ni_vx_requester_id_s_type requester_id;
+  rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+  RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+  RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+  RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+  RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+  RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+  RPC_LOC_NI_POSMETHOD_AFLT = 6,
+  RPC_LOC_NI_POSMETHOD_ECID = 7,
+  RPC_LOC_NI_POSMETHOD_EOTD = 8,
+  RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+  RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+  RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+  unsigned char presence;
+  opaque session_id[4];
+  rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+  unsigned char data_coding_scheme;
+  opaque requestor_id_string<RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH>;
+  unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+  unsigned char data_coding_scheme;
+  opaque client_name_string<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+  unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+  unsigned char bit_mask;
+  unsigned char horacc;
+  unsigned char veracc;
+  unsigned char maxLocAge;
+  unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+  rpc_loc_ni_notify_verify_e_type notification_priv_type;
+  rpc_uint16 flags;
+  rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+  opaque supl_hash[8];
+  rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+  rpc_loc_ni_supl_pos_method_e_type pos_method;
+  rpc_loc_ni_requestor_id_s_type requestor_id;
+  rpc_loc_ni_supl_client_name_s_type client_name;
+  rpc_loc_ni_supl_qop_s_type supl_qop;
+  rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+  unsigned char ext_client_address_len;
+  opaque ext_client_address<RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS>;
+};
+
+enum rpc_loc_ni_location_type_e_type {
+  RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+  RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+  RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+  RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+  unsigned char unused_bits;
+  unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+  unsigned char data_coding_scheme;
+  opaque lcs_codeword_string<RPC_LOC_NI_CODEWORD_LENGTH>;
+  unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+  unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+  rpc_loc_ni_notify_verify_e_type notification_priv_type;
+  unsigned char invoke_id;
+  rpc_uint16 flags;
+  unsigned char notification_length;
+  opaque notification_text<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+  rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+  rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+  rpc_loc_ni_location_type_e_type location_type;
+  rpc_loc_ni_deferred_location_s_type deferred_location;
+  rpc_loc_ni_requestor_id_s_type requestor_id;
+  rpc_loc_ni_codeword_string_s_type codeword_string;
+  rpc_loc_ni_service_type_id_s_type service_type_id;
+  rpc_uint16 user_response_timer;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+  case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+    rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+  case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+    rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+  case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+    rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+  default:
+    void;
+};
+
+struct rpc_loc_ni_event_s_type {
+  rpc_loc_ni_event_e_type event;
+  rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+  RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+  RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+  RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+  rpc_uint32 delay_threshold;
+  rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+  rpc_uint32 max_file_size;
+  rpc_uint32 max_part_size;
+  rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+  case RPC_LOC_ASSIST_DATA_TIME_REQ:
+    rpc_loc_time_download_source_s_type time_download;
+  case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+    rpc_loc_predicted_orbits_data_source_s_type data_download;
+  default:
+    void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+  rpc_loc_assist_data_request_e_type event;
+  rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+  RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+  RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+  RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+  RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+  RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+  RPC_LOC_SERVER_REQUEST_OPEN = 1,
+  RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+  RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+  rpc_loc_server_connection_handle conn_handle;
+  rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+  rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+  case RPC_LOC_SERVER_REQUEST_OPEN:
+    rpc_loc_server_open_req_s_type open_req;
+  case RPC_LOC_SERVER_REQUEST_CLOSE:
+    rpc_loc_server_close_req_s_type close_req;
+  default:
+    void;
+};
+
+struct rpc_loc_server_request_s_type {
+  rpc_loc_server_request_e_type event;
+  rpc_loc_server_request_u_type payload;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+  rpc_uint16 data_size;
+  opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+  RPC_LOC_IOCTL_GET_API_VERSION = 1,
+  RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+  RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+  RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+  RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+  RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+  RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+  RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+  RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+  RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+  RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+  RPC_LOC_IOCTL_INJECT_POSITION = 407,
+  RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+  RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+  RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+  RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+  RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+  RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+  RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+  RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+  RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+  RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+  RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+  RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+  RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+  RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+  RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+  RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+  RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+  RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+  RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+  RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+  RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+  RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+  RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+  unsigned char major;
+  unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+  RPC_LOC_PERIODIC_FIX = 1,
+  RPC_LOC_SINGLE_FIX = 2,
+  RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+  RPC_LOC_OPER_MODE_DEFAULT = 1,
+  RPC_LOC_OPER_MODE_MSB = 2,
+  RPC_LOC_OPER_MODE_MSA = 3,
+  RPC_LOC_OPER_MODE_STANDALONE = 4,
+  RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+  RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+  RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+  RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+  RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+  RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+  RPC_LOC_NOTIFY_ON_ANY = 3,
+  RPC_LOC_NOTIFY_ON_ALL = 4,
+  RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+  rpc_uint32 valid_mask;
+  rpc_loc_fix_recurrence_e_type recurrence_type;
+  rpc_loc_operation_mode_e_type preferred_operation_mode;
+  rpc_uint32 preferred_accuracy;
+  rpc_uint32 preferred_response_time;
+  rpc_boolean intermediate_pos_report_enabled;
+  rpc_loc_notify_e_type notify_type;
+  rpc_uint32 min_interval;
+  float min_distance;
+  rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+  RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+  RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+  RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+  RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+  rpc_loc_ni_user_resp_e_type user_resp;
+  rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+  RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+  RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+  rpc_loc_predicted_orbits_data_format_e_type format_type;
+  rpc_uint32 total_size;
+  rpc_uint8 total_parts;
+  rpc_uint8 part;
+  rpc_uint16 part_len;
+  opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+  rpc_uint64 start_time_utc;
+  rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+  rpc_boolean enable;
+  unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+  rpc_uint64 time_utc;
+  rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+  rpc_loc_assist_pos_valid_mask_type valid_mask;
+  rpc_uint64 timestamp_utc;
+  double latitude;
+  double longitude;
+  float altitude_wrt_ellipsoid;
+  float altitude_wrt_mean_sea_level;
+  float hor_unc_circular;
+  float vert_unc;
+  unsigned char confidence_horizontal;
+  unsigned char confidence_vertical;
+};
+
+enum rpc_loc_server_open_status_e_type {
+  RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+  RPC_LOC_SERVER_OPEN_FAIL = 2,
+  RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+  rpc_loc_server_connection_handle conn_handle;
+  rpc_loc_server_open_status_e_type open_status;
+  string apn_name<>;
+};
+
+enum rpc_loc_server_close_status_e_type {
+  RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+  RPC_LOC_SERVER_CLOSE_FAIL = 2,
+  RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+  rpc_loc_server_connection_handle conn_handle;
+  rpc_loc_server_close_status_e_type close_status;
+};
+
+enum rpc_loc_lock_e_type {
+  RPC_LOC_LOCK_NONE = 1,
+  RPC_LOC_LOCK_MI = 2,
+  RPC_LOC_LOCK_MT = 3,
+  RPC_LOC_LOCK_ALL = 4,
+  RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+  rpc_loc_assist_data_type type;
+  rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+  case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+    rpc_loc_fix_criteria_s_type fix_criteria;
+  case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+    rpc_loc_user_verify_s_type user_verify_resp;
+  case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+    rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+  case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+    rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+  case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+    rpc_loc_assist_data_time_s_type assistance_data_time;
+  case RPC_LOC_IOCTL_INJECT_POSITION:
+    rpc_loc_assist_data_pos_s_type assistance_data_position;
+  case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+    rpc_loc_server_open_status_s_type conn_open_status;
+  case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+    rpc_loc_server_close_status_s_type conn_close_status;
+  case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+    rpc_loc_lock_e_type engine_lock;
+  case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+    rpc_boolean sbas_mode;
+  case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+    rpc_loc_nmea_sentence_type nmea_types;
+  case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+    rpc_boolean on_demand_lpm;
+  case  RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+  case  RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+  case  RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+  case  RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+    rpc_loc_server_info_s_type server_addr;
+  case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+    rpc_loc_assist_data_delete_s_type assist_data_delete;
+  default:
+    void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+  case RPC_LOC_IOCTL_GET_API_VERSION:
+    rpc_loc_api_version_s_type api_version;
+  case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+    rpc_loc_fix_criteria_s_type fix_criteria;
+  case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+    rpc_loc_lock_e_type engine_lock;
+  case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+    rpc_boolean sbas_mode;
+  case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+    rpc_loc_nmea_sentence_type nmea_types;
+  case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+    rpc_boolean on_demand_lpm;
+  case  RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+  case  RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+  case  RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+    rpc_loc_server_info_s_type server_addr;
+  case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+    rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+  case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+    rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+  default:
+    void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+  rpc_loc_ioctl_e_type type;
+  rpc_int32 status;
+  rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+  case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+    rpc_loc_parsed_position_s_type parsed_location_report;
+  case RPC_LOC_EVENT_SATELLITE_REPORT:
+    rpc_loc_gnss_info_s_type gnss_report;
+  case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+    rpc_loc_nmea_report_s_type nmea_report;
+  case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+    rpc_loc_ni_event_s_type ni_request;
+  case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+    rpc_loc_assist_data_request_s_type assist_data_request;
+  case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+    rpc_loc_server_request_s_type loc_server_request;
+  case RPC_LOC_EVENT_IOCTL_REPORT:
+    rpc_loc_ioctl_callback_s_type ioctl_report;
+  case RPC_LOC_EVENT_STATUS_REPORT:
+    rpc_loc_status_event_s_type status_report;
+  case RPC_LOC_EVENT_RESERVED:
+    rpc_loc_reserved_payload_s_type reserved;
+  default:
+    void;
+};
+
+const RPC_LOC_API_NULL_VERSION = 0x00010001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00010001;
diff --git a/loc_api/libloc_api-rpc/gen-6356/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-6356/loc_api_common_xdr.c
new file mode 100755
index 0000000..a68d94f
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_common_xdr.c
@@ -0,0 +1,1458 @@
+/*  
+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.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_bool (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_long (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_short (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_long (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_quad_t (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_int32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint64 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint64 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint16 (xdrs, &objp->year))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->month))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->day_of_week))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->day))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->hour))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->minute))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->second))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+		 return FALSE;
+	 if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+		 return FALSE;
+	 if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+		 return FALSE;
+	 if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+		 return FALSE;
+	 if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->time_unc))
+		 return FALSE;
+	 if (!xdr_double (xdrs, &objp->latitude))
+		 return FALSE;
+	 if (!xdr_double (xdrs, &objp->longitude))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->speed_horizontal))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->speed_vertical))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->heading))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->hor_unc_circular))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->vert_unc))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->speed_unc))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->heading_unc))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->magnetic_deviation))
+		 return FALSE;
+	 if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+		 return FALSE;
+	 if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+		 return FALSE;
+	 if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+		 return FALSE;
+	 if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+		 return FALSE;
+	 if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+		 return FALSE;
+	 if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+		 return FALSE;
+	 if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->elevation))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->azimuth))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->snr))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->position_dop))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->horizontal_dop))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->vertical_dop))
+		 return FALSE;
+	 if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+		 return FALSE;
+	 if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT,
+		sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint16 (xdrs, &objp->length))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+		 if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+		 return FALSE;
+	 if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->port))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint16 (xdrs, &objp->length))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_SERVER_ADDR_IPV4:
+		 if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+			 return FALSE;
+		break;
+	case RPC_LOC_SERVER_ADDR_URL:
+		 if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+		 return FALSE;
+	 if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+	register int32_t *buf;
+
+	int i;
+	 if (!xdr_u_char (xdrs, &objp->requester_id_length))
+		 return FALSE;
+	 if (!xdr_opaque (xdrs, objp->requester_id, 200))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->pos_qos))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+	register int32_t *buf;
+
+	int i;
+	 if (!xdr_u_char (xdrs, &objp->presence))
+		 return FALSE;
+	 if (!xdr_opaque (xdrs, objp->session_id, 4))
+		 return FALSE;
+	 if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->string_len))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->string_len))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->bit_mask))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->horacc))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->veracc))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->maxLocAge))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->delay))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+	register int32_t *buf;
+
+	int i;
+	 if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+		 return FALSE;
+	 if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->unused_bits))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->ms_available))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->string_len))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->invoke_id))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->notification_length))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+		 if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+			 return FALSE;
+		break;
+	case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+		 if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+			 return FALSE;
+		break;
+	case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+		 if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_vector (xdrs, (char *)objp, 3,
+		sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+		 return FALSE;
+	 if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_vector (xdrs, (char *)objp, 3,
+		sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+		 return FALSE;
+	 if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_ASSIST_DATA_TIME_REQ:
+		 if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+			 return FALSE;
+		break;
+	case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+		 if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+		 return FALSE;
+	 if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+		 return FALSE;
+	 if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_SERVER_REQUEST_OPEN:
+		 if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+			 return FALSE;
+		break;
+	case RPC_LOC_SERVER_REQUEST_CLOSE:
+		 if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+		 return FALSE;
+	 if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_char (xdrs, &objp->major))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->minor))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+		 return FALSE;
+	 if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+		 return FALSE;
+	 if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+		 return FALSE;
+	 if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+		 return FALSE;
+	 if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->min_distance))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+		 return FALSE;
+	 if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+		 return FALSE;
+	 if (!xdr_rpc_uint8 (xdrs, &objp->part))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+		 return FALSE;
+	 if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+		 return FALSE;
+	 if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_boolean (xdrs, &objp->enable))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+		 return FALSE;
+	 if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint64 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+		 return FALSE;
+	 if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+		 return FALSE;
+	 if (!xdr_double (xdrs, &objp->latitude))
+		 return FALSE;
+	 if (!xdr_double (xdrs, &objp->longitude))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->hor_unc_circular))
+		 return FALSE;
+	 if (!xdr_float (xdrs, &objp->vert_unc))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+		 return FALSE;
+	 if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+		 return FALSE;
+	 if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+		 return FALSE;
+	 if (!xdr_string (xdrs, &objp->apn_name, ~0))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+		 return FALSE;
+	 if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_enum (xdrs, (enum_t *) objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_uint32 (xdrs, objp))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+	register int32_t *buf;
+
+	int i;
+	 if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+		 return FALSE;
+	 if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+		sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+		 if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+		 if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+		 if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+		 if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+		 if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_INJECT_POSITION:
+		 if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+		 if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+		 if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+		 if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+		 if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+		 if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+		 if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+	case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+	case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+	case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+		 if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+		 if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_IOCTL_GET_API_VERSION:
+		 if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+		 if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+		 if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+		 if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+		 if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+		 if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+	case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+	case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+		 if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+		 if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+			 return FALSE;
+		break;
+	case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+		 if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+		 return FALSE;
+	 if (!xdr_rpc_int32 (xdrs, &objp->status))
+		 return FALSE;
+	 if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+		 return FALSE;
+	return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+	register int32_t *buf;
+
+	 if (!xdr_u_quad_t (xdrs, &objp->disc))
+		 return FALSE;
+	switch (objp->disc) {
+	case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+		 if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_SATELLITE_REPORT:
+		 if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+		 if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+		 if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+		 if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+		 if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_IOCTL_REPORT:
+		 if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_STATUS_REPORT:
+		 if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+			 return FALSE;
+		break;
+	case RPC_LOC_EVENT_RESERVED:
+		 if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+			 return FALSE;
+		break;
+	default:
+		break;
+	}
+	return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-6356/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-6356/loc_api_fixup.c
new file mode 100755
index 0000000..fe512f5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/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-6356/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-6356/loc_api_xdr.c
new file mode 100755
index 0000000..7e6a3e1
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-6356/loc_api_xdr.c
@@ -0,0 +1,188 @@
+/*  
+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.
+ */
+
+#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/rpc_inc/debug.h b/loc_api/libloc_api-rpc/rpc_inc/debug.h
new file mode 100755
index 0000000..a71b23a
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/debug.h
@@ -0,0 +1,57 @@
+/*
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "libgps-rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do {                                    \
+        fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+        fprintf(stdout, ##x);                               \
+        LOGD(x);                               \
+    } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do {                                        \
+        fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+        fprintf(stderr, ##x);                               \
+        LOGE(x);                                            \
+    } while(0)
+
+#define FAILIF(cond, msg...) do {                                              \
+        if (__builtin_expect (cond, 0)) {                                      \
+            fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+            fprintf(stderr, ##msg);                                            \
+            LOGE(##msg);                                                       \
+        }                                                                      \
+    } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/loc_api/libloc_api-rpc/rpc_inc/loc_api.h b/loc_api/libloc_api-rpc/rpc_inc/loc_api.h
new file mode 100755
index 0000000..95f9be5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/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 0x00010001
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern  enum clnt_stat rpc_loc_api_null_0x00010001(void *, void *, CLIENT *);
+extern  bool_t rpc_loc_api_null_0x00010001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern  enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern  bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern  enum clnt_stat rpc_loc_open_0x00010001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern  bool_t rpc_loc_open_0x00010001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern  enum clnt_stat rpc_loc_close_0x00010001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern  bool_t rpc_loc_close_0x00010001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern  enum clnt_stat rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern  bool_t rpc_loc_start_fix_0x00010001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern  enum clnt_stat rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern  bool_t rpc_loc_stop_fix_0x00010001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern  enum clnt_stat rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern  bool_t rpc_loc_ioctl_0x00010001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern  enum clnt_stat rpc_loc_api_api_versions_0x00010001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern  bool_t rpc_loc_api_api_versions_0x00010001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern  enum clnt_stat rpc_loc_api_null_0x00010001();
+extern  bool_t rpc_loc_api_null_0x00010001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern  enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001();
+extern  bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc();
+#define rpc_loc_open 2
+extern  enum clnt_stat rpc_loc_open_0x00010001();
+extern  bool_t rpc_loc_open_0x00010001_svc();
+#define rpc_loc_close 3
+extern  enum clnt_stat rpc_loc_close_0x00010001();
+extern  bool_t rpc_loc_close_0x00010001_svc();
+#define rpc_loc_start_fix 4
+extern  enum clnt_stat rpc_loc_start_fix_0x00010001();
+extern  bool_t rpc_loc_start_fix_0x00010001_svc();
+#define rpc_loc_stop_fix 5
+extern  enum clnt_stat rpc_loc_stop_fix_0x00010001();
+extern  bool_t rpc_loc_stop_fix_0x00010001_svc();
+#define rpc_loc_ioctl 6
+extern  enum clnt_stat rpc_loc_ioctl_0x00010001();
+extern  bool_t rpc_loc_ioctl_0x00010001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern  enum clnt_stat rpc_loc_api_api_versions_0x00010001();
+extern  bool_t rpc_loc_api_api_versions_0x00010001_svc();
+extern int loc_apiprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern  bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern  bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern  bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern  bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern  bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern  bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern  bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern  bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern  bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern  bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern  bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern  bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern  bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern  bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern  bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/rpc_inc/loc_api_cb.h b/loc_api/libloc_api-rpc/rpc_inc/loc_api_cb.h
new file mode 100755
index 0000000..cbc783d
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/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 0x00010001
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern  enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern  bool_t rpc_loc_event_cb_f_type_0x00010001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern  enum clnt_stat rpc_loc_event_cb_f_type_0x00010001();
+extern  bool_t rpc_loc_event_cb_f_type_0x00010001_svc();
+extern int loc_apicbprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern  bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern  bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/rpc_inc/loc_api_common.h b/loc_api/libloc_api-rpc/rpc_inc/loc_api_common.h
new file mode 100755
index 0000000..66bfcb4
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/loc_api_common.h
@@ -0,0 +1,1047 @@
+/*  
+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_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "rpc_inc/loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_OPEN_VERSION 0x00010001
+#define RPC_LOC_CLOSE_VERSION 0x00010001
+#define RPC_LOC_START_FIX_VERSION 0x00010001
+#define RPC_LOC_STOP_FIX_VERSION 0x00010001
+#define RPC_LOC_IOCTL_VERSION 0x00010001
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00010001
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+#define RPC_LOC_API_API_MAJOR_NUM 0x0001
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+	RPC_LOC_SESS_STATUS_SUCCESS = 0,
+	RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+	RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+	RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+	RPC_LOC_SESS_STATUS_USER_END = 4,
+	RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+	RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+	RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+	RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+	rpc_uint16 year;
+	u_char month;
+	u_char day_of_week;
+	u_char day;
+	u_char hour;
+	u_char minute;
+	u_char second;
+	rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+	rpc_loc_position_valid_mask_type valid_mask;
+	rpc_loc_session_status_e_type session_status;
+	rpc_loc_calendar_time_s_type timestamp_calendar;
+	rpc_uint64 timestamp_utc;
+	rpc_uint8 leap_seconds;
+	float time_unc;
+	double latitude;
+	double longitude;
+	float altitude_wrt_ellipsoid;
+	float altitude_wrt_mean_sea_level;
+	float speed_horizontal;
+	float speed_vertical;
+	float heading;
+	float hor_unc_circular;
+	float hor_unc_ellipse_semi_major;
+	float hor_unc_ellipse_semi_minor;
+	float hor_unc_ellipse_orient_azimuth;
+	float vert_unc;
+	float speed_unc;
+	float heading_unc;
+	u_char confidence_horizontal;
+	u_char confidence_vertical;
+	float magnetic_deviation;
+	rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+	RPC_LOC_SV_SYSTEM_GPS = 1,
+	RPC_LOC_SV_SYSTEM_GALILEO = 2,
+	RPC_LOC_SV_SYSTEM_SBAS = 3,
+	RPC_LOC_SV_SYSTEM_COMPASS = 4,
+	RPC_LOC_SV_SYSTEM_GLONASS = 5,
+	RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+	RPC_LOC_SV_STATUS_IDLE = 1,
+	RPC_LOC_SV_STATUS_SEARCH = 2,
+	RPC_LOC_SV_STATUS_TRACK = 3,
+	RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+	rpc_loc_sv_info_valid_mask_type valid_mask;
+	rpc_loc_sv_system_e_type system;
+	rpc_uint8 prn;
+	rpc_uint8 health_status;
+	rpc_loc_sv_status_e_type process_status;
+	rpc_boolean has_eph;
+	rpc_boolean has_alm;
+	float elevation;
+	float azimuth;
+	float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+	rpc_loc_gnss_info_valid_mask_type valid_mask;
+	float position_dop;
+	float horizontal_dop;
+	float vertical_dop;
+	rpc_boolean altitude_assumed;
+	rpc_uint16 sv_count;
+	struct {
+		u_int sv_list_len;
+		rpc_loc_sv_info_s_type *sv_list_val;
+	} sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+	rpc_uint16 length;
+	struct {
+		u_int nmea_sentences_len;
+		char *nmea_sentences_val;
+	} nmea_sentences;
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+	RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+	RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+	RPC_LOC_ENGINE_STATE_ON = 1,
+	RPC_LOC_ENGINE_STATE_OFF = 2,
+	RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+	rpc_loc_status_event_e_type disc;
+	union {
+		rpc_loc_engine_state_e_type engine_state;
+	} rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+	rpc_loc_status_event_e_type event;
+	rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+	RPC_LOC_SERVER_ADDR_IPV4 = 1,
+	RPC_LOC_SERVER_ADDR_URL = 2,
+	RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+	rpc_uint32 addr;
+	rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+	rpc_uint16 length;
+	struct {
+		u_int addr_len;
+		char *addr_val;
+	} addr;
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+	rpc_loc_server_addr_e_type disc;
+	union {
+		rpc_loc_server_addr_ipv4_type ipv4;
+		rpc_loc_server_addr_url_type url;
+	} rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+	rpc_loc_server_addr_e_type addr_type;
+	rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+	RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+	RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+	RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+	RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+	RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+	RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+	RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+	RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+	RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+	RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+	RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+	RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+	RPC_LOC_NI_PRESUPL_UTF8 = 2,
+	RPC_LOC_NI_PRESUPL_UTF16 = 3,
+	RPC_LOC_NI_PRESUPL_UCS2 = 4,
+	RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+	RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+	RPC_LOC_NI_PRESUPL_JIS = 7,
+	RPC_LOC_NI_PRESUPL_EUC = 8,
+	RPC_LOC_NI_PRESUPL_GB2312 = 9,
+	RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+	RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+	RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+	RPC_LOC_NI_SS_GERMAN = 12,
+	RPC_LOC_NI_SS_ENGLISH = 13,
+	RPC_LOC_NI_SS_ITALIAN = 14,
+	RPC_LOC_NI_SS_FRENCH = 15,
+	RPC_LOC_NI_SS_SPANISH = 16,
+	RPC_LOC_NI_SS_DUTCH = 17,
+	RPC_LOC_NI_SS_SWEDISH = 18,
+	RPC_LOC_NI_SS_DANISH = 19,
+	RPC_LOC_NI_SS_PORTUGUESE = 20,
+	RPC_LOC_NI_SS_FINNISH = 21,
+	RPC_LOC_NI_SS_NORWEGIAN = 22,
+	RPC_LOC_NI_SS_GREEK = 23,
+	RPC_LOC_NI_SS_TURKISH = 24,
+	RPC_LOC_NI_SS_HUNGARIAN = 25,
+	RPC_LOC_NI_SS_POLISH = 26,
+	RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+	RPC_LOC_NI_SUPL_UTF8 = 28,
+	RPC_LOC_NI_SUPL_UCS2 = 29,
+	RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+	RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+	RPC_LOC_NI_VX_OCTET = 0,
+	RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+	RPC_LOC_NI_VX_ASCII = 2,
+	RPC_LOC_NI_VX_IA5 = 3,
+	RPC_LOC_NI_VX_UNICODE = 4,
+	RPC_LOC_NI_VX_SHIFT_JIS = 5,
+	RPC_LOC_NI_VX_KOREAN = 6,
+	RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+	RPC_LOC_NI_VX_LATIN = 8,
+	RPC_LOC_NI_VX_GSM = 9,
+	RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+	RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+	RPC_LOC_VX_MS_BASED_ONLY = 2,
+	RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+	RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+	RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+	u_char requester_id_length;
+	char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+	rpc_loc_ni_notify_verify_e_type notification_priv_type;
+	u_char pos_qos_incl;
+	u_char pos_qos;
+	rpc_uint32 num_fixes;
+	rpc_uint32 tbf;
+	rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+	rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+	rpc_loc_ni_vx_requester_id_s_type requester_id;
+	rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+	RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+	RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+	RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+	RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+	RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+	RPC_LOC_NI_POSMETHOD_AFLT = 6,
+	RPC_LOC_NI_POSMETHOD_ECID = 7,
+	RPC_LOC_NI_POSMETHOD_EOTD = 8,
+	RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+	RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+	RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+	u_char presence;
+	char session_id[4];
+	rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+	u_char data_coding_scheme;
+	struct {
+		u_int requestor_id_string_len;
+		char *requestor_id_string_val;
+	} requestor_id_string;
+	u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+	u_char data_coding_scheme;
+	struct {
+		u_int client_name_string_len;
+		char *client_name_string_val;
+	} client_name_string;
+	u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+	u_char bit_mask;
+	u_char horacc;
+	u_char veracc;
+	u_char maxLocAge;
+	u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+	rpc_loc_ni_notify_verify_e_type notification_priv_type;
+	rpc_uint16 flags;
+	rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+	char supl_hash[8];
+	rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+	rpc_loc_ni_supl_pos_method_e_type pos_method;
+	rpc_loc_ni_requestor_id_s_type requestor_id;
+	rpc_loc_ni_supl_client_name_s_type client_name;
+	rpc_loc_ni_supl_qop_s_type supl_qop;
+	rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+	u_char ext_client_address_len;
+	struct {
+		u_int ext_client_address_len;
+		char *ext_client_address_val;
+	} ext_client_address;
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+	RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+	RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+	RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+	RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+	u_char unused_bits;
+	u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+	u_char data_coding_scheme;
+	struct {
+		u_int lcs_codeword_string_len;
+		char *lcs_codeword_string_val;
+	} lcs_codeword_string;
+	u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+	u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+	rpc_loc_ni_notify_verify_e_type notification_priv_type;
+	u_char invoke_id;
+	rpc_uint16 flags;
+	u_char notification_length;
+	struct {
+		u_int notification_text_len;
+		char *notification_text_val;
+	} notification_text;
+	rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+	rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+	rpc_loc_ni_location_type_e_type location_type;
+	rpc_loc_ni_deferred_location_s_type deferred_location;
+	rpc_loc_ni_requestor_id_s_type requestor_id;
+	rpc_loc_ni_codeword_string_s_type codeword_string;
+	rpc_loc_ni_service_type_id_s_type service_type_id;
+	rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+	rpc_loc_ni_event_e_type disc;
+	union {
+		rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+		rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+		rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+	} rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+	rpc_loc_ni_event_e_type event;
+	rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+	RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+	RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+	RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+	rpc_uint32 delay_threshold;
+	rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+	rpc_uint32 max_file_size;
+	rpc_uint32 max_part_size;
+	rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+	rpc_loc_assist_data_request_e_type disc;
+	union {
+		rpc_loc_time_download_source_s_type time_download;
+		rpc_loc_predicted_orbits_data_source_s_type data_download;
+	} rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+	rpc_loc_assist_data_request_e_type event;
+	rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+	RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+	RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+	RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+	RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+	RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+	RPC_LOC_SERVER_REQUEST_OPEN = 1,
+	RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+	RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+	rpc_loc_server_connection_handle conn_handle;
+	rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+	rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+	rpc_loc_server_request_e_type disc;
+	union {
+		rpc_loc_server_open_req_s_type open_req;
+		rpc_loc_server_close_req_s_type close_req;
+	} rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+	rpc_loc_server_request_e_type event;
+	rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+	rpc_uint16 data_size;
+	struct {
+		u_int data_len;
+		char *data_val;
+	} data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+	RPC_LOC_IOCTL_GET_API_VERSION = 1,
+	RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+	RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+	RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+	RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+	RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+	RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+	RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+	RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+	RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+	RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+	RPC_LOC_IOCTL_INJECT_POSITION = 407,
+	RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+	RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+	RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+	RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+	RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+	RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+	RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+	RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+	RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+	RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+	RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+	RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+	RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+	RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+	RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+	RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+	RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+	RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+	RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+	RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+	RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+	RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+	RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+	u_char major;
+	u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+	RPC_LOC_PERIODIC_FIX = 1,
+	RPC_LOC_SINGLE_FIX = 2,
+	RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+	RPC_LOC_OPER_MODE_DEFAULT = 1,
+	RPC_LOC_OPER_MODE_MSB = 2,
+	RPC_LOC_OPER_MODE_MSA = 3,
+	RPC_LOC_OPER_MODE_STANDALONE = 4,
+	RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+	RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+	RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+	RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+	RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+	RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+	RPC_LOC_NOTIFY_ON_ANY = 3,
+	RPC_LOC_NOTIFY_ON_ALL = 4,
+	RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+	rpc_uint32 valid_mask;
+	rpc_loc_fix_recurrence_e_type recurrence_type;
+	rpc_loc_operation_mode_e_type preferred_operation_mode;
+	rpc_uint32 preferred_accuracy;
+	rpc_uint32 preferred_response_time;
+	rpc_boolean intermediate_pos_report_enabled;
+	rpc_loc_notify_e_type notify_type;
+	rpc_uint32 min_interval;
+	float min_distance;
+	rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+	RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+	RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+	RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+	RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+	rpc_loc_ni_user_resp_e_type user_resp;
+	rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+	RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+	RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+	rpc_loc_predicted_orbits_data_format_e_type format_type;
+	rpc_uint32 total_size;
+	rpc_uint8 total_parts;
+	rpc_uint8 part;
+	rpc_uint16 part_len;
+	struct {
+		u_int data_ptr_len;
+		char *data_ptr_val;
+	} data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+	rpc_uint64 start_time_utc;
+	rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+	rpc_boolean enable;
+	u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+	rpc_uint64 time_utc;
+	rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+	rpc_loc_assist_pos_valid_mask_type valid_mask;
+	rpc_uint64 timestamp_utc;
+	double latitude;
+	double longitude;
+	float altitude_wrt_ellipsoid;
+	float altitude_wrt_mean_sea_level;
+	float hor_unc_circular;
+	float vert_unc;
+	u_char confidence_horizontal;
+	u_char confidence_vertical;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+	RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+	RPC_LOC_SERVER_OPEN_FAIL = 2,
+	RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+	rpc_loc_server_connection_handle conn_handle;
+	rpc_loc_server_open_status_e_type open_status;
+	char *apn_name;
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+	RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+	RPC_LOC_SERVER_CLOSE_FAIL = 2,
+	RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+	rpc_loc_server_connection_handle conn_handle;
+	rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+enum rpc_loc_lock_e_type {
+	RPC_LOC_LOCK_NONE = 1,
+	RPC_LOC_LOCK_MI = 2,
+	RPC_LOC_LOCK_MT = 3,
+	RPC_LOC_LOCK_ALL = 4,
+	RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+	rpc_loc_assist_data_type type;
+	rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+	rpc_loc_ioctl_e_type disc;
+	union {
+		rpc_loc_fix_criteria_s_type fix_criteria;
+		rpc_loc_user_verify_s_type user_verify_resp;
+		rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+		rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+		rpc_loc_assist_data_time_s_type assistance_data_time;
+		rpc_loc_assist_data_pos_s_type assistance_data_position;
+		rpc_loc_server_open_status_s_type conn_open_status;
+		rpc_loc_server_close_status_s_type conn_close_status;
+		rpc_loc_lock_e_type engine_lock;
+		rpc_boolean sbas_mode;
+		rpc_loc_nmea_sentence_type nmea_types;
+		rpc_boolean on_demand_lpm;
+		rpc_loc_server_info_s_type server_addr;
+		rpc_loc_assist_data_delete_s_type assist_data_delete;
+	} rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+	rpc_loc_ioctl_e_type disc;
+	union {
+		rpc_loc_api_version_s_type api_version;
+		rpc_loc_fix_criteria_s_type fix_criteria;
+		rpc_loc_lock_e_type engine_lock;
+		rpc_boolean sbas_mode;
+		rpc_loc_nmea_sentence_type nmea_types;
+		rpc_boolean on_demand_lpm;
+		rpc_loc_server_info_s_type server_addr;
+		rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+		rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+	} rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+	rpc_loc_ioctl_e_type type;
+	rpc_int32 status;
+	rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+	u_quad_t disc;
+	union {
+		rpc_loc_parsed_position_s_type parsed_location_report;
+		rpc_loc_gnss_info_s_type gnss_report;
+		rpc_loc_nmea_report_s_type nmea_report;
+		rpc_loc_ni_event_s_type ni_request;
+		rpc_loc_assist_data_request_s_type assist_data_request;
+		rpc_loc_server_request_s_type loc_server_request;
+		rpc_loc_ioctl_callback_s_type ioctl_report;
+		rpc_loc_status_event_s_type status_report;
+		rpc_loc_reserved_payload_s_type reserved;
+	} rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+#define RPC_LOC_API_NULL_VERSION 0x00010001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00010001
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern  bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern  bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern  bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern  bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern  bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern  bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern  bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern  bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern  bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern  bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern  bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern  bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern  bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern  bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern  bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern  bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern  bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern  bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern  bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern  bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern  bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern  bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern  bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern  bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern  bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern  bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern  bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern  bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern  bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern  bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern  bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern  bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern  bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern  bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern  bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern  bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern  bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern  bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern  bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern  bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern  bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern  bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern  bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern  bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern  bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern  bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern  bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern  bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern  bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern  bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern  bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern  bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern  bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern  bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern  bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern  bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern  bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern  bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern  bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern  bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern  bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern  bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern  bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern  bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern  bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern  bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern  bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern  bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern  bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern  bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern  bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern  bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern  bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern  bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern  bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern  bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern  bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern  bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern  bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern  bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern  bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern  bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern  bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern  bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern  bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern  bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern  bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern  bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern  bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern  bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern  bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern  bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern  bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern  bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern  bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/rpc_inc/loc_api_fixup.h b/loc_api/libloc_api-rpc/rpc_inc/loc_api_fixup.h
new file mode 100755
index 0000000..e62eb36
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+  @file:  loc_api_fixup.h
+  @brief:  Loc API Android RPC amendment header
+
+  DESCRIPTION
+     Loc API Android RPC amendment header
+
+  INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+  -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  -----------------------------------------------------------------------------
+ ******************************************************************************/
+
+#ifndef  LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER   1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER   0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID     -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS           0
+#define RPC_LOC_API_GENERAL_FAILURE   1
+#define RPC_LOC_API_UNSUPPORTED       2
+#define RPC_LOC_API_INVALID_HANDLE    4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY       6
+#define RPC_LOC_API_PHONE_OFFLINE     7
+#define RPC_LOC_API_TIMEOUT           8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE       (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT                      80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH            1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH            256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS  3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS               3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT             0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT                   0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT                    0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT               0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST           0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST            0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST            0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT                       0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT                      0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS                 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR             0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC                  0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS                   0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC                       0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE                       0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE                      0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID         0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL    0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL               0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL                 0x00000400
+#define RPC_LOC_POS_VALID_HEADING                        0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR               0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ          0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN          0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH    0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC                   0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC                      0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC                    0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL          0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL            0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION             0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK                0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID    0x00000002
+#define RPC_LOC_POS_TECH_WIFI      0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM         0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN            0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS  0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH        0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM        0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION      0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH        0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR            0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP           0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP           0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP          0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED  0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT          0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST           0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH          200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH                 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH  4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH           64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS           20
+#define RPC_LOC_NI_CODEWORD_LENGTH                  20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID         0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID  0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID  0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID   0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE                  0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE         0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY               0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME          0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED  0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE                      0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL                     0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE                     0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL         0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC                0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE                     0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE                    0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID       0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL  0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR             0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC                     0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL        0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL          0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL         0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL    0xffff
+#define RPC_LOC_NMEA_MASK_GGA    0x0001
+#define RPC_LOC_NMEA_MASK_RMC    0x0002
+#define RPC_LOC_NMEA_MASK_GSV    0x0004
+#define RPC_LOC_NMEA_MASK_GSA    0x0008
+#define RPC_LOC_NMEA_MASK_VTG    0x0010
+
+/* flags for notification */
+#define  RPC_LOC_NI_CLIENT_NAME_PRESENT             0x0001
+#define  RPC_LOC_NI_CLIENT_EXTADDR_PRESENT          0x0002
+#define  RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT       0x0010
+#define  RPC_LOC_NI_REQUESTOR_ID_PRESENT            0x0020
+#define  RPC_LOC_NI_CODEWORD_PRESENT                0x0040
+#define  RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT         0x0080
+#define  RPC_LOC_NI_ENCODING_TYPE_PRESENT           0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/loc_api/libloc_api-rpc/rpc_inc/loc_api_rpc_glue.h b/loc_api/libloc_api-rpc/rpc_inc/loc_api_rpc_glue.h
new file mode 100755
index 0000000..e855162
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/loc_api_rpc_glue.h
@@ -0,0 +1,100 @@
+/******************************************************************************
+  @file:  loc_api_rpc_glue.h
+  @brief:  Loc API Android glue code header
+
+  DESCRIPTION
+     Loc API Android glue code header
+
+  INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+  -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  -----------------------------------------------------------------------------
+ ******************************************************************************/
+
+/*=====================================================================
+                        EDIT HISTORY FOR MODULE
+
+  This section contains comments describing changes made to the module.
+  Notice that changes are listed in reverse chronological order.
+
+when       who      what, where, why
+--------   ---      -------------------------------------------------------
+03/17/09   dx       Initial version
+
+$Id: //source/qcom/qct/modem/gps/cgps/dev/locationmiddleware/locapi/app-linux/source/test/loc_api_test/loc_api_cb_log.h#4 $
+======================================================================*/
+
+#ifndef LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#include "rpc_inc/loc_api_fixup.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+      rpc_loc_client_handle_type            loc_handle,             /* handle of the client */
+      rpc_loc_event_mask_type               loc_event,              /* event mask           */
+      const rpc_loc_event_payload_u_type*   loc_event_payload       /* payload              */
+);
+
+extern rpc_loc_client_handle_type loc_open(
+      rpc_loc_event_mask_type       event_reg_mask,
+      loc_event_cb_f_type       *event_callback
+);
+
+extern int32 loc_close
+(
+      rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+      rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+      rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+      rpc_loc_client_handle_type           handle,
+      rpc_loc_ioctl_e_type                 ioctl_type,
+      rpc_loc_ioctl_data_u_type*           ioctl_data
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/loc_api/libloc_api-rpc/rpc_inc/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/rpc_inc/loc_apicb_appinit.h
new file mode 100755
index 0000000..92d4e15
--- /dev/null
+++ b/loc_api/libloc_api-rpc/rpc_inc/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/src/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/src/loc_api_rpc_glue.c
new file mode 100755
index 0000000..930ff1c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/src/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+  @file  loc_api_rpc_glue.c
+  @brief Android Loc API glue code using rpcgen.
+
+  DESCRIPTION
+  Loc API glue code for Android
+
+  -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+                        EDIT HISTORY FOR MODULE
+
+  This section contains comments describing changes made to the module.
+  Notice that changes are listed in reverse chronological order.
+
+when       who      what, where, why 
+--------   ---      ------------------------------------------------------- 
+03/05/2009   dx       Initial version
+
+======================================================================*/ 
+/*=====================================================================
+
+                     INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "rpc_inc/loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+     External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1 
+loc_event_cb_f_type *loc_api_saved_cb = NULL;  /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+   if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+   if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }   
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00010001_svc(
+        rpc_loc_event_cb_f_type_args *argp,
+        rpc_loc_event_cb_f_type_rets *ret,
+        struct svc_req *req)
+{
+    /* Callback not registered, or unexpected ID (shouldn't happen) */
+    if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+    {
+        LOGD("Warning: No callback handler.\n");
+        ret->loc_event_cb_f_type_result = 0;
+        return 1; /* simply return */
+    }
+
+    LOGD("proc: %x  prog: %x  vers: %x\n",
+            (int) req->rq_proc,
+            (int) req->rq_prog,
+            (int) req->rq_vers);
+
+    LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+            (int) argp->loc_event,
+            (int) argp->loc_handle,
+            (int) ret);
+
+    /* Forward callback to real callback procedure */
+    rpc_loc_client_handle_type        loc_handle = argp->loc_handle;
+    rpc_loc_event_mask_type           loc_event  = argp->loc_event;
+    const rpc_loc_event_payload_u_type*  loc_event_payload =
+        (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+    int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+    ret->loc_event_cb_f_type_result = rc;
+
+    return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+    xdr_free (xdr_result, result);
+
+    /*
+     * Insert additional freeing code here, if needed
+     */
+    // LOGD("***** loc_apicbprog_freeresult\n");
+
+    return 1;
+}
+
+int loc_apicbprog_0x00010001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+    return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+   Initiates the RPC client
+
+RETURN VALUE
+   1 for success
+   0 for failure
+   
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+    if (loc_api_clnt == NULL)
+    {
+        /* Print msg */
+        LOGD("Trying to create RPC client...\n");
+        loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL);
+        LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+        if (loc_api_clnt == NULL)
+        {
+            fprintf(stderr, "Error: cannot create RPC client.\n");
+            return 0;
+        }
+
+        /* Init RPC callbacks */
+        int rc = loc_apicb_app_init();
+        if (rc >= 0)
+        {
+            LOGD("Loc API callback initialized.\n");
+        } else {
+            fprintf(stderr, "Loc API callback initialization failed.\n");
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+        rpc_loc_event_mask_type  event_reg_mask,
+        loc_event_cb_f_type      *event_callback
+    )
+{
+    LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+    rpc_loc_open_args args;
+    args.event_reg_mask = event_reg_mask;
+    args.event_callback = LOC_API_CB_ID;
+    loc_api_saved_cb = event_callback;
+
+    rpc_loc_open_rets rets;
+    enum clnt_stat stat = RPC_SUCCESS;
+
+    stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+    LOC_GLUE_CHECK_RESULT(stat, int32);
+
+    return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+    LOC_GLUE_CHECK_INIT(int32);
+
+    rpc_loc_close_args args;
+    args.handle = handle;
+
+    rpc_loc_close_rets rets;
+    enum clnt_stat stat = RPC_SUCCESS;
+
+    stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+    LOC_GLUE_CHECK_RESULT(stat, int32);
+
+    return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+    LOC_GLUE_CHECK_INIT(int32);
+
+    rpc_loc_start_fix_args args;
+    args.handle = handle;
+
+    rpc_loc_start_fix_rets rets;
+    enum clnt_stat stat = RPC_SUCCESS;
+
+    stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+    LOC_GLUE_CHECK_RESULT(stat, int32);
+
+    return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+    LOC_GLUE_CHECK_INIT(int32);
+
+    rpc_loc_stop_fix_args args;
+    args.handle = handle;
+
+    rpc_loc_stop_fix_rets rets;
+    enum clnt_stat stat = RPC_SUCCESS;
+
+    stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+    LOC_GLUE_CHECK_RESULT(stat, int32);
+
+    return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+    rpc_loc_client_handle_type           handle,
+    rpc_loc_ioctl_e_type                 ioctl_type,
+    rpc_loc_ioctl_data_u_type*           ioctl_data
+    )
+{
+    LOC_GLUE_CHECK_INIT(int32);
+
+    rpc_loc_ioctl_args args;
+    args.handle = handle;
+    args.ioctl_data = ioctl_data;
+    args.ioctl_type = ioctl_type;
+    if (ioctl_data != NULL)
+    {
+        /* Assign ioctl union discriminator */
+        ioctl_data->disc = ioctl_type;
+
+        /* In case the user hasn't filled in other disc fields,
+           automatically fill them in here */
+        switch (ioctl_type)
+        {
+            case RPC_LOC_IOCTL_GET_API_VERSION:
+            case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+            case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+            case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+            case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+            case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+            case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+            case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+            case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+            case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+            case RPC_LOC_IOCTL_INJECT_POSITION:
+            case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+            case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+            case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+            case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+            case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+            case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+            case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+            case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+            case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+                break;
+            case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+            case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+            case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+                args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+                    args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+                break;
+            case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+            case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+            case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+                break;
+            case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+            case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+            case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+            case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+            case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+            default:
+                break;
+        } /* switch */
+    } /* ioctl_data != NULL */
+
+    rpc_loc_ioctl_rets rets;
+    enum clnt_stat stat = RPC_SUCCESS;
+
+    stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+    LOC_GLUE_CHECK_RESULT(stat, int32);
+
+    return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+    LOC_GLUE_CHECK_INIT(int32);
+
+    int32 rets;
+    enum clnt_stat stat = RPC_SUCCESS;
+
+    stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+    LOC_GLUE_CHECK_RESULT(stat, int32);
+
+    return (int32) rets;
+}
diff --git a/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
new file mode 100755
index 0000000..511080c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
@@ -0,0 +1,61 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+·         Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+
+·         Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+
+·         Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -------------------------------------------------------------------------------
+ */ 
+#include "rpc/rpc.h"
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#include "rpc_inc/loc_api_fixup.h"
+
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+    /* Register a callback server to use the loc_apicbprog_* function  */
+    if (svrPort == NULL) {
+        svrPort = svcrtr_create();
+    }
+    if (!svrPort) return -1;
+
+    xprt_register(svrPort);
+    if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+    {
+        return 0;
+    }
+    else
+    {
+        return -1;
+    }
+}
+
+void loc_apicb_app_deinit(void)
+{
+    if (svrPort == NULL)
+    {
+        return;
+    }
+    xprt_unregister(svrPort);
+    svc_destroy(svrPort);
+    //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+    svrPort = NULL;
+}
diff --git a/loc_api/libloc_api/Android.mk b/loc_api/libloc_api/Android.mk
new file mode 100755
index 0000000..bc8e4ae
--- /dev/null
+++ b/loc_api/libloc_api/Android.mk
@@ -0,0 +1,45 @@
+#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 ($(BUILD_TINY_ANDROID),true)
+
+AMSS_VERSION:=6356
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_api
+
+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
+
+LOCAL_CFLAGS += \
+    -fno-short-enums 
+
+LOCAL_C_INCLUDES:= \
+	$(TARGET_OUT_HEADERS)/libloc_api-rpc \
+	$(TARGET_OUT_HEADERS)/libloc_api-rpc/rpc_inc \
+	$(TARGET_OUT_HEADERS)/libcommondefs-rpc/inc \
+	$(TARGET_OUT_HEADERS)/librpc
+
+LOCAL_PRELINK_MODULE := false
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+
diff --git a/loc_api/libloc_api/loc_eng.cpp b/loc_api/libloc_api/loc_eng.cpp
new file mode 100755
index 0000000..acc4dfd
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng.cpp
@@ -0,0 +1,1380 @@
+/******************************************************************************
+  @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 <hardware_legacy/gps.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, int fix_frequency);
+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 (void);
+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 =
+{
+    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 =
+{
+    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
+
+===========================================================================*/
+static int loc_eng_init(GpsCallbacks* callbacks)
+{
+    // Start the LOC api RPC service
+    loc_api_glue_init ();
+
+    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;
+
+    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);
+    loc_eng_data.deferred_action_thread_need_exit = FALSE;
+ 
+    loc_eng_data.data_connection_succeeded = FALSE;
+    loc_eng_data.data_connection_closed = FALSE;
+    loc_eng_data.data_connection_failed = FALSE;
+    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 = NULL;
+    pthread_create (&(loc_eng_data.deferred_action_thread),
+                    NULL,
+                    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 (loc_eng_data.deferred_action_thread)
+    {
+        /* Terminate deferred action working thread */
+        pthread_mutex_lock (&loc_eng_data.deferred_action_mutex);
+        loc_eng_data.deferred_action_thread_need_exit = TRUE;
+        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);
+
+    // RPC glue code
+    loc_apicb_app_deinit();
+}
+
+
+/*===========================================================================
+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");
+
+    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 frequnecy (in seconds) for the tracking session.
+
+DEPENDENCIES
+   None
+
+RETURN VALUE
+   0: success
+
+SIDE EFFECTS
+   N/A
+
+===========================================================================*/
+static int loc_eng_set_position_mode(GpsPositionMode mode, int fix_frequency)
+{
+    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, fix_frequency, 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_MIN_INTERVAL |
+                                   RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+                                   RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+    fix_criteria_ptr->min_interval = fix_frequency * 1000; // Translate to ms
+    fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
+
+    if (mode == GPS_POSITION_MODE_MS_BASED)
+    {
+        fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSB;
+    }
+    else if (mode == GPS_POSITION_MODE_MS_ASSISTED)
+    {
+        fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSA;
+    }
+    // Default: standalone
+    else
+    {
+        fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_STANDALONE;
+    }
+
+    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));
+
+    // If this is DELETE ALL
+    if (f == GPS_DELETE_ALL)
+    {
+        loc_eng_data.aiding_data_for_deletion = GPS_DELETE_ALL;
+    }
+    else
+    {
+        // Currently, LOC API 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
+        loc_eng_data.aiding_data_for_deletion |= f;
+    }
+
+    if ((loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON) &&
+        (loc_eng_data.aiding_data_for_deletion != 0))
+    {
+        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)
+    {
+        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 (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 */
+    }
+    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 (GpsLocation));
+    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].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 (GpsStatus));
+    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)
+        {
+            status.status = GPS_STATUS_SESSION_BEGIN;
+        }
+        else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+        {
+            status.status = GPS_STATUS_SESSION_END;
+        }
+    }
+
+    if ((status.status != GPS_STATUS_NONE) && (loc_eng_data.status_cb != NULL))
+    {
+        LOGV ("loc_eng_report_status: issue callback with status %d\n", status.status);
+        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_ENGINE_ON) &&
+        (loc_eng_data.aiding_data_for_deletion != 0))
+    {
+        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;
+
+        loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+                nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+    }
+}
+
+/*===========================================================================
+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;
+    }
+    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;
+    }
+
+    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));
+    loc_eng_data.data_connection_succeeded = TRUE;
+
+    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';
+    }
+
+    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));
+    loc_eng_data.data_connection_closed = TRUE;
+// DO WE NEED TO SIGNAL HERE?
+    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));
+    loc_eng_data.data_connection_failed = TRUE;
+    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;
+    char                            url[24];
+    int                             len;
+    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);
+    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)));
+    len = strlen (url);
+
+    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;
+    server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
+    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= len;
+
+    LOGD ("set_agps_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val);
+
+    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);
+    if (loc_eng_data.aiding_data_for_deletion == GPS_DELETE_ALL)
+    {
+        assist_data_ptr->type = RPC_LOC_ASSIST_DATA_ALL;
+    }
+    else
+    {
+        assist_data_ptr->type = loc_eng_data.aiding_data_for_deletion;
+    }
+    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 (void)
+{
+    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 (loc_eng_data.data_connection_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;
+        loc_eng_data.data_connection_closed = FALSE;
+    }
+    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 (loc_eng_data.data_connection_succeeded)
+        {
+            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));
+            conn_open_status_ptr->apn_name = loc_eng_data.apn_name;
+            // 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);
+            loc_eng_data.data_connection_succeeded = FALSE;
+        }
+        else // data_connection_failed
+        {
+            conn_open_status_ptr->open_status = RPC_LOC_SERVER_OPEN_FAIL;
+            loc_eng_data.data_connection_failed = FALSE;
+        }
+        // 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_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)
+{
+    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 GPS lock
+    loc_eng_set_gps_lock(RPC_LOC_LOCK_NONE);
+
+    while (loc_eng_data.deferred_action_thread_need_exit == FALSE)
+    {
+        // Wait until we are signalled to do a deferred action, or exit
+        pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+        pthread_cond_wait(&loc_eng_data.deferred_action_cond,
+                            &loc_eng_data.deferred_action_mutex);
+
+        pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+
+        if (loc_eng_data.deferred_action_thread_need_exit == TRUE)
+        {
+            break;
+        }
+
+        pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+
+        // send_delete_aiding_data must be done when GPS engine is off
+        if ((loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON) &&
+            (loc_eng_data.aiding_data_for_deletion != 0))
+        {
+            loc_eng_delete_aiding_data_deferred_action ();
+            loc_eng_data.aiding_data_for_deletion = 0;
+        }
+
+        if (loc_eng_data.data_connection_succeeded ||
+            loc_eng_data.data_connection_closed ||
+            loc_eng_data.data_connection_failed)
+        {
+            loc_eng_process_atl_deferred_action ();
+        }
+
+        if (loc_eng_data.agps_status != 0 && loc_eng_data.agps_status_cb) {
+            AGpsStatus status;
+            status.type = AGPS_TYPE_SUPL;
+            status.status = loc_eng_data.agps_status;
+            loc_eng_data.agps_status_cb(&status);
+            loc_eng_data.agps_status = 0;
+        }
+
+        pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+    }
+
+    LOGD("loc_eng_process_deferred_action thread exiting\n");
+    return NULL;
+}
diff --git a/loc_api/libloc_api/loc_eng.h b/loc_api/libloc_api/loc_eng.h
new file mode 100755
index 0000000..bb8fe9d
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng.h
@@ -0,0 +1,100 @@
+/******************************************************************************
+  @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_legacy/gps_ni.h>
+
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+
+// 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;
+    int                            agps_status;
+
+    loc_eng_xtra_data_s_type       xtra_module_data;
+
+    loc_eng_ioctl_data_s_type      ioctl_data;
+
+    boolean                        data_connection_succeeded;
+    boolean                        data_connection_closed;
+    boolean                        data_connection_failed;
+    // 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;
+    // Signal deferred action thread to exit
+    boolean                        deferred_action_thread_need_exit;
+    // 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;
+} 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/loc_eng_ioctl.cpp b/loc_api/libloc_api/loc_eng_ioctl.cpp
new file mode 100755
index 0000000..ff9d481
--- /dev/null
+++ b/loc_api/libloc_api/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_legacy/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/loc_eng_ioctl.h b/loc_api/libloc_api/loc_eng_ioctl.h
new file mode 100755
index 0000000..4090a4d
--- /dev/null
+++ b/loc_api/libloc_api/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/loc_eng_ni.cpp b/loc_api/libloc_api/loc_eng_ni.cpp
new file mode 100755
index 0000000..d923855
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_ni.cpp
@@ -0,0 +1,616 @@
+/******************************************************************************
+  @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 <hardware_legacy/gps.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 =
+{
+    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;
+    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,
+                        umts_cp_req->notification_text.notification_text_val,
+                        umts_cp_req->notification_length);
+
+                // Stores requestor ID
+                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);
+
+                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,
+                            supl_req->client_name.client_name_string.client_name_string_val,   /* buffer */
+                            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,
+                            supl_req->requestor_id.requestor_id_string.requestor_id_string_val,  /* buffer */
+                            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 *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) */
+
+    pthread_exit(NULL);
+    return NULL;
+}
+
+/*===========================================================================
+
+FUNCTION loc_ni_thread_start
+
+===========================================================================*/
+static int loc_ni_thread_start(void)
+{
+    int rc = 0;
+
+    rc = pthread_create(&loc_eng_ni_data.loc_ni_thread, NULL, loc_ni_thread_proc, NULL);
+
+    if (rc)
+    {
+        LOGE("Loc NI thread is not created.\n");
+        return -1;
+    }
+
+    return 0;
+}
+
+/*===========================================================================
+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);
+        loc_ni_thread_start();
+        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/loc_eng_ni.h b/loc_api/libloc_api/loc_eng_ni.h
new file mode 100755
index 0000000..b975b94
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_ni.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+  @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_legacy/gps_ni.h>
+
+#define LOC_NI_NO_RESPONSE_TIME            20                      /* secs */
+
+extern const GpsNiInterface sLocEngNiInterface;
+
+typedef struct {
+    pthread_t               loc_ni_thread;            /* NI thread */
+    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/loc_eng_xtra.cpp b/loc_api/libloc_api/loc_eng_xtra.cpp
new file mode 100755
index 0000000..a321653
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_xtra.cpp
@@ -0,0 +1,184 @@
+/******************************************************************************
+  @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 <hardware_legacy/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(...) {}
+
+#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 =
+{
+    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/loc_eng_xtra.h b/loc_api/libloc_api/loc_eng_xtra.h
new file mode 100755
index 0000000..839fc06
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+  @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
+
+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