From cff2b2b29bd9083f0b92e628b225a72a7ef52332 Mon Sep 17 00:00:00 2001 From: Sen-Der Huang Date: Thu, 26 Apr 2012 10:34:24 -0700 Subject: Added reconnect and NV support; bug fixes: service mask setting for HDP during discovery and TX/RX ADPU size for echo test Change-Id: Ic44fe0a852036c3e973b79f4ef6362a59c76a1c0 bta/dm/bta_dm_api.c btif/co/bta_hl_co.c btif/include/btif_hl.h btif/include/btif_storage.h btif/src/btif_hl.c btif/src/btif_storage.c stack/sdp/sdp_api.c udrv/include/unv.h udrv/ulinux/unv_linux.c --- btif/include/btif_hl.h | 122 ++++++++++++++++++++++++++++++++++---------- btif/include/btif_storage.h | 69 ++++++++++++++++++++++++- 2 files changed, 163 insertions(+), 28 deletions(-) mode change 100644 => 100755 btif/include/btif_hl.h (limited to 'btif/include') diff --git a/btif/include/btif_hl.h b/btif/include/btif_hl.h old mode 100644 new mode 100755 index 2328609..cac6eb2 --- a/btif/include/btif_hl.h +++ b/btif/include/btif_hl.h @@ -73,6 +73,67 @@ #define BTIF_HL_APPLICATION_NAME_LEN 512 +#define BTIF_HL_NV_MAX_APPS 16 + +typedef struct +{ + UINT8 mdep_cfg_idx; + int data_type; + tBTA_HL_MDEP_ID peer_mdep_id; +} btif_hl_extra_mdl_cfg_t; + + +typedef struct +{ + tBTA_HL_MDL_CFG base; + btif_hl_extra_mdl_cfg_t extra; +} btif_hl_mdl_cfg_t; + +typedef struct +{ + btif_hl_mdl_cfg_t mdl_cfg[BTA_HL_NUM_MDL_CFGS]; +}btif_hl_nv_mdl_data_t; + + +typedef struct +{ + tBTA_HL_SUP_FEATURE sup_feature; + tBTA_HL_DCH_CFG channel_type[BTA_HL_NUM_MDEPS]; + char srv_name[BTA_SERVICE_NAME_LEN +1]; + char srv_desp[BTA_SERVICE_DESP_LEN +1]; + char provider_name[BTA_PROVIDER_NAME_LEN +1]; + char application_name[BTIF_HL_APPLICATION_NAME_LEN +1]; +}btif_hl_nv_app_data_t; + + +typedef struct +{ + BOOLEAN in_use; + UINT16 use_freq; +}btif_hl_nv_app_t; + +typedef struct +{ + btif_hl_nv_app_t app[BTIF_HL_NV_MAX_APPS]; +}btif_hl_nv_app_cb_t; + + + +typedef struct +{ + UINT8 app_nv_idx; + BOOLEAN active; + UINT8 app_idx; + btif_hl_nv_app_data_t app_data; +}btif_hl_app_data_t; + +typedef struct +{ + BOOLEAN is_app_read; + btif_hl_nv_app_cb_t app_cb; + BUFFER_Q app_queue; +}btif_hl_nv_cb_t; + typedef enum { BTIF_HL_SOC_STATE_IDLE, @@ -193,6 +254,7 @@ typedef struct btif_hl_chan_cb_state_t cb_state; btif_hl_pend_dch_op_t op; BD_ADDR bd_addr; + BOOLEAN abort_pending; }btif_hl_pending_chan_cb_t; typedef struct @@ -208,34 +270,16 @@ typedef struct tBTA_SEC sec_mask; tBTA_HL_MCL_HANDLE mcl_handle; btif_hl_pending_chan_cb_t pcb; - - BOOLEAN valid_sdp_idx; UINT8 sdp_idx; - tBTA_HL_SDP sdp; btif_hl_cch_op_t cch_oper; + BOOLEAN cch_timer_active; + TIMER_LIST_ENT cch_timer; }btif_hl_mcl_cb_t; typedef struct { - UINT8 mdep_cfg_idx; - int data_type; - int channel_id; - UINT8 app_idx; - BOOLEAN app_active; - //UINT8 app_nv_idx; /* one base */ -} btif_hl_extra_mdl_cfg_t; - - -typedef struct -{ - tBTA_HL_MDL_CFG base; - btif_hl_extra_mdl_cfg_t extra; -} btif_hl_mdl_cfg_t; - -typedef struct -{ BOOLEAN active; UINT16 mdl_id; UINT8 mdep_cfg_idx; @@ -247,6 +291,9 @@ typedef struct { btif_hl_mcl_cb_t mcb[BTA_HL_NUM_MCLS]; /* application Control Blocks */ BOOLEAN in_use; /* this CB is in use*/ + BOOLEAN reg_pending; + BOOLEAN is_new_app; + UINT8 app_nv_idx; UINT8 app_id; //UINT32 sdp_handle; /* SDP record handle */ tBTA_HL_SUP_FEATURE sup_feature; @@ -254,16 +301,13 @@ typedef struct tBTA_HL_SDP_INFO_IND sdp_info_ind; btif_hl_cch_filter_t filter; - btif_hl_mdl_cfg_t mdl_cfg[BTA_HL_NUM_MDL_CFGS]; + btif_hl_mdl_cfg_t mdl_cfg[BTA_HL_NUM_MDL_CFGS]; + int mdl_cfg_channel_id[BTA_HL_NUM_MDL_CFGS]; btif_hl_delete_mdl_t delete_mdl; tBTA_HL_DEVICE_TYPE dev_type; tBTA_HL_APP_HANDLE app_handle; - - //UINT16 data_mtu; /* L2CAP MTU of the MCAP data channel */ UINT16 sec_mask; /* Security mask for BTM_SetSecurityLevel() */ - - char srv_name[BTA_SERVICE_NAME_LEN +1]; /* service name to be used in the SDP; null terminated*/ char srv_desp[BTA_SERVICE_DESP_LEN +1]; /* service description to be used in the SDP; null terminated */ char provider_name[BTA_PROVIDER_NAME_LEN +1]; /* provide name to be used in the SDP; null terminated */ @@ -280,12 +324,11 @@ typedef struct typedef struct { btif_hl_app_cb_t acb[BTA_HL_NUM_APPS]; /* HL Control Blocks */ - btif_hl_pending_reg_cb_t pcb[BTA_HL_NUM_APPS]; tBTA_HL_CTRL_CBACK *p_ctrl_cback; /* pointer to control callback function */ UINT8 next_app_id; UINT16 next_channel_id; btif_hl_state_t state; - + btif_hl_nv_cb_t ncb; } btif_hl_cb_t; @@ -293,6 +336,9 @@ enum { BTIF_HL_SEND_CONNECTED_CB, BTIF_HL_SEND_DISCONNECTED_CB, + BTIF_HL_REG_APP, + BTIF_HL_UNREG_APP, + BTIF_HL_UPDATE_MDL, }; typedef UINT8 btif_hl_evt_t; @@ -306,8 +352,27 @@ typedef struct int fd; }btif_hl_send_chan_state_cb_t; + +typedef struct +{ + UINT8 app_idx; +}btif_hl_reg_t; +typedef btif_hl_reg_t btif_hl_unreg_t; +typedef btif_hl_reg_t btif_hl_update_mdl_t; + +typedef union +{ + btif_hl_send_chan_state_cb_t chan_cb; + btif_hl_reg_t reg; + btif_hl_unreg_t unreg; + btif_hl_update_mdl_t update_mdl; +}btif_hl_evt_cb_t; + + + extern btif_hl_cb_t btif_hl_cb; extern btif_hl_cb_t *p_btif_hl_cb; +extern btif_hl_nv_cb_t *p_ncb; #define BTIF_HL_GET_CB_PTR() &(btif_hl_cb) #define BTIF_HL_GET_APP_CB_PTR(app_idx) &(btif_hl_cb.acb[(app_idx)]) @@ -315,6 +380,7 @@ extern btif_hl_cb_t *p_btif_hl_cb; #define BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx) &(btif_hl_cb.acb[(app_idx)].mcb[(mcl_idx)].mdl[mdl_idx]) #define BTIF_HL_GET_PCB_PTR(app_idx, mcl_idx) &(btif_hl_cb.acb[app_idx].mcb[mcl_idx].pcb) #define BTIF_HL_GET_MDL_CFG_PTR(app_idx, item_idx) &(btif_hl_cb.acb[(app_idx)].mdl_cfg[(item_idx)]) +#define BTIF_HL_GET_MDL_CFG_CHANNEL_ID_PTR(app_idx, item_idx) &(btif_hl_cb.acb[(app_idx)].mdl_cfg_channel_id[(item_idx)]) extern BOOLEAN btif_hl_find_mcl_idx(UINT8 app_idx, BD_ADDR p_bd_addr, UINT8 *p_mcl_idx); extern BOOLEAN btif_hl_find_app_idx(UINT8 app_id, UINT8 *p_app_idx); extern BOOLEAN btif_hl_find_avail_mcl_idx(UINT8 app_idx, UINT8 *p_mcl_idx); @@ -331,4 +397,6 @@ extern BOOLEAN btif_hl_find_mdl_idx_using_handle(tBTA_HL_MDL_HANDLE mdl_handle, UINT8 *p_mdl_idx); extern void btif_hl_abort_pending_chan_setup(UINT8 app_idx, UINT8 mcl_idx); extern BOOLEAN btif_hl_proc_pending_op(UINT8 app_idx, UINT8 mcl_idx); +extern BOOLEAN btif_hl_load_mdl_config (UINT8 app_id, UINT8 buffer_size, + tBTA_HL_MDL_CFG *p_mdl_buf ); #endif diff --git a/btif/include/btif_storage.h b/btif/include/btif_storage.h index 6aaa10f..59cad1f 100644 --- a/btif/include/btif_storage.h +++ b/btif/include/btif_storage.h @@ -65,7 +65,7 @@ ** Constants & Macros ************************************************************************************/ #define BTIF_STORAGE_FILL_PROPERTY(p_prop, t, l, p_v) \ - (p_prop)->type = t;(p_prop)->len = l; (p_prop)->val = (p_v); + (p_prop)->type = t;(p_prop)->len = l; (p_prop)->val = (p_v); /************************************************************************************ ** Type definitions for callback functions @@ -184,6 +184,73 @@ bt_status_t btif_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr); ** *******************************************************************************/ bt_status_t btif_storage_load_bonded_devices(void); +/******************************************************************************* +** +** Function btif_storage_read_hl_apps_cb +** +** Description BTIF storage API - Read HL application control block from NVRAM +** +** Returns BT_STATUS_SUCCESS if the operation was successful, +** BT_STATUS_FAIL otherwise +** +*******************************************************************************/ +bt_status_t btif_storage_read_hl_apps_cb(char *value, int value_size); + +/******************************************************************************* +** +** Function btif_storage_write_hl_apps_cb +** +** Description BTIF storage API - Write HL application control block to NVRAM +** +** Returns BT_STATUS_SUCCESS if the operation was successful, +** BT_STATUS_FAIL otherwise +** +*******************************************************************************/ +bt_status_t btif_storage_write_hl_apps_cb(char *value, int value_size); +/******************************************************************************* +** +** Function btif_storage_read_hl_apps_cb +** +** Description BTIF storage API - Read HL application configuration from NVRAM +** +** Returns BT_STATUS_SUCCESS if the operation was successful, +** BT_STATUS_FAIL otherwise +** +*******************************************************************************/ +bt_status_t btif_storage_read_hl_app_data(UINT8 app_idx, char *value, int value_size); +/******************************************************************************* +** +** Function btif_storage_write_hl_app_data +** +** Description BTIF storage API - Write HL application configuration to NVRAM +** +** Returns BT_STATUS_SUCCESS if the operation was successful, +** BT_STATUS_FAIL otherwise +** +*******************************************************************************/ +bt_status_t btif_storage_write_hl_app_data(UINT8 app_idx, char *value, int value_size); +/******************************************************************************* +** +** Function btif_storage_read_hl_mdl_data +** +** Description BTIF storage API - Read HL application MDL configuration from NVRAM +** +** Returns BT_STATUS_SUCCESS if the operation was successful, +** BT_STATUS_FAIL otherwise +** +*******************************************************************************/ +bt_status_t btif_storage_read_hl_mdl_data(UINT8 app_idx, char *value, int value_size); +/******************************************************************************* +** +** Function btif_storage_write_hl_mdl_data +** +** Description BTIF storage API - Write HL application MDL configuration from NVRAM +** +** Returns BT_STATUS_SUCCESS if the operation was successful, +** BT_STATUS_FAIL otherwise +** +*******************************************************************************/ +bt_status_t btif_storage_write_hl_mdl_data(UINT8 app_idx, char *value, int value_size); /******************************************************************************* ** -- cgit v1.1