loc_api: Update to LA.BR.1.2.6_rb1.14

Change-Id: I210d349b26bb0f440220890117cefd00155905d5
cm-14.0
Michael Bestas 10 years ago committed by Ethan Chen
parent ce2dbe6535
commit c7e06efd8f

@ -13,13 +13,11 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
libqmi_cci \
libqmi_csi \
libqmi_common_so \
libgps.utils \
libdsi_netctrl \
libqmiservices
LOCAL_SRC_FILES += \
ds_client.c

@ -1,4 +1,4 @@
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013, 2015, 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
@ -48,6 +48,18 @@
#include<sys/time.h>
/**
* @file
* @brief DS client API declaration.
*
* @ingroup loc_ds_api
*/
/**
* @addtogroup loc_ds_api DS client support for location
* @{
*/
//Timeout to wait for wds service notification from qmi
#define DS_CLIENT_SERVICE_TIMEOUT (4000)
//Max timeout for the service to come up
@ -70,13 +82,7 @@ typedef union
wds_get_profile_settings_resp_msg_v01 *p_get_profile_setting_resp;
}ds_client_resp_union_type;
struct event_strings_s
{
char * str;
dsi_net_evt_t evt;
};
struct event_strings_s event_string_tbl[DSI_EVT_MAX] =
static const loc_name_val_s_type event_string_tbl[DSI_EVT_MAX] =
{
NAME_VAL(DSI_EVT_INVALID),
NAME_VAL(DSI_EVT_NET_IS_CONN),
@ -89,8 +95,8 @@ struct event_strings_s event_string_tbl[DSI_EVT_MAX] =
typedef struct
{
ds_client_event_ind_cb_type event_cb;
void *caller_cookie;
ds_client_event_ind_cb_type *event_cb;
void *caller_cookie;
}ds_caller_data;
typedef struct {
@ -100,8 +106,13 @@ typedef struct {
ds_caller_data caller_data;
} ds_client_session_data;
void net_ev_cb(dsi_hndl_t handle, void* user_data,
dsi_net_evt_t evt, dsi_evt_payload_t *payload_ptr)
static void net_ev_cb
(
dsi_hndl_t handle,
void* user_data,
dsi_net_evt_t evt,
dsi_evt_payload_t *payload_ptr
)
{
int i;
(void)handle;
@ -112,12 +123,10 @@ void net_ev_cb(dsi_hndl_t handle, void* user_data,
LOC_LOGD("%s:%d]: Enter. Callback data: %p\n", __func__, __LINE__, callback_data);
if(evt > DSI_EVT_INVALID && evt < DSI_EVT_MAX)
{
for(i=0;i<DSI_EVT_MAX;i++)
{
if(event_string_tbl[i].evt == evt)
LOC_LOGE("%s:%d]: Callback received: %s",
__func__, __LINE__, event_string_tbl[i].str);
}
LOC_LOGE("%s:%d]: Callback received: %s",
__func__, __LINE__,
loc_get_name_from_val(event_string_tbl, DSI_EVT_MAX, evt));
switch(evt) {
case DSI_EVT_NET_IS_CONN:
case DSI_EVT_WDS_CONNECTED:
@ -440,11 +449,26 @@ err:
return ret;
}
/*
Starts data call using the handle and the profile index
*/
ds_client_status_enum_type
ds_client_start_call(dsClientHandleType client_handle, int profile_index, int pdp_type)
/**
* @brief Starts a data call using the profile number provided
*
* The function uses parameters provided from @a ds_client_open_call_type
* call result.
*
* @param[in] client_handle Client handle
* @param[in] profile_index Profile index
* @param[in] pdp_type PDP type
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
static ds_client_status_enum_type ds_client_start_call
(
dsClientHandleType client_handle,
int profile_index,
int pdp_type
)
{
ds_client_status_enum_type ret = E_DS_CLIENT_FAILURE_GENERAL;
dsi_call_param_value_t param_info;
@ -488,19 +512,39 @@ err:
}
/*Function to open an emergency call. Does the following things:
- Obtains a handle to the WDS service
- Obtains a list of profiles configured in the modem
- Queries each profile and obtains settings to check if emergency calls
are supported
- Returns the profile index that supports emergency calls
- Returns handle to dsi_netctrl*/
ds_client_status_enum_type
ds_client_open_call(dsClientHandleType *client_handle,
ds_client_cb_data *callback,
void *caller_cookie,
int *profile_index,
int *pdp_type)
/**
* @brief Prepares for call.
*
* Obtains a handle to the dsi_netctrl layer and looks up the profile
* to make the call. As of now. It only searches for profiles that
* support emergency calls.
*
* Function to open an emergency call. Does the following things:
* - Obtains a handle to the WDS service
* - Obtains a list of profiles configured in the modem
* - Queries each profile and obtains settings to check if emergency calls
* are supported
* - Returns the profile index that supports emergency calls
* - Returns handle to dsi_netctrl
*
* @param[out] client_handle Client handle to initialize.
* @param[in] callback Pointer to callback function table.
* @param[in] cookie Client's cookie for using with callback calls.
* @param[out] profile_index Pointer to profile index number.
* @param[out] pdp_type Pointer to PDP type.
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success. Output parameters are initialized.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
static ds_client_status_enum_type ds_client_open_call
(
dsClientHandleType *client_handle,
const ds_client_cb_data *callback,
void *cookie,
int *profile_index,
int *pdp_type
)
{
ds_client_status_enum_type ret = E_DS_CLIENT_FAILURE_GENERAL;
ds_client_resp_union_type profile_list_resp_msg;
@ -653,7 +697,7 @@ ds_client_open_call(dsClientHandleType *client_handle,
}
(*ds_global_data)->caller_data.event_cb = callback->event_cb;
(*ds_global_data)->caller_data.caller_cookie = caller_cookie;
(*ds_global_data)->caller_data.caller_cookie = cookie;
dsi_handle = dsi_get_data_srvc_hndl(net_ev_cb, &(*ds_global_data)->caller_data);
if(dsi_handle == NULL) {
LOC_LOGE("%s:%d]: Could not get data handle. Retry Later\n",
@ -678,7 +722,16 @@ err:
return ret;
}
ds_client_status_enum_type ds_client_stop_call(dsClientHandleType client_handle)
/**
* @brief Stops a data call associated with the handle
*
* @param[in] client_handle Client handle
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
static ds_client_status_enum_type ds_client_stop_call(dsClientHandleType client_handle)
{
ds_client_status_enum_type ret = E_DS_CLIENT_SUCCESS;
ds_client_session_data *p_ds_global_data = (ds_client_session_data *)client_handle;
@ -705,10 +758,14 @@ err:
return ret;
}
/*
Stops data call associated with the data handle
*/
void ds_client_close_call(dsClientHandleType *client_handle)
/**
* @brief Releases the handle used for making data calls
*
* @param[in,out] client_handle Client handle pointer
*
* @return None
*/
static void ds_client_close_call(dsClientHandleType *client_handle)
{
ds_client_session_data **ds_global_data = (ds_client_session_data **)client_handle;
LOC_LOGD("%s:%d]:Enter\n", __func__, __LINE__);
@ -726,15 +783,53 @@ err:
return;
}
int ds_client_init()
/**
* @brief Initialize the DS client service
*
* This function is to be called as a first step by each process that
* needs to use data services. This call internally calls dsi_init()
* and prepares the module for making data calls.
* Needs to be called once for every process
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
static ds_client_status_enum_type ds_client_init()
{
int ret = 0;
LOC_LOGD("%s:%d]:Enter\n", __func__, __LINE__);
if(DSI_SUCCESS != dsi_init(DSI_MODE_GENERAL))
{
LOC_LOGE("%s:%d]:dsi_init failed\n", __func__, __LINE__);
ret = -1;
}
LOC_LOGD("%s:%d]:Exit\n", __func__, __LINE__);
return ret;
ds_client_status_enum_type ret = E_DS_CLIENT_SUCCESS;
LOC_LOGD("%s:%d]:Enter", __func__, __LINE__);
if(DSI_SUCCESS != dsi_init(DSI_MODE_GENERAL))
{
LOC_LOGE("%s:%d]:dsi_init failed", __func__, __LINE__);
ret = E_DS_CLIENT_FAILURE_GENERAL;
}
LOC_LOGD("%s:%d]:Exit", __func__, __LINE__);
return ret;
}
/**
* @brief DS client function interface table definition.
*/
static const ds_client_iface_type iface =
{
.pfn_init = ds_client_init,
.pfn_open_call = ds_client_open_call,
.pfn_start_call = ds_client_start_call,
.pfn_stop_call = ds_client_stop_call,
.pfn_close_call = ds_client_close_call
};
/**
* @brief Function for accessing DS client functional interface
*
* @return Pointer to interface structure.
*/
const ds_client_iface_type *ds_client_get_interface()
{
return &iface;
}
/**
* @}
*/

@ -1,4 +1,4 @@
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013, 2015 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
@ -33,6 +33,29 @@
extern "C" {
#endif
/**
* @file
* @brief DS client API declaration.
*
* @ingroup loc_ds_api
*/
/**
* @addtogroup loc_ds_api DS client support for location
* @{
*/
/**
* @brief Function name for DS client interface query.
*
* @sa ds_client_get_interface
*/
#define DS_CLIENT_GET_INTERFACE_FN "ds_client_get_interface"
/**
* @brief Library name for loading DS client
*/
#define DS_CLIENT_LIB_NAME "libloc_ds_api.so"
typedef void* dsClientHandleType;
typedef enum
@ -87,58 +110,166 @@ typedef enum
E_DS_CLIENT_DATA_CALL_DISCONNECTED = 16,
E_DS_CLIENT_RETRY_LATER = 17
}ds_client_status_enum_type;
} ds_client_status_enum_type;
typedef enum {
DATA_CALL_NONE = 0,
DATA_CALL_OPEN,
DATA_CALL_CLOSE
}data_call_request_enum_type;
/**
* @brief Callback function interface for handling DS service indications
*
* @param[in] result Operation result (error code).
* @param[in] cookie Client cookie provided when call is opened.
*
* @sa ds_client_cb_data
*/
typedef void ds_client_event_ind_cb_type
(
ds_client_status_enum_type result,
void* loc_adapter_cookie
);
typedef void (*ds_client_event_ind_cb_type)(ds_client_status_enum_type result,
void* loc_adapter_cookie);
/**
* @brief Client callback function table
*
* This structure contains callback functions provided by client of DS client
* API for delivering event notifications.
*
* @sa ds_client_open_call_type
*/
typedef struct {
ds_client_event_ind_cb_type event_cb;
}ds_client_cb_data;
/*
This function is to be called as a first step by each process that
needs to use data services. This call internally calls dsi_init()
and prepares the module for making data calls.
Needs to be called once for every process
*/
int ds_client_init();
/*
Obtains a handle to the dsi_netctrl layer and looks up the profile
to make the call. As of now. It only searches for profiles that
support emergency calls
*/
ds_client_status_enum_type ds_client_open_call(dsClientHandleType *client_handle,
ds_client_cb_data *callback,
void *loc_adapter_cookie,
int *profile_index,
int *pdp_type);
/*
Starts a data call using the profile number provided
*/
ds_client_status_enum_type ds_client_start_call(dsClientHandleType client_handle,
int profile_index,
int pdp_type);
/*
Stops a data call associated with the handle
*/
ds_client_status_enum_type ds_client_stop_call(dsClientHandleType client_handle);
/*
Releases the handle used for making data calls
*/
void ds_client_close_call(dsClientHandleType *client_handle);
ds_client_event_ind_cb_type *event_cb;
} ds_client_cb_data;
/**
* @brief Initialize the DS client service
*
* This function is to be called as a first step by each process that
* needs to use data services. This call internally calls dsi_init()
* and prepares the module for making data calls.
* Needs to be called once for every process
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
typedef ds_client_status_enum_type ds_client_init_type();
/**
* @brief Prepares for call.
*
* Obtains a handle to the dsi_netctrl layer and looks up the profile
* to make the call. As of now. It only searches for profiles that
* support emergency calls.
*
* Function to open an emergency call. Does the following things:
* - Obtains a handle to the WDS service
* - Obtains a list of profiles configured in the modem
* - Queries each profile and obtains settings to check if emergency calls
* are supported
* - Returns the profile index that supports emergency calls
* - Returns handle to dsi_netctrl
*
* @param[out] client_handle Client handle to initialize.
* @param[in] callback Pointer to callback function table.
* @param[in] cookie Client's cookie for using with callback calls.
* @param[out] profile_index Pointer to profile index number.
* @param[out] pdp_type Pointer to PDP type.
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success. Output parameters are initialized.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
typedef ds_client_status_enum_type ds_client_open_call_type
(
dsClientHandleType *client_handle,
const ds_client_cb_data *callback,
void *cookie,
int *profile_index,
int *pdp_type
);
/**
* @brief Starts a data call using the profile number provided
*
* The function uses parameters provided from @a ds_client_open_call_type
* call result.
*
* @param[in] client_handle Client handle
* @param[in] profile_index Profile index
* @param[in] pdp_type PDP type
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
typedef ds_client_status_enum_type ds_client_start_call_type
(
dsClientHandleType client_handle,
int profile_index,
int pdp_type
);
/**
* @brief Stops a data call associated with the handle
*
* @param[in] client_handle Client handle
*
* @return Operation result
* @retval E_DS_CLIENT_SUCCESS On success.
* @retval E_DS_CLIENT_FAILURE... On error.
*/
typedef ds_client_status_enum_type ds_client_stop_call_type
(
dsClientHandleType client_handle
);
/**
* @brief Releases the handle used for making data calls
*
* @param[in,out] client_handle Client handle pointer
*
* @return None
*/
typedef void ds_client_close_call_type
(
dsClientHandleType *client_handle
);
/**
* @brief DS client functional interface table
*
* This table contains all supported DS client operations. If the operation
* is not supported, the corresponding entry is NULL.
*
* @sa ds_client_get_interface
*/
typedef struct
{
ds_client_init_type *pfn_init;
ds_client_open_call_type *pfn_open_call;
ds_client_start_call_type *pfn_start_call;
ds_client_stop_call_type *pfn_stop_call;
ds_client_close_call_type *pfn_close_call;
} ds_client_iface_type;
/**
* @brief Function for accessing DS client functional interface
*
* @return Pointer to interface structure.
*/
typedef const ds_client_iface_type *ds_client_get_iface_fn();
/**
* @brief Function for accessing DS client functional interface
*
* @return Pointer to interface structure.
*/
ds_client_get_iface_fn ds_client_get_interface;
#ifdef __cplusplus
}
#endif
#endif
/**
* @}
*/
#endif /* _DS_CLIENT_H_ */

@ -19,11 +19,10 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
libqmi_cci \
libqmi_csi \
libqmi_common_so \
libloc_core \
libgps.utils \
libloc_ds_api
libdl
LOCAL_SRC_FILES = \
LocApiV02.cpp \

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2015, 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
@ -33,6 +33,7 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dlfcn.h>
#include <hardware/gps.h>
@ -166,7 +167,9 @@ LocApiV02 :: LocApiV02(const MsgTask* msgTask,
ContextBase* context):
LocApiBase(msgTask, exMask, context),
clientHandle(LOC_CLIENT_INVALID_HANDLE_VALUE),
dsClientHandle(NULL), mGnssMeasurementSupported(sup_unknown),
dsClientIface(NULL),
dsClientHandle(NULL),
mGnssMeasurementSupported(sup_unknown),
mQmiMask(0), mInSession(false), mEngineOn(false)
{
// initialize loc_sync_req interface
@ -278,7 +281,8 @@ LocApiV02 :: open(LOC_API_ADAPTER_EVENT_MASK_T mask)
loc_get_v02_client_status_name(status),
loc_get_v02_qmi_status_name(queryAonConfigInd.status));
} else {
LOC_LOGD("%s:%d]: Query AON config succeeded.\n", __func__, __LINE__);
LOC_LOGD("%s:%d]: Query AON config succeeded. aonCapability is %d.\n",
__func__, __LINE__, queryAonConfigInd.aonCapability);
if (queryAonConfigInd.aonCapability_valid) {
if (queryAonConfigInd.aonCapability |
QMI_LOC_MASK_AON_TIME_BASED_BATCHING_SUPPORTED_V02) {
@ -300,6 +304,13 @@ LocApiV02 :: open(LOC_API_ADAPTER_EVENT_MASK_T mask)
QMI_LOC_MASK_AON_DISTANCE_BASED_TRACKING_SUPPORTED_V02) {
LOC_LOGD("%s:%d]: DBT 2.0 is supported.\n", __func__, __LINE__);
}
if (queryAonConfigInd.aonCapability |
QMI_LOC_MASK_AON_UPDATE_TBF_SUPPORTED_V02) {
LOC_LOGD("%s:%d]: Updating tracking TBF on the fly is supported.\n",
__func__, __LINE__);
supportedMsgList |=
(1 << LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY);
}
} else {
LOC_LOGE("%s:%d]: AON capability is invalid.\n", __func__, __LINE__);
}
@ -1675,18 +1686,21 @@ locClientEventMaskType LocApiV02 :: convertMask(
if (mask & LOC_API_ADAPTER_REPORT_SPI)
eventMask |= QMI_LOC_EVENT_MASK_SET_SPI_STREAMING_REPORT_V02;
if (mask & LOC_API_ADAPTER_REPORT_NI_GEOFENCE)
if (mask & LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE)
eventMask |= QMI_LOC_EVENT_MASK_NI_GEOFENCE_NOTIFICATION_V02;
if (mask & LOC_API_ADAPTER_GEOFENCE_GEN_ALERT)
if (mask & LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT)
eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_GEN_ALERT_V02;
if (mask & LOC_API_ADAPTER_REPORT_GENFENCE_BREACH)
if (mask & LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH)
eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BREACH_NOTIFICATION_V02;
if (mask & LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT)
if (mask & LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT)
eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_BREACH_NOTIFICATION_V02;
if (mask & LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL)
eventMask |= QMI_LOC_EVENT_MASK_GEOFENCE_BATCH_DWELL_NOTIFICATION_V02;
if (mask & LOC_API_ADAPTER_PEDOMETER_CTRL)
eventMask |= QMI_LOC_EVENT_MASK_PEDOMETER_CONTROL_V02;
@ -2804,8 +2818,8 @@ void LocApiV02 :: errorCb(locClientHandleType handle,
static void ds_client_global_event_cb(ds_client_status_enum_type result,
void *loc_adapter_cookie)
{
LocApiV02 *locApiV02Instance =
(LocApiV02 *)loc_adapter_cookie;
LocApiV02 *locApiV02Instance = (LocApiV02 *)loc_adapter_cookie;
locApiV02Instance->ds_client_event_cb(result);
return;
}
@ -2823,30 +2837,95 @@ void LocApiV02::ds_client_event_cb(ds_client_status_enum_type result)
return;
}
ds_client_cb_data ds_client_cb = {
static const ds_client_cb_data ds_client_cb = {
ds_client_global_event_cb
};
int LocApiV02 :: initDataServiceClient()
{
int ret=0;
ret = ds_client_init();
if (NULL == dsLibraryHandle)
{
dsLibraryHandle = dlopen(DS_CLIENT_LIB_NAME, RTLD_NOW);
if (NULL == dsLibraryHandle)
{
const char * err = dlerror();
if (NULL == err)
{
err = "Unknown";
}
LOC_LOGE("%s:%d]: failed to load library %s; error=%s",
__func__, __LINE__,
DS_CLIENT_LIB_NAME,
err);
ret = 1;
}
if (NULL != dsLibraryHandle)
{
ds_client_get_iface_fn *getIface = NULL;
getIface = (ds_client_get_iface_fn*)dlsym(dsLibraryHandle,
DS_CLIENT_GET_INTERFACE_FN);
if (NULL != getIface)
{
dsClientIface = getIface();
}
else
{
const char * err = dlerror();
if (NULL == err)
{
err = "Unknown";
}
LOC_LOGE("%s:%d]: failed to find symbol %s; error=%s",
__func__, __LINE__,
DS_CLIENT_GET_INTERFACE_FN,
err);
}
}
}
if (NULL != dsClientIface && NULL != dsClientIface->pfn_init)
{
ds_client_status_enum_type dsret = dsClientIface->pfn_init();
if (dsret != E_DS_CLIENT_SUCCESS)
{
LOC_LOGE("%s:%d]: Error during client initialization %d",
__func__, __LINE__,
(int)dsret);
ret = 3;
}
}
else
{
ret = 2;
}
LOC_LOGD("%s:%d]: ret = %d\n", __func__, __LINE__,ret);
return ret;
}
int LocApiV02 :: openAndStartDataCall()
{
enum loc_api_adapter_err ret;
int profile_index;
int pdp_type;
ds_client_status_enum_type result = ds_client_open_call(&dsClientHandle,
&ds_client_cb,
(void *)this,
&profile_index,
&pdp_type);
if(result == E_DS_CLIENT_SUCCESS) {
result = ds_client_start_call(dsClientHandle, profile_index, pdp_type);
loc_api_adapter_err ret = LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
int profile_index = -1;
int pdp_type = -1;
ds_client_status_enum_type result = E_DS_CLIENT_FAILURE_NOT_INITIALIZED;
if (NULL != dsClientIface &&
NULL != dsClientIface->pfn_open_call &&
NULL != dsClientIface->pfn_start_call)
{
result = dsClientIface->pfn_open_call(&dsClientHandle,
&ds_client_cb,
(void *)this,
&profile_index,
&pdp_type);
}
if (E_DS_CLIENT_SUCCESS == result)
{
result = dsClientIface->pfn_start_call(dsClientHandle,
profile_index,
pdp_type);
if(result == E_DS_CLIENT_SUCCESS) {
LOC_LOGD("%s:%d]: Request to start Emergency call sent\n",
@ -2875,27 +2954,42 @@ int LocApiV02 :: openAndStartDataCall()
void LocApiV02 :: stopDataCall()
{
ds_client_status_enum_type ret =
ds_client_stop_call(dsClientHandle);
ds_client_status_enum_type ret = E_DS_CLIENT_FAILURE_NOT_INITIALIZED;
if (NULL != dsClientIface &&
NULL != dsClientIface->pfn_stop_call)
{
ret = dsClientIface->pfn_stop_call(dsClientHandle);
}
if (ret == E_DS_CLIENT_SUCCESS) {
LOC_LOGD("%s:%d]: Request to Close SUPL ES call sent\n", __func__, __LINE__);
LOC_LOGD("%s:%d]: Request to Close SUPL ES call sent",
__func__, __LINE__);
}
else {
if (ret == E_DS_CLIENT_FAILURE_INVALID_HANDLE) {
LOC_LOGE("%s:%d]: Conn handle not found for SUPL ES",
__func__, __LINE__);
}
LOC_LOGE("%s:%d]: Could not close SUPL ES call. Ret: %d\n"
,__func__, __LINE__, ret);
LOC_LOGE("%s:%d]: Could not close SUPL ES call. Ret: %d",
__func__, __LINE__, ret);
}
return;
}
void LocApiV02 :: closeDataCall()
{
ds_client_close_call(&dsClientHandle);
LOC_LOGD("%s:%d]: Release data client handle\n", __func__, __LINE__);
return;
int ret = 1;
if (NULL != dsClientIface &&
NULL != dsClientIface->pfn_close_call)
{
dsClientIface->pfn_close_call(&dsClientHandle);
ret = 0;
}
LOC_LOGD("%s:%d]: Release data client handle; ret=%d",
__func__, __LINE__, ret);
}
enum loc_api_adapter_err LocApiV02 ::

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2015, 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
@ -31,7 +31,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "ds_client.h"
#include <ds_client.h>
#include <LocApiBase.h>
#include <loc_api_v02_client.h>
@ -53,7 +53,11 @@ protected:
locClientHandleType clientHandle;
private:
/*ds client handle*/
/* ds client library handle */
void *dsLibraryHandle;
/* ds client interface */
const ds_client_iface_type *dsClientIface;
/* ds client handle */
dsClientHandleType dsClientHandle;
enum supported_status mGnssMeasurementSupported;
locClientEventMaskType mQmiMask;

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2012, 2015, 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
@ -197,7 +197,7 @@ void loc_sync_process_ind(
if(true == locClientGetSizeByRespIndId(ind_id, &payload_size) &&
NULL != slot->recv_ind_payload_ptr && NULL != ind_payload_ptr)
{
LOC_LOGV("%s:%d]: copying ind payload size = %u \n",
LOC_LOGV("%s:%d]: copying ind payload size = %zu \n",
__func__, __LINE__, payload_size);
memcpy(slot->recv_ind_payload_ptr, ind_payload_ptr, payload_size);

@ -31,7 +31,7 @@
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include "qmi_client.h"
#include "qmi_idl_lib.h"
@ -95,7 +95,7 @@ typedef struct
}locClientEventIndTableStructT;
static locClientEventIndTableStructT locClientEventIndTable[]= {
static const locClientEventIndTableStructT locClientEventIndTable[]= {
// position report ind
{ QMI_LOC_EVENT_POSITION_REPORT_IND_V02,
@ -253,7 +253,20 @@ static locClientEventIndTableStructT locClientEventIndTable[]= {
// Batching Status event
{ QMI_LOC_EVENT_BATCHING_STATUS_IND_V02,
sizeof(qmiLocEventBatchingStatusIndMsgT_v02),
QMI_LOC_EVENT_MASK_BATCHING_STATUS_V02}
QMI_LOC_EVENT_MASK_BATCHING_STATUS_V02},
// TDP download
{ QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02,
sizeof(qmiLocEventGdtDownloadBeginReqIndMsgT_v02),
0},
{ QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02,
sizeof(qmiLocEventGdtReceiveDoneIndMsgT_v02),
0},
{ QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02,
sizeof(qmiLocEventGdtDownloadEndReqIndMsgT_v02),
0}
};
/* table to relate the respInd Id with its size */
@ -263,7 +276,7 @@ typedef struct
size_t respIndSize;
}locClientRespIndTableStructT;
static locClientRespIndTableStructT locClientRespIndTable[]= {
static const locClientRespIndTableStructT locClientRespIndTable[]= {
// get service revision ind
{ QMI_LOC_GET_SERVICE_REVISION_IND_V02,
@ -581,7 +594,25 @@ static locClientRespIndTableStructT locClientRespIndTable[]= {
sizeof(qmiLocInjectTimeZoneInfoIndMsgT_v02)},
{ QMI_LOC_QUERY_AON_CONFIG_IND_V02,
sizeof(qmiLocQueryAonConfigIndMsgT_v02)}
sizeof(qmiLocQueryAonConfigIndMsgT_v02)},
// for GTP
{ QMI_LOC_GTP_AP_STATUS_IND_V02,
sizeof(qmiLocGtpApStatusIndMsgT_v02) },
// for GDT
{ QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02,
sizeof(qmiLocGdtDownloadBeginStatusIndMsgT_v02) },
{ QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02,
sizeof(qmiLocGdtDownloadReadyStatusIndMsgT_v02) },
{ QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02,
sizeof(qmiLocGdtReceiveDoneStatusIndMsgT_v02) },
{ QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02,
sizeof(qmiLocGdtDownloadEndStatusIndMsgT_v02) }
};
@ -663,7 +694,7 @@ static bool locClientGetSizeAndTypeByIndId (uint32_t indId, size_t *pIndSize,
QMI_LOC service.
*/
static void checkQmiMsgsSupported(
uint32_t* reqIdArray,
const uint32_t* reqIdArray,
int reqIdArrayLength,
qmiLocGetSupportMsgT_v02 *pResponse,
uint64_t* supportedMsg)
@ -1448,6 +1479,36 @@ static bool validateRequest(
break;
}
case QMI_LOC_GTP_AP_STATUS_REQ_V02:
{
*pOutLen = sizeof(qmiLocGtpApStatusReqMsgT_v02);
break;
}
case QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02:
{
*pOutLen = sizeof(qmiLocGdtDownloadBeginStatusReqMsgT_v02);
break;
}
case QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02:
{
*pOutLen = sizeof(qmiLocGdtDownloadReadyStatusReqMsgT_v02);
break;
}
case QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02:
{
*pOutLen = sizeof(qmiLocGdtReceiveDoneStatusReqMsgT_v02);
break;
}
case QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02:
{
*pOutLen = sizeof(qmiLocGdtDownloadEndStatusReqMsgT_v02);
break;
}
// ALL requests with no payload
case QMI_LOC_GET_SERVICE_REVISION_REQ_V02:
case QMI_LOC_GET_FIX_CRITERIA_REQ_V02:
@ -2034,9 +2095,16 @@ locClientStatusEnumType locClientSupportMsgCheck(
*/
static uint64_t supportedMsgChecked = 0;
// Validate input arguments
if(msgArray == NULL || supportedMsg == NULL) {
LOC_LOGE("%s:%d]: Input argument/s NULL", __func__, __LINE__);
return eLOC_CLIENT_FAILURE_INVALID_PARAMETER;
}
if (isCheckedAlready) {
// already checked modem
LOC_LOGV("%s:%d]: Already checked. The supportedMsgChecked is %lld\n",
LOC_LOGV("%s:%d]: Already checked. The supportedMsgChecked is %" PRId64 "\n",
__func__, __LINE__, supportedMsgChecked);
*supportedMsg = supportedMsgChecked;
return eLOC_CLIENT_SUCCESS;
@ -2096,7 +2164,7 @@ locClientStatusEnumType locClientSupportMsgCheck(
// check every message listed in msgArray supported by modem or not
checkQmiMsgsSupported(msgArray, msgArrayLength, &resp, &supportedMsgChecked);
LOC_LOGV("%s:%d]: supportedMsgChecked is %lld\n",
LOC_LOGV("%s:%d]: supportedMsgChecked is %" PRId64 "\n",
__func__, __LINE__, supportedMsgChecked);
*supportedMsg = supportedMsgChecked;
isCheckedAlready = true;
@ -2120,6 +2188,14 @@ locClientStatusEnumType locClientSupportMsgCheck(
bool locClientGetSizeByRespIndId(uint32_t respIndId, size_t *pRespIndSize)
{
size_t idx = 0, respIndTableSize = 0;
// Validate input arguments
if(pRespIndSize == NULL)
{
LOC_LOGE("%s:%d]: size argument NULL !");
return false;
}
respIndTableSize = (sizeof(locClientRespIndTable)/sizeof(locClientRespIndTableStructT));
for(idx=0; idx<respIndTableSize; idx++ )
{
@ -2150,6 +2226,13 @@ bool locClientGetSizeByEventIndId(uint32_t eventIndId, size_t *pEventIndSize)
{
size_t idx = 0, eventIndTableSize = 0;
// Validate input arguments
if(pEventIndSize == NULL)
{
LOC_LOGE("%s:%d]: size argument NULL !");
return false;
}
// look in the event table
eventIndTableSize =
(sizeof(locClientEventIndTable)/sizeof(locClientEventIndTableStructT));

@ -696,6 +696,21 @@ typedef union
const qmiLocQueryAonConfigReqMsgT_v02 *pQueryAonConfigReq;
/*QMI_LOC_QUERY_AON_CONFIG_REQ_V02*/
const qmiLocGtpApStatusReqMsgT_v02* pGtpApStatusReq;
/* QMI_LOC_GTP_AP_STATUS_REQ_V02 */
const qmiLocGdtDownloadBeginStatusReqMsgT_v02* pGdtDownloadBeginStatusReq;
/* QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02 */
const qmiLocGdtDownloadReadyStatusReqMsgT_v02* pGdtDownloadReadyStatusReq;
/* QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02 */
const qmiLocGdtReceiveDoneStatusReqMsgT_v02* pGdtReceiveDoneStatusReq;
/* QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02 */
const qmiLocGdtDownloadEndStatusReqMsgT_v02* pGdtDownloadEndStatusReq;
/* QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02*/
}locClientReqUnionType;
@ -935,6 +950,22 @@ typedef union
/**< Sent by the engine to notify the control point of the batching status.
The eventIndId field in the event indication callback is set to
QMI_LOC_EVENT_BATCHING_STATUS_IND_V02. */
const qmiLocEventGdtDownloadBeginReqIndMsgT_v02 *pGdtDownloadBeginReqEvent;
/**< Sent by the engine to notify the client about a GDT download
begin event.
QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02. */
const qmiLocEventGdtReceiveDoneIndMsgT_v02 *pGdtReceiveDoneEvent;
/**< Sent by the engine to notify the client about a GDT download
receive done event.
QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02. */
const qmiLocEventGdtDownloadEndReqIndMsgT_v02 *pGdtDownloadEndReqEvent;
/**< Sent by the engine to notify the client about a GDT download
end event.
QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02. */
}locClientEventIndUnionType;
@ -1367,6 +1398,21 @@ typedef union
const qmiLocQueryAonConfigIndMsgT_v02 *pQueryAonConfigInd;
/*QMI_LOC_QUERY_AON_CONFIG_IND_V02*/
const qmiLocGtpApStatusIndMsgT_v02 *pGtpApStatusInd;
/*QMI_LOC_GTP_AP_STATUS_IND_V02*/
const qmiLocGdtDownloadBeginStatusIndMsgT_v02 *pGdtDownloadBeginStatusInd;
/*QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02*/
const qmiLocGdtDownloadReadyStatusIndMsgT_v02 *pGdtDownloadReadyStatusInd;
/*QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02*/
const qmiLocGdtReceiveDoneStatusIndMsgT_v02 *pGdtReceiveDoneStatusInd;
/*QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02*/
const qmiLocGdtDownloadEndStatusIndMsgT_v02 *pGdtDownloadEndStatusInd;
/*QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02*/
}locClientRespIndUnionType;
/** @} */ /* end_addtogroup data_types */

@ -29,7 +29,7 @@
#include <loc_api_v02_log.h>
#include <location_service_v02.h>
static loc_name_val_s_type loc_v02_event_name[] =
static const loc_name_val_s_type loc_v02_event_name[] =
{
NAME_VAL(QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02),
NAME_VAL(QMI_LOC_INFORM_CLIENT_REVISION_RESP_V02),
@ -320,16 +320,34 @@ static loc_name_val_s_type loc_v02_event_name[] =
NAME_VAL(QMI_LOC_EVENT_BATCHING_STATUS_IND_V02),
NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_RESP_V02),
NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_IND_V02)
NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_IND_V02),
NAME_VAL(QMI_LOC_GTP_AP_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GTP_AP_STATUS_RESP_V02),
NAME_VAL(QMI_LOC_GTP_AP_STATUS_IND_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_RESP_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_IND_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_READY_STATUS_RESP_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_READY_STATUS_IND_V02),
NAME_VAL(QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_RECEIVE_DONE_STATUS_RESP_V02),
NAME_VAL(QMI_LOC_GDT_RECEIVE_DONE_STATUS_IND_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_END_STATUS_RESP_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_END_STATUS_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02)
};
static int loc_v02_event_num = sizeof(loc_v02_event_name) / sizeof(loc_name_val_s_type);
static const int loc_v02_event_num = sizeof(loc_v02_event_name) / sizeof(loc_name_val_s_type);
const char* loc_get_v02_event_name(uint32_t event)
{
return loc_get_name_from_val(loc_v02_event_name, loc_v02_event_num, (long) event);
}
static loc_name_val_s_type loc_v02_client_status_name[] =
static const loc_name_val_s_type loc_v02_client_status_name[] =
{
NAME_VAL(eLOC_CLIENT_SUCCESS),
NAME_VAL(eLOC_CLIENT_FAILURE_GENERAL),
@ -346,7 +364,7 @@ static loc_name_val_s_type loc_v02_client_status_name[] =
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_INITIALIZED),
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY),
};
static int loc_v02_client_status_num = sizeof(loc_v02_client_status_name) / sizeof(loc_name_val_s_type);
static const int loc_v02_client_status_num = sizeof(loc_v02_client_status_name) / sizeof(loc_name_val_s_type);
const char* loc_get_v02_client_status_name(locClientStatusEnumType status)
{
@ -354,7 +372,7 @@ const char* loc_get_v02_client_status_name(locClientStatusEnumType status)
}
static loc_name_val_s_type loc_v02_qmi_status_name[] =
static const loc_name_val_s_type loc_v02_qmi_status_name[] =
{
NAME_VAL(eQMI_LOC_SUCCESS_V02),
NAME_VAL(eQMI_LOC_GENERAL_FAILURE_V02),
@ -366,7 +384,7 @@ static loc_name_val_s_type loc_v02_qmi_status_name[] =
NAME_VAL(eQMI_LOC_CONFIG_NOT_SUPPORTED_V02),
NAME_VAL(eQMI_LOC_INSUFFICIENT_MEMORY_V02),
};
static int loc_v02_qmi_status_num = sizeof(loc_v02_qmi_status_name) / sizeof(loc_name_val_s_type);
static const int loc_v02_qmi_status_num = sizeof(loc_v02_qmi_status_name) / sizeof(loc_name_val_s_type);
const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status)
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save