diff options
Diffstat (limited to 'btif/include/btif_hl.h')
-rw-r--r-- | btif/include/btif_hl.h | 369 |
1 files changed, 188 insertions, 181 deletions
diff --git a/btif/include/btif_hl.h b/btif/include/btif_hl.h index ccf9bc9..cac6eb2 100644 --- a/btif/include/btif_hl.h +++ b/btif/include/btif_hl.h @@ -45,12 +45,21 @@ * ************************************************************************************/ +/************************************************************************************ + * + * Filename: btif_hl.h + * + * Description: + * + ***********************************************************************************/ + #ifndef BTIF_HL_H #define BTIF_HL_H -/******************************************************************************* -** Constants & Macros -********************************************************************************/ +/************************************************************************************ +** Functions +************************************************************************************/ + #define BTIF_HL_DATA_TYPE_NONE 0x0000 #define BTIF_HL_DATA_TYPE_PULSE_OXIMETER 0x1004 /* from BT assigned number */ @@ -63,73 +72,8 @@ #define BTIF_HL_CCH_NUM_FILTER_ELEMS 3 #define BTIF_HL_APPLICATION_NAME_LEN 512 -#define BTIF_HL_NV_MAX_APPS 16 - - -/******************************************************************************* -** Type definitions and return values -********************************************************************************/ - -typedef enum -{ - BTIF_HL_SOC_STATE_IDLE, - BTIF_HL_SOC_STATE_W4_ADD, - BTIF_HL_SOC_STATE_W4_CONN, - BTIF_HL_SOC_STATE_W4_READ, - BTIF_HL_SOC_STATE_W4_REL -} btif_hl_soc_state_t; - -typedef enum -{ - BTIF_HL_STATE_DISABLED, - BTIF_HL_STATE_DISABLING, - BTIF_HL_STATE_ENABLED, - BTIF_HL_STATE_ENABLING, -} btif_hl_state_t; - -typedef enum -{ - BTIF_HL_CCH_OP_NONE, - BTIF_HL_CCH_OP_MDEP_FILTERING, - BTIF_HL_CCH_OP_MATCHED_CTRL_PSM, - BTIF_HL_CCH_OP_DCH_OPEN, - BTIF_HL_CCH_OP_DCH_RECONNECT, - BTIF_HL_CCH_OP_DCH_ECHO_TEST -} btif_hl_cch_op_t; - -typedef enum -{ - BTIF_HL_PEND_DCH_OP_NONE, - BTIF_HL_PEND_DCH_OP_DELETE_MDL, - BTIF_HL_PEND_DCH_OP_OPEN, - BTIF_HL_PEND_DCH_OP_RECONNECT -} btif_hl_pend_dch_op_t; - -typedef enum -{ - BTIF_HL_DCH_OP_NONE, - BTIF_HL_DCH_OP_DISC -} btif_hl_dch_op_t; - -typedef enum -{ - BTIF_HL_CHAN_CB_STATE_NONE, - BTIF_HL_CHAN_CB_STATE_CONNECTING_PENDING, - BTIF_HL_CHAN_CB_STATE_CONNECTED_PENDING, - - BTIF_HL_CHAN_CB_STATE_DISCONNECTING_PENDING, - BTIF_HL_CHAN_CB_STATE_DISCONNECTED_PENDING, - BTIF_HL_CHAN_CB_STATE_DESTROYED_PENDING, -} btif_hl_chan_cb_state_t; -enum -{ - BTIF_HL_SEND_CONNECTED_CB, - BTIF_HL_SEND_DISCONNECTED_CB, - BTIF_HL_REG_APP, - BTIF_HL_UNREG_APP, - BTIF_HL_UPDATE_MDL, -}; +#define BTIF_HL_NV_MAX_APPS 16 typedef struct { @@ -138,6 +82,7 @@ typedef struct tBTA_HL_MDEP_ID peer_mdep_id; } btif_hl_extra_mdl_cfg_t; + typedef struct { tBTA_HL_MDL_CFG base; @@ -146,75 +91,123 @@ typedef struct typedef struct { - btif_hl_mdl_cfg_t mdl_cfg[BTA_HL_NUM_MDL_CFGS]; -} btif_hl_nv_mdl_data_t; + 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; + 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; +}btif_hl_nv_app_t; typedef struct { btif_hl_nv_app_t app[BTIF_HL_NV_MAX_APPS]; -} btif_hl_nv_app_cb_t; +}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; + 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; + 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, + BTIF_HL_SOC_STATE_W4_ADD, + BTIF_HL_SOC_STATE_W4_CONN, + BTIF_HL_SOC_STATE_W4_READ, + BTIF_HL_SOC_STATE_W4_REL +} btif_hl_soc_state_t; typedef struct { - int channel_id; - BD_ADDR bd_addr; - UINT8 mdep_cfg_idx; - int max_s; - int socket_id[2]; - UINT8 app_idx; - UINT8 mcl_idx; - UINT8 mdl_idx; - btif_hl_soc_state_t state; + int channel_id; + BD_ADDR bd_addr; + UINT8 mdep_cfg_idx; + int max_s; + int socket_id[2]; + UINT8 app_idx; + UINT8 mcl_idx; + UINT8 mdl_idx; + btif_hl_soc_state_t state; }btif_hl_soc_cb_t; typedef struct { - UINT16 data_type; - UINT16 max_tx_apdu_size; - UINT16 max_rx_apdu_size; + UINT16 data_type; + UINT16 max_tx_apdu_size; + UINT16 max_rx_apdu_size; } btif_hl_data_type_cfg_t; +typedef enum +{ + BTIF_HL_STATE_DISABLED, + BTIF_HL_STATE_DISABLING, + BTIF_HL_STATE_ENABLED, + BTIF_HL_STATE_ENABLING, + +}btif_hl_state_t; + +typedef enum +{ + BTIF_HL_CCH_OP_NONE, + BTIF_HL_CCH_OP_MDEP_FILTERING, + BTIF_HL_CCH_OP_MATCHED_CTRL_PSM, + BTIF_HL_CCH_OP_DCH_OPEN, + BTIF_HL_CCH_OP_DCH_RECONNECT, + BTIF_HL_CCH_OP_DCH_ECHO_TEST +}btif_hl_cch_op_t; + +typedef enum +{ + BTIF_HL_PEND_DCH_OP_NONE, + BTIF_HL_PEND_DCH_OP_DELETE_MDL, + BTIF_HL_PEND_DCH_OP_OPEN, + BTIF_HL_PEND_DCH_OP_RECONNECT +} btif_hl_pend_dch_op_t; + +typedef enum +{ + BTIF_HL_DCH_OP_NONE, + BTIF_HL_DCH_OP_DISC +} btif_hl_dch_op_t; + + typedef struct { UINT16 data_type; tBTA_HL_MDEP_ROLE peer_mdep_role; } btif_hl_filter_elem_t; + typedef struct { - UINT8 num_elems; - btif_hl_filter_elem_t elem[BTIF_HL_CCH_NUM_FILTER_ELEMS]; + UINT8 num_elems; + btif_hl_filter_elem_t elem[BTIF_HL_CCH_NUM_FILTER_ELEMS]; } btif_hl_cch_filter_t; typedef struct @@ -241,93 +234,112 @@ typedef struct BOOLEAN cong; btif_hl_soc_cb_t *p_scb; int channel_id; -} btif_hl_mdl_cb_t; +}btif_hl_mdl_cb_t; + +typedef enum +{ + BTIF_HL_CHAN_CB_STATE_NONE, + BTIF_HL_CHAN_CB_STATE_CONNECTING_PENDING, + BTIF_HL_CHAN_CB_STATE_CONNECTED_PENDING, + BTIF_HL_CHAN_CB_STATE_DISCONNECTING_PENDING, + BTIF_HL_CHAN_CB_STATE_DISCONNECTED_PENDING, + BTIF_HL_CHAN_CB_STATE_DESTROYED_PENDING, +}btif_hl_chan_cb_state_t; typedef struct { - int channel_id; - int mdep_cfg_idx; - BOOLEAN in_use; - 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; + int channel_id; + int mdep_cfg_idx; + BOOLEAN in_use; + 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 { - btif_hl_mdl_cb_t mdl[BTA_HL_NUM_MDLS_PER_MCL]; - BOOLEAN in_use; - BOOLEAN is_connected; - UINT16 req_ctrl_psm; - UINT16 ctrl_psm; - UINT16 data_psm; - BD_ADDR bd_addr; - UINT16 cch_mtu; - 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; + btif_hl_mdl_cb_t mdl[BTA_HL_NUM_MDLS_PER_MCL]; + BOOLEAN in_use; + BOOLEAN is_connected; + UINT16 req_ctrl_psm; + UINT16 ctrl_psm; + UINT16 data_psm; + BD_ADDR bd_addr; + UINT16 cch_mtu; + 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 { - BOOLEAN active; - UINT16 mdl_id; - UINT8 mdep_cfg_idx; - BD_ADDR bd_addr; - int channel_id; + BOOLEAN active; + UINT16 mdl_id; + UINT8 mdep_cfg_idx; + BD_ADDR bd_addr; + int channel_id; } btif_hl_delete_mdl_t; 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; - - tBTA_HL_SUP_FEATURE sup_feature; - tBTA_HL_DCH_CFG channel_type[BTA_HL_NUM_MDEPS]; - 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]; - 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 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 */ - char application_name[BTIF_HL_APPLICATION_NAME_LEN +1]; /* applicaiton name */ -} btif_hl_app_cb_t; - + 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; + tBTA_HL_DCH_CFG channel_type[BTA_HL_NUM_MDEPS]; + 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]; + 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 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 */ + char application_name[BTIF_HL_APPLICATION_NAME_LEN +1]; /* applicaiton name */ + +}btif_hl_app_cb_t; typedef struct { - BOOLEAN in_use; - UINT8 app_idx; -} btif_hl_pending_reg_cb_t; + BOOLEAN in_use; + UINT8 app_idx; +}btif_hl_pending_reg_cb_t; /* BTIF-HL control block */ typedef struct { - btif_hl_app_cb_t acb[BTA_HL_NUM_APPS]; /* HL Control Blocks */ - 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_app_cb_t acb[BTA_HL_NUM_APPS]; /* HL Control Blocks */ + 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; + +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; typedef struct @@ -338,29 +350,29 @@ typedef struct int channel_id; btif_hl_chan_cb_state_t cb_state; int fd; -} btif_hl_send_chan_state_cb_t; +}btif_hl_send_chan_state_cb_t; typedef struct { UINT8 app_idx; -} btif_hl_reg_t; - +}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; + btif_hl_reg_t reg; + btif_hl_unreg_t unreg; + btif_hl_update_mdl_t update_mdl; +}btif_hl_evt_cb_t; -/******************************************************************************* -** Functions -********************************************************************************/ + +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)]) @@ -369,11 +381,6 @@ typedef union #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 btif_hl_cb_t btif_hl_cb; -extern btif_hl_cb_t *p_btif_hl_cb; -extern btif_hl_nv_cb_t *p_ncb; - 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); |