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

Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood 2010-01-21 23:49:31 -05:00
parent ffaff8a84a
commit dd710e32d5
31 changed files with 8088 additions and 0 deletions

9
loc_api/Android.mk Executable file
View file

@ -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)

13
loc_api/NOTICE Normal file
View file

@ -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.

View file

@ -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

View file

@ -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)))

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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));
}

View file

@ -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;

File diff suppressed because it is too large Load diff

View file

@ -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 */

View file

@ -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;
}

View file

@ -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*/

View file

@ -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 */

View file

@ -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 */

File diff suppressed because it is too large Load diff

View file

@ -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 */

View file

@ -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 */

View file

@ -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 */

View file

@ -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;
}

View file

@ -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;
}

45
loc_api/libloc_api/Android.mk Executable file
View file

@ -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

1380
loc_api/libloc_api/loc_eng.cpp Executable file

File diff suppressed because it is too large Load diff

100
loc_api/libloc_api/loc_eng.h Executable file
View file

@ -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

View file

@ -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;
}

View file

@ -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

616
loc_api/libloc_api/loc_eng_ni.cpp Executable file
View file

@ -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);
}
}

56
loc_api/libloc_api/loc_eng_ni.h Executable file
View file

@ -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 */

View file

@ -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;
}

View file

@ -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