diff options
Diffstat (limited to 'loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue')
-rw-r--r-- | loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h | 20 | ||||
-rw-r--r-- | loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp | 64 |
2 files changed, 76 insertions, 8 deletions
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h index 1b4f3f7..aafec63 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011,2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -115,11 +115,25 @@ public: atlCloseStatus(int handle, int is_succ); virtual enum loc_api_adapter_err setSUPLVersion(uint32_t version); - virtual void setInSession(bool inSession); + + /*Values for lock + 1 = Do not lock any position sessions + 2 = Lock MI position sessions + 3 = Lock MT position sessions + 4 = Lock all position sessions + */ + virtual int setGpsLock(unsigned int lock); + /* + Returns + Current value of GPS Lock on success + -1 on failure + */ + virtual int getGpsLock(void); }; extern "C" LocApiBase* getLocApi(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask); + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase *context); #endif //LOC_API_RPC_H diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp index 428d5a2..e142292 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -134,8 +134,9 @@ const rpc_loc_event_mask_type LocApiRpc::locBits[] = // constructor LocApiRpc::LocApiRpc(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask) : - LocApiBase(msgTask, exMask), + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase* context) : + LocApiBase(msgTask, exMask, context), client_handle(RPC_LOC_CLIENT_HANDLE_INVALID), dataEnableLastSet(-1) { @@ -1388,6 +1389,59 @@ GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding) } LocApiBase* getLocApi(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask) { - return new LocApiRpc(msgTask, exMask); + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase *context) { + return new LocApiRpc(msgTask, exMask, context); +} + +/*Values for lock + 1 = Do not lock any position sessions + 2 = Lock MI position sessions + 3 = Lock MT position sessions + 4 = Lock all position sessions +*/ +int LocApiRpc::setGpsLock(unsigned int lock) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + boolean ret_val; + LOC_LOGD("%s:%d]: lock: %d\n", __func__, __LINE__, lock); + ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = (rpc_loc_lock_e_type)lock; + ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK; + ret_val = loc_eng_ioctl (loc_eng_data.client_handle, + RPC_LOC_IOCTL_SET_ENGINE_LOCK, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/); + + LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val); + return (ret_val == TRUE ? 0 : -1); +} + +/* + Returns + Current value of GPS lock on success + -1 on failure +*/ +int LocApiRpc :: getGpsLock() +{ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_ioctl_callback_s_type callback_payload; + boolean ret_val; + int ret=0; + LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__); + ret_val = loc_eng_ioctl (loc_eng_data.client_handle, + RPC_LOC_IOCTL_GET_ENGINE_LOCK, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + &callback_payload); + if(ret_val == TRUE) { + ret = (int)callback_payload.data.engine_lock; + LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret); + } + else { + LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__); + ret = -1; + } + LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__); + return ret; } |