mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component bt:Added the app_button event process function to the bt project
This commit is contained in:
parent
97c75a88ae
commit
2cea783ca1
@ -65,30 +65,30 @@ enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BD_ADDR remote_bda;
|
||||
BOOLEAN need_rsp;
|
||||
UINT16 clt_cfg;
|
||||
BD_ADDR remote_bda;
|
||||
BOOLEAN need_rsp;
|
||||
uint16_t clt_cfg;
|
||||
}but_write_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BOOLEAN in_use;
|
||||
BOOLEAN congest;
|
||||
UINT16 conn_id;
|
||||
uint16_t conn_id;
|
||||
BOOLEAN connected;
|
||||
BD_ADDR remote_bda;
|
||||
UINT32 trans_id;
|
||||
UINT8 cur_srvc_id;
|
||||
uint32_t trans_id;
|
||||
uint8_t cur_srvc_id;
|
||||
|
||||
}but_clcb_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 app_id;
|
||||
UINT16 but_wirt_hdl;
|
||||
UINT16 but_ntf_hdl;
|
||||
UINT16 but_cfg_hdl;
|
||||
uint8_t app_id;
|
||||
uint16_t but_wirt_hdl;
|
||||
uint16_t but_ntf_hdl;
|
||||
uint16_t but_cfg_hdl;
|
||||
|
||||
but_prf_cb_t p_cback;
|
||||
|
||||
@ -99,11 +99,11 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
but_clcb_t clcb; /* connection link*/
|
||||
tGATT_IF gatt_if;
|
||||
esp_gatt_if_t gatt_if;
|
||||
BOOLEAN enabled;
|
||||
BOOLEAN is_primery;
|
||||
but_inst_t button_inst;
|
||||
UINT8 inst_id;
|
||||
but_inst_t button_inst;
|
||||
uint8_t inst_id;
|
||||
}button_env_cb_t;
|
||||
|
||||
void Button_CreateService(void);
|
||||
|
@ -41,6 +41,13 @@
|
||||
#include "button_pro.h"
|
||||
#include "app_button_int.h"
|
||||
|
||||
static const tBTA_SYS_REG bta_gatts_reg =
|
||||
{
|
||||
ble_but_prf_hdl_event,
|
||||
ble_but_prf_disable
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -82,6 +89,40 @@ BOOLEAN ble_but_prf_hdl_event(BT_HDR *msg_data)
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function ble_but_prf_disable
|
||||
**
|
||||
** Description This function is called to disable the button profile modlue
|
||||
**
|
||||
** Parameters None.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void ble_but_prf_disable(void)
|
||||
{
|
||||
BT_HDR *p_buf;
|
||||
|
||||
if (bt_prf_sys_is_register(PRF_ID_BUT_LE) == FALSE)
|
||||
{
|
||||
APPL_TRACE_WARNING("button profile Module not enabled/already disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
|
||||
{
|
||||
p_buf->event = BTA_GATTS_API_DISABLE_EVT;
|
||||
bta_sys_sendmsg(p_buf);
|
||||
}
|
||||
bta_sys_deregister(PRF_ID_BUT_LE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif ///BUT_PROFILE_CFG
|
||||
|
||||
|
@ -105,10 +105,24 @@ typedef struct
|
||||
uint16_t conhdl;
|
||||
}tBUT_DISABLE_IND;
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint16_t conhdl;
|
||||
tBUT_CRT_DB_REQ but_crt_db_req;
|
||||
tBUT_CRT_DB_CFM but_crt_db_cfm;
|
||||
tBUT_CFG_NTF_IND but_cfg_ntf_ind;
|
||||
tBUT_SND_CHAR_VAL_REQ but_snd_char_val_req;
|
||||
tBUT_ENABLE_REQ but_enable_req;
|
||||
tBUT_VAL_SND_CFM but_val_snd_cfm;
|
||||
tBUT_DISABLE_IND but_disable_ind;
|
||||
}tBUT_PRF_MSG;
|
||||
|
||||
|
||||
|
||||
BOOLEAN ble_but_prf_hdl_event(BT_HDR *msg_data);
|
||||
|
||||
void ble_but_prf_disable(void);
|
||||
|
||||
|
||||
|
||||
#endif ///BUT_PROFILE_CFG
|
||||
|
Loading…
x
Reference in New Issue
Block a user