diff options
author | Dante Russo <drusso@codeaurora.org> | 2014-06-27 13:14:39 -0700 |
---|---|---|
committer | Vineeta Srivastava <vsrivastava@google.com> | 2014-07-08 16:46:17 -0700 |
commit | 8c61f8c1f1572ab769912264af3f31feb041fe79 (patch) | |
tree | ba884b1be1972a097332eca198dc083ba786dd8d /loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp | |
parent | 4fe12bb6925e1372f441ec5a79c7c8f316ff06bd (diff) | |
download | gps-8c61f8c1f1572ab769912264af3f31feb041fe79.tar.gz |
Merge branch 'KK.04.04.02.010.399' into l-pdk
Change-Id: I2452a378d4a4697cec2b023a0e9a9bf3e5f14924
Diffstat (limited to 'loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp')
-rw-r--r-- | loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp | 64 |
1 files changed, 59 insertions, 5 deletions
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; } |