component bt:debug the profile task can work

This commit is contained in:
Yulong
2016-11-04 02:34:52 -04:00
parent c377650cdd
commit 90d9f1a74e
11 changed files with 102 additions and 59 deletions

View File

@@ -17,6 +17,7 @@
#include "fixed_queue.h" #include "fixed_queue.h"
#include "bt_prf_task.h" #include "bt_prf_task.h"
#include "gki.h" #include "gki.h"
#include "bt_trace.h"
#include <string.h> #include <string.h>
@@ -34,7 +35,9 @@ static const tBT_PRF_SYS_REG bt_prf_sys_reg =
void bt_prf_sys_init(void) void bt_prf_sys_init(void)
{ {
LOG_ERROR("bt_prf_sys_init\n");
memset(&bt_prf_sys_cb, 0, sizeof(tBT_PRF_SYS_CB)); memset(&bt_prf_sys_cb, 0, sizeof(tBT_PRF_SYS_CB));
bt_prf_StartUp();
} }
@@ -53,7 +56,7 @@ void bt_prf_sys_event(prf_hdr_evt_t *p_msg)
UINT8 id; UINT8 id;
BOOLEAN freebuf = TRUE; BOOLEAN freebuf = TRUE;
APPL_TRACE_EVENT("profile task got event 0x%x\n", p_msg->event); LOG_ERROR("profile task got event 0x%x\n", p_msg->event);
/* get subsystem id from event */ /* get subsystem id from event */
id = (UINT8) (p_msg->event >> 8); id = (UINT8) (p_msg->event >> 8);
@@ -65,7 +68,7 @@ void bt_prf_sys_event(prf_hdr_evt_t *p_msg)
} }
else else
{ {
APPL_TRACE_WARNING("profile task got unregistered event id %d\n", id); LOG_ERROR("profile task got unregistered event id %d\n", id);
} }
if (freebuf) if (freebuf)
@@ -131,7 +134,7 @@ BOOLEAN bt_prf_sys_is_register(UINT8 id)
** **
** Function bt_prf_sys_sendmsg ** Function bt_prf_sys_sendmsg
** **
** Description Send a GKI message to the profile task. ** Description Send a message to the profile task.
** **
** **
** Returns void ** Returns void
@@ -141,7 +144,7 @@ void bt_prf_sys_sendmsg(void *p_msg)
{ {
// There is a race condition that occurs if the stack is shut down while // There is a race condition that occurs if the stack is shut down while
// there is a procedure in progress that can schedule a task via this // there is a procedure in progress that can schedule a task via this
// message queue. This causes |btu_bta_msg_queue| to get cleaned up before // message queue. This causes |bt_profile_msg_queue| to get cleaned up before
// it gets used here; hence we check for NULL before using it. // it gets used here; hence we check for NULL before using it.
if (bt_profile_msg_queue) { if (bt_profile_msg_queue) {
fixed_queue_enqueue(bt_profile_msg_queue, p_msg); fixed_queue_enqueue(bt_profile_msg_queue, p_msg);

View File

@@ -15,6 +15,7 @@
#include "bt_prf_task.h" #include "bt_prf_task.h"
#include "bt_prf_sys.h" #include "bt_prf_sys.h"
#include "allocator.h" #include "allocator.h"
#include "bt_trace.h"
#include "thread.h" #include "thread.h"
#include "gki.h" #include "gki.h"
@@ -35,17 +36,16 @@
******************************************************************************/ ******************************************************************************/
void bt_prf_task_thread_handler(void *arg) void bt_prf_task_thread_handler(void *arg)
{ {
//ke_event_clear(KE_EVENT_BTU_TASK_THREAD);
TaskEvt_t *e; TaskEvt_t *e;
for (;;) { for (;;) {
if (pdTRUE == xQueueReceive(xProfileQueue, &e, (portTickType)portMAX_DELAY)) { if (pdTRUE == xQueueReceive(xProfileQueue, &e, (portTickType)portMAX_DELAY)) {
if (e->sig == SIG_BTU_WORK) { if (e->sig == SIG_PRF_WORK) {
fixed_queue_process(bt_profile_msg_queue); fixed_queue_process(bt_profile_msg_queue);
LOG_ERROR("bt_prf_task_thread_handler\n");
} }
else if (e->sig == SIG_BTU_START_UP) { else if (e->sig == SIG_PRF_START_UP) {
bt_prf_task_start_up(); bt_prf_task_start_up();
} }
osi_free(e); osi_free(e);
@@ -82,6 +82,7 @@ void bt_profile_msg_ready(fixed_queue_t *queue) {
void bt_prf_task_start_up(void) void bt_prf_task_start_up(void)
{ {
LOG_ERROR("bt_prf_task_start_up\n");
fixed_queue_register_dequeue(bt_profile_msg_queue, bt_profile_msg_ready); fixed_queue_register_dequeue(bt_profile_msg_queue, bt_profile_msg_ready);
} }
@@ -99,9 +100,12 @@ void bt_prf_StartUp(void)
if (bt_profile_msg_queue == NULL) if (bt_profile_msg_queue == NULL)
goto error_exit; goto error_exit;
xProfileQueue = xQueueCreate(60, sizeof(void *));
xTaskCreate(bt_prf_task_thread_handler, "Bt_prf", 4096, NULL, configMAX_PRIORITIES - 1, &xProfileTaskHandle);
bt_prf_task_post(SIG_PRF_START_UP);
return; return;
error_exit:; error_exit:
LOG_ERROR("%s Unable to allocate resources for bt_workqueue\n", __func__); LOG_ERROR("%s Unable to allocate resources for bt_workqueue\n", __func__);
bt_prf_ShutDown(); bt_prf_ShutDown();

View File

@@ -76,6 +76,9 @@ extern void bt_prf_sys_init(void);
extern void bt_prf_sys_free(void); extern void bt_prf_sys_free(void);
extern void bt_prf_sys_event(prf_hdr_evt_t *p_msg); extern void bt_prf_sys_event(prf_hdr_evt_t *p_msg);
extern void bt_prf_sys_sendmsg(void *p_msg);
extern void bt_prf_sys_register(uint8_t id, const tBT_PRF_SYS_REG *p_reg); extern void bt_prf_sys_register(uint8_t id, const tBT_PRF_SYS_REG *p_reg);
extern void bt_prf_sys_deregister(uint8_t id); extern void bt_prf_sys_deregister(uint8_t id);
extern BOOLEAN bt_prf_sys_is_register(uint8_t id); extern BOOLEAN bt_prf_sys_is_register(uint8_t id);

View File

@@ -19,7 +19,7 @@
#ifndef BT_PRF_TASK_H__ #ifndef BT_PRF_TASK_H__
#define BT_PRF_TASK_H__ #define BT_PRF_TASK_H__
/* Functions provided by btu_core.c /* Functions provided by bt_prf_task.c
************************************ ************************************
*/ */

View File

@@ -188,8 +188,9 @@ static void button_profile_cb(esp_gatts_evt_t event, esp_gatts_t *p_data)
button_cb_env.button_inst.but_cfg_hdl = p_data->add_result.attr_id; button_cb_env.button_inst.but_cfg_hdl = p_data->add_result.attr_id;
} }
///Start advertising ///Start advertising
LOG_ERROR("\nStart sent the ADV.\n"); LOG_ERROR("\n*******Start sent the ADV.*************\n");
esp_ble_start_advertising (&adv_params); //esp_ble_start_advertising (&adv_params);
BTA_GATTS_Listen(button_cb_env.gatt_if, true, NULL);
break; break;
case ESP_GATTS_CONNECT_EVT: case ESP_GATTS_CONNECT_EVT:
//set the connection flag to true //set the connection flag to true
@@ -332,11 +333,11 @@ esp_gatt_status_t button_init (but_prf_cb_t call_back)
{ {
tBT_UUID app_uuid = {LEN_UUID_16,{ATT_SVC_BUTTON}}; tBT_UUID app_uuid = {LEN_UUID_16,{ATT_SVC_BUTTON}};
LOG_ERROR("\n=============================button_init==============================================\n");
if(button_cb_env.enabled) if(button_cb_env.enabled)
{ {
LOG_ERROR("button svc already initaliezd"); LOG_ERROR("button svc already initaliezd\n");
return GATT_ERROR; return ESP_GATT_ERROR;
} }
else else
{ {

View File

@@ -27,9 +27,9 @@
#define ATT_UUID_128_LEN 0x0010 #define ATT_UUID_128_LEN 0x0010
#define ATT_UUID_32_LEN 0x0004 #define ATT_UUID_32_LEN 0x0004
#define WX_AIRSYNC_CFG TRUE #define WX_AIRSYNC_CFG FALSE
#define BUT_PROFILE_CFG TRUE #define BUT_PROFILE_CFG TRUE
#define HIDD_LE_PROFILE_CFG TRUE #define HIDD_LE_PROFILE_CFG FALSE
/* /*
* Type Definition * Type Definition

View File

@@ -414,11 +414,11 @@ void esp_ble_gattc_close (uint16_t conn_id)
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the mtu value invalid ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the mtu value invalid
** **
*******************************************************************************/ *******************************************************************************/
tGATT_STATUS esp_ble_gattc_config_mtu (uint16_t conn_id, uint16_t mtu) esp_gatt_status_t esp_ble_gattc_config_mtu (uint16_t conn_id, uint16_t mtu)
{ {
if ((mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE)){ if ((mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE)){
LOG_ERROR("Invalid MTU parameters\n"); LOG_ERROR("Invalid MTU parameters\n");
return GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
BTA_GATTC_ConfigureMTU (conn_id, mtu); BTA_GATTC_ConfigureMTU (conn_id, mtu);
@@ -468,15 +468,15 @@ void esp_ble_gattc_svc_search_req (uint16_t conn_id, esp_bt_uuid_t *srvc_uuid)
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or char_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or char_result parameter is NULL.
** **
*****************************************************************************************************/ *****************************************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_first_char (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id, esp_gatt_status_t esp_ble_gattc_get_first_char (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id,
esp_bt_uuid_t *char_uuid_cond, esp_bt_uuid_t *char_uuid_cond,
esp_gattc_char_id_t *char_result, esp_gattc_char_id_t *char_result,
esp_gatt_char_prop_t *property) esp_gatt_char_prop_t *property)
{ {
tBTA_GATT_STATUS status = 0; esp_gatt_status_t status = 0;
if (!srvc_id || !char_result){ if (!srvc_id || !char_result){
return BTA_GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
status = BTA_GATTC_GetFirstChar (conn_id, srvc_id, char_uuid_cond, status = BTA_GATTC_GetFirstChar (conn_id, srvc_id, char_uuid_cond,
@@ -507,14 +507,14 @@ tBTA_GATT_STATUS esp_ble_gattc_get_first_char (uint16_t conn_id, esp_gatt_srvc_
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the char_id or descr_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the char_id or descr_result parameter is NULL.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_first_char_descr (uint16_t conn_id, esp_gattc_char_id_t *char_id, esp_gatt_status_t esp_ble_gattc_get_first_char_descr (uint16_t conn_id, esp_gattc_char_id_t *char_id,
esp_bt_uuid_t *descr_uuid_cond, esp_bt_uuid_t *descr_uuid_cond,
esp_gattc_char_descr_id_t *descr_result) esp_gattc_char_descr_id_t *descr_result)
{ {
tBTA_GATT_STATUS status; esp_gatt_status_t status;
if (!char_id || !descr_result){ if (!char_id || !descr_result){
return BTA_GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
status = BTA_GATTC_GetFirstCharDescr (conn_id, char_id, descr_uuid_cond, descr_result); status = BTA_GATTC_GetFirstCharDescr (conn_id, char_id, descr_uuid_cond, descr_result);
@@ -546,17 +546,17 @@ tBTA_GATT_STATUS esp_ble_gattc_get_first_char_descr (uint16_t conn_id, esp_gatt
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_next_char (uint16_t conn_id, esp_gatt_status_t esp_ble_gattc_get_next_char (uint16_t conn_id,
esp_gattc_char_id_t *start_char_id, esp_gattc_char_id_t *start_char_id,
esp_bt_uuid_t *char_uuid_cond, esp_bt_uuid_t *char_uuid_cond,
esp_gattc_char_id_t *char_result, esp_gattc_char_id_t *char_result,
esp_gatt_char_prop_t *property) esp_gatt_char_prop_t *property)
{ {
tBTA_GATT_STATUS status; esp_gatt_status_t status;
if (!start_char_id || !char_result){ if (!start_char_id || !char_result){
return BTA_GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
status = BTA_GATTC_GetNextChar(conn_id, start_char_id, char_uuid_cond, status = BTA_GATTC_GetNextChar(conn_id, start_char_id, char_uuid_cond,
@@ -588,15 +588,15 @@ tBTA_GATT_STATUS esp_ble_gattc_get_next_char (uint16_t conn_id,
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_next_char_descr (uint16_t conn_id, esp_gatt_status_t esp_ble_gattc_get_next_char_descr (uint16_t conn_id,
esp_gattc_char_descr_id_t *start_descr_id, esp_gattc_char_descr_id_t *start_descr_id,
esp_bt_uuid_t *descr_uuid_cond, esp_bt_uuid_t *descr_uuid_cond,
esp_gattc_char_descr_id_t *descr_result) esp_gattc_char_descr_id_t *descr_result)
{ {
tBTA_GATT_STATUS status; esp_gatt_status_t status;
if (!start_descr_id || !descr_result){ if (!start_descr_id || !descr_result){
return BTA_GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
status = BTA_GATTC_GetNextCharDescr (conn_id, start_descr_id, descr_uuid_cond, descr_result); status = BTA_GATTC_GetNextCharDescr (conn_id, start_descr_id, descr_uuid_cond, descr_result);
@@ -625,14 +625,14 @@ tBTA_GATT_STATUS esp_ble_gattc_get_next_char_descr (uint16_t conn_id,
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or result parameter is NULL.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_first_inclu_srvc (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id, esp_gatt_status_t esp_ble_gattc_get_first_inclu_srvc (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id,
esp_bt_uuid_t *uuid_cond, esp_gattc_incl_srvc_id_t *result) esp_bt_uuid_t *uuid_cond, esp_gattc_incl_srvc_id_t *result)
{ {
tBTA_GATT_STATUS status; esp_gatt_status_t status;
if (!srvc_id || !result){ if (!srvc_id || !result){
return BTA_GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
status = BTA_GATTC_GetFirstIncludedService(conn_id, srvc_id, uuid_cond, result); status = BTA_GATTC_GetFirstIncludedService(conn_id, srvc_id, uuid_cond, result);
@@ -661,15 +661,15 @@ tBTA_GATT_STATUS esp_ble_gattc_get_first_inclu_srvc (uint16_t conn_id, esp_gatt
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the p_char_id or p_descr_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the p_char_id or p_descr_result parameter is NULL.
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_next_inclu_srvc (uint16_t conn_id, esp_gatt_status_t esp_ble_gattc_get_next_inclu_srvc (uint16_t conn_id,
esp_gattc_incl_srvc_id_t *start_id, esp_gattc_incl_srvc_id_t *start_id,
esp_bt_uuid_t *uuid_cond, esp_bt_uuid_t *uuid_cond,
esp_gattc_incl_srvc_id_t *result) esp_gattc_incl_srvc_id_t *result)
{ {
tBTA_GATT_STATUS status; esp_gatt_status_t status;
if (!start_id || !result){ if (!start_id || !result){
return BTA_GATT_ILLEGAL_PARAMETER; return ESP_GATT_ILLEGAL_PARAMETER;
} }
status = BTA_GATTC_GetNextIncludedService(conn_id, start_id, uuid_cond, result); status = BTA_GATTC_GetNextIncludedService(conn_id, start_id, uuid_cond, result);
@@ -860,11 +860,11 @@ void esp_ble_gattc_send_ind_cfm (uint16_t conn_id, esp_gattc_char_id_t *char_id)
** @return OK if registration succeed, otherwise failed. ** @return OK if registration succeed, otherwise failed.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_register_ntf (esp_gattc_if_t client_if, esp_gatt_status_t esp_ble_gattc_register_ntf (esp_gattc_if_t client_if,
BD_ADDR bda, BD_ADDR bda,
esp_gattc_char_id_t *char_id) esp_gattc_char_id_t *char_id)
{ {
tBTA_GATT_STATUS status = BTA_GATT_ILLEGAL_PARAMETER; esp_gatt_status_t status = ESP_GATT_ILLEGAL_PARAMETER;
status = BTA_GATTC_RegisterForNotifications (client_if, bda, char_id); status = BTA_GATTC_RegisterForNotifications (client_if, bda, char_id);
return status; return status;
@@ -888,7 +888,7 @@ tBTA_GATT_STATUS esp_ble_gattc_unregister_ntf (esp_gattc_if_t client_if,
BD_ADDR bda, BD_ADDR bda,
esp_gattc_char_id_t *char_id) esp_gattc_char_id_t *char_id)
{ {
tBTA_GATT_STATUS status = BTA_GATT_ILLEGAL_PARAMETER; esp_gatt_status_t status = ESP_GATT_ILLEGAL_PARAMETER;
status = BTA_GATTC_DeregisterForNotifications (client_if, bda, char_id); status = BTA_GATTC_DeregisterForNotifications (client_if, bda, char_id);
return status; return status;

View File

@@ -41,7 +41,7 @@
#include "button_pro.h" #include "button_pro.h"
#include "app_button_int.h" #include "app_button_int.h"
static const tBT_PRF_SYS_REG bta_gatts_reg = static const tBT_PRF_SYS_REG but_prf_reg =
{ {
ble_but_prf_hdl_event, ble_but_prf_hdl_event,
ble_but_prf_disable ble_but_prf_disable
@@ -61,6 +61,8 @@ static const tBT_PRF_SYS_REG bta_gatts_reg =
*******************************************************************************/ *******************************************************************************/
BOOLEAN ble_but_prf_hdl_event(prf_hdr_evt_t *msg_data) BOOLEAN ble_but_prf_hdl_event(prf_hdr_evt_t *msg_data)
{ {
LOG_ERROR("###################ble_but_prf_hdl_event#####################################\n");
UINT16 connid = 0; UINT16 connid = 0;
switch(msg_data->event) switch(msg_data->event)
{ {
@@ -102,15 +104,16 @@ BOOLEAN ble_but_prf_hdl_event(prf_hdr_evt_t *msg_data)
*******************************************************************************/ *******************************************************************************/
void ble_but_prf_disable(void) void ble_but_prf_disable(void)
{ {
BT_HDR *p_buf; prf_hdr_evt_t *p_buf;
LOG_ERROR("ble_but_prf_disable\n");
if (bt_prf_sys_is_register(PRF_ID_BUT_LE) == FALSE) if (bt_prf_sys_is_register(PRF_ID_BUT_LE) == FALSE)
{ {
APPL_TRACE_WARNING("button profile Module not enabled/already disabled"); APPL_TRACE_WARNING("button profile Module not enabled/already disabled\n");
return; return;
} }
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL) if ((p_buf = (prf_hdr_evt_t *) GKI_getbuf(sizeof(prf_hdr_evt_t))) != NULL)
{ {
p_buf->event = BLE_BUT_DISABLE_IND_EVT; p_buf->event = BLE_BUT_DISABLE_IND_EVT;
bta_sys_sendmsg(p_buf); bta_sys_sendmsg(p_buf);
@@ -119,6 +122,26 @@ void ble_but_prf_disable(void)
} }
void ble_but_prf_enable(void)
{
bt_prf_sys_register(PRF_ID_BUT_LE,&but_prf_reg);
}
void ble_but_create_svc(void)
{
prf_hdr_evt_t *p_msg;
LOG_ERROR("ble_but_create_svc\n"); //todo
if ((p_msg = (prf_hdr_evt_t *) GKI_getbuf(sizeof(prf_hdr_evt_t))) != NULL)
{
memset(p_msg, 0, sizeof(prf_hdr_evt_t));
p_msg->event = BLE_BUT_ENABLE_REQ_EVT;
bt_prf_sys_sendmsg(p_msg);
}
}

View File

@@ -30,7 +30,7 @@
#include "wx_airsync_prf.h" #include "wx_airsync_prf.h"
#include "button_pro.h" #include "button_pro.h"
#include "app_button.h"
#include "hid_le_prf.h" #include "hid_le_prf.h"
#include "bt_app_api.h" #include "bt_app_api.h"
@@ -231,6 +231,8 @@ void btif_to_bta_uuid(tBT_UUID *p_dest, bt_uuid_t *p_src)
break; break;
} }
} }
/*set advertising config callback*/ /*set advertising config callback*/
static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status) static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
{ {
@@ -242,13 +244,14 @@ static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
DIS_ATTR_IEEE_DATA_BIT | DIS_ATTR_PNP_ID_BIT; DIS_ATTR_IEEE_DATA_BIT | DIS_ATTR_PNP_ID_BIT;
DIS_SrInit(dis_attr_mask); DIS_SrInit(dis_attr_mask);
*/ */
ble_but_create_svc();
/*instantiate a battery service*/ /*instantiate a battery service*/
bas_register(); //bas_register();
/*instantiate the driver for button profile*/ /*instantiate the driver for button profile*/
//app_button_init(); //app_button_init();
#if (BUT_PROFILE_CFG) #if (BUT_PROFILE_CFG)
/*instantiate a button service*/ /*instantiate a button service*/
button_init(SimpleDataCallBack); //button_init(SimpleDataCallBack);
#endif ///BUT_PROFILE_CFG #endif ///BUT_PROFILE_CFG
#if (HIDD_LE_PROFILE_CFG) #if (HIDD_LE_PROFILE_CFG)
@@ -331,6 +334,9 @@ static void ble_server_appRegister(void)
LOG_ERROR("register gatts application\n"); LOG_ERROR("register gatts application\n");
esp_ble_gatts_app_register(&t_uuid, bta_gatts_callback); esp_ble_gatts_app_register(&t_uuid, bta_gatts_callback);
bt_prf_sys_init();
ble_but_prf_enable();
} }
void gatts_server_test(void) void gatts_server_test(void)

View File

@@ -57,6 +57,9 @@ extern app_key_env key_press;
uint8_t check_sum(uint8_t *check_array,uint8_t len); uint8_t check_sum(uint8_t *check_array,uint8_t len);
void ble_but_prf_enable(void);
void ble_but_create_svc(void);

View File

@@ -274,7 +274,7 @@ void esp_ble_gattc_close (uint16_t conn_id);
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the mtu value invalid ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the mtu value invalid
** **
*******************************************************************************/ *******************************************************************************/
tGATT_STATUS esp_ble_gattc_config_mtu (uint16_t conn_id, uint16_t mtu); esp_gatt_status_t esp_ble_gattc_config_mtu (uint16_t conn_id, uint16_t mtu);
/******************************************************************************* /*******************************************************************************
@@ -316,7 +316,7 @@ void esp_ble_gattc_svc_search_req (uint16_t conn_id, esp_bt_uuid_t *srvc_uuid);
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or char_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or char_result parameter is NULL.
** **
*****************************************************************************************************/ *****************************************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_first_char (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id, esp_gatt_status_t esp_ble_gattc_get_first_char (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id,
esp_bt_uuid_t *char_uuid_cond, esp_bt_uuid_t *char_uuid_cond,
esp_gattc_char_id_t *char_result, esp_gattc_char_id_t *char_result,
esp_gatt_char_prop_t *property); esp_gatt_char_prop_t *property);
@@ -341,7 +341,7 @@ tBTA_GATT_STATUS esp_ble_gattc_get_first_char (uint16_t conn_id, esp_gatt_srvc_
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the char_id or descr_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the char_id or descr_result parameter is NULL.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_first_char_descr (uint16_t conn_id, esp_gattc_char_id_t *char_id, esp_gatt_status_t esp_ble_gattc_get_first_char_descr (uint16_t conn_id, esp_gattc_char_id_t *char_id,
esp_bt_uuid_t *descr_uuid_cond, esp_bt_uuid_t *descr_uuid_cond,
esp_gattc_char_descr_id_t *descr_result); esp_gattc_char_descr_id_t *descr_result);
@@ -366,7 +366,7 @@ tBTA_GATT_STATUS esp_ble_gattc_get_first_char_descr (uint16_t conn_id, esp_gatt
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the p_char_id or p_descr_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the p_char_id or p_descr_result parameter is NULL.
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_next_inclu_srvc (uint16_t conn_id, esp_gatt_status_t esp_ble_gattc_get_next_inclu_srvc (uint16_t conn_id,
esp_gattc_incl_srvc_id_t *start_id, esp_gattc_incl_srvc_id_t *start_id,
esp_bt_uuid_t *uuid_cond, esp_bt_uuid_t *uuid_cond,
esp_gattc_incl_srvc_id_t *result); esp_gattc_incl_srvc_id_t *result);
@@ -393,7 +393,7 @@ tBTA_GATT_STATUS esp_ble_gattc_get_next_inclu_srvc (uint16_t conn_id,
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the start_char_id or char_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the start_char_id or char_result parameter is NULL.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_next_char (uint16_t conn_id, esp_gatt_status_t esp_ble_gattc_get_next_char (uint16_t conn_id,
esp_gattc_char_id_t *start_char_id, esp_gattc_char_id_t *start_char_id,
esp_bt_uuid_t *char_uuid_cond, esp_bt_uuid_t *char_uuid_cond,
esp_gattc_char_id_t *char_result, esp_gattc_char_id_t *char_result,
@@ -420,7 +420,7 @@ tBTA_GATT_STATUS esp_ble_gattc_get_next_char (uint16_t conn_id,
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the start_descr_id or descr_result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the start_descr_id or descr_result parameter is NULL.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_get_next_char_descr (uint16_t conn_id, esp_gatt_status_t esp_ble_gattc_get_next_char_descr (uint16_t conn_id,
esp_gattc_char_descr_id_t *start_descr_id, esp_gattc_char_descr_id_t *start_descr_id,
esp_bt_uuid_t *descr_uuid_cond, esp_bt_uuid_t *descr_uuid_cond,
esp_gattc_char_descr_id_t *descr_result); esp_gattc_char_descr_id_t *descr_result);
@@ -445,7 +445,7 @@ tBTA_GATT_STATUS esp_ble_gattc_get_next_char_descr (uint16_t conn_id,
** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or result parameter is NULL. ** - @ref ESP_GATT_ILLEGAL_PARAMETER: If the srvc_id or result parameter is NULL.
** **
*******************************************************************************/ *******************************************************************************/
extern tBTA_GATT_STATUS esp_ble_gattc_get_first_inclu_srvc (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id, esp_gatt_status_t esp_ble_gattc_get_first_inclu_srvc (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id,
esp_bt_uuid_t *uuid_cond, esp_gattc_incl_srvc_id_t *result); esp_bt_uuid_t *uuid_cond, esp_gattc_incl_srvc_id_t *result);
@@ -615,7 +615,7 @@ void esp_ble_gattc_send_ind_cfm (uint16_t conn_id, esp_gattc_char_id_t *char_id)
** @return OK if registration succeed, otherwise failed. ** @return OK if registration succeed, otherwise failed.
** **
*******************************************************************************/ *******************************************************************************/
tBTA_GATT_STATUS esp_ble_gattc_register_ntf (esp_gattc_if_t client_if, esp_gatt_status_t esp_ble_gattc_register_ntf (esp_gattc_if_t client_if,
BD_ADDR bda, BD_ADDR bda,
esp_gattc_char_id_t *char_id); esp_gattc_char_id_t *char_id);