I'm trying to establish connection bewtween 2 ble modules: esp32 as gatt client, nrf52840 as gatt server.
On Nrf52 3 services are running: Battery service, Device name, Heart Rate (basically, its default example from manufacturer).
On esp32 side I have sucessfully discovered and connected to nfr52 as gatt client, and read data from battery service ONCE.
After that I got next error:
BT: bta_gattc_cmpl_cback unknown conn_id = 1, ignore data
And 30 seconds later I got disconnect (connection dropped by timeout):
BT: bta_gattc_conn_cback() - cif=1 connected=0 conn_id=1 reason=0x0013
BT: bta_gattc_conn_cback() - cif=2 connected=0 conn_id=2 reason=0x0013
BLE: (battery)ESP_GATTC_DISCONNECT_EVT, reason = 19
I dont know what is the problem with unknown connection?
Here is my profile event handler:
Code: Select all
static void gattc_profile_battery_service_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) // BLE
{
esp_ble_gattc_cb_param_t *p_data = (esp_ble_gattc_cb_param_t *)param;
switch (event) {
case ESP_GATTC_REG_EVT:
ESP_LOGI(BLE_TAG, "(battery)REG_EVT");
esp_err_t scan_ret = esp_ble_gap_set_scan_params(&ble_scan_params);
if (scan_ret){
ESP_LOGE(BLE_TAG, "(battery)set scan params error, error code = %x", scan_ret);
}
break;
case ESP_GATTC_CONNECT_EVT:{
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_CONNECT_EVT conn_id %d, if %d", p_data->connect.conn_id, gattc_if);
gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id = p_data->connect.conn_id;
memcpy(gl_profile_tab[PROFILE_BATTERY_SERVICE].remote_bda, p_data->connect.remote_bda, sizeof(esp_bd_addr_t));
ESP_LOGI(BLE_TAG, "(battery)REMOTE BDA:");
esp_log_buffer_hex(BLE_TAG, gl_profile_tab[PROFILE_BATTERY_SERVICE].remote_bda, sizeof(esp_bd_addr_t));
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, p_data->connect.conn_id);
if (mtu_ret){
ESP_LOGE(BLE_TAG, "(battery)config MTU error, error code = %x", mtu_ret);
}
break;
}
case ESP_GATTC_OPEN_EVT:
if (param->open.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)open failed, status %d", p_data->open.status);
break;
}
ESP_LOGI(BLE_TAG, "(battery)open success");
break;
case ESP_GATTC_CFG_MTU_EVT:
if (param->cfg_mtu.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG,"(battery)config mtu failed, error status = %x", param->cfg_mtu.status);
}
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_CFG_MTU_EVT, Status %d, MTU %d, conn_id %d", param->cfg_mtu.status, param->cfg_mtu.mtu, param->cfg_mtu.conn_id);
esp_err_t ret_search_gatt;
ret_search_gatt = esp_ble_gattc_search_service(gattc_if, param->cfg_mtu.conn_id, &remote_filter_battery_service_uuid); // with filter
//ret_search_gatt = esp_ble_gattc_search_service(gattc_if, param->cfg_mtu.conn_id, NULL); // without filter
if(ret_search_gatt){
ESP_LOGI(BLE_TAG, "(battery)service not found, error code = %x", ret_search_gatt);
}else{
ESP_LOGI(BLE_TAG, "(battery)service found");
}
break;
case ESP_GATTC_SEARCH_RES_EVT: {
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_SEARCH_RES_EVT");
esp_gatt_srvc_id_t *srvc_id =(esp_gatt_srvc_id_t *)&p_data->search_res.srvc_id;
//check service len
if (srvc_id->id.uuid.len == ESP_UUID_LEN_16) {
ESP_LOGI(BLE_TAG, "UUID16: %x", srvc_id->id.uuid.uuid.uuid16);
} else if (srvc_id->id.uuid.len == ESP_UUID_LEN_32) {
ESP_LOGI(BLE_TAG, "UUID32: %x", srvc_id->id.uuid.uuid.uuid32);
} else if (srvc_id->id.uuid.len == ESP_UUID_LEN_128) {
ESP_LOGI(BLE_TAG, "UUID128: %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x", srvc_id->id.uuid.uuid.uuid128[0],
srvc_id->id.uuid.uuid.uuid128[1], srvc_id->id.uuid.uuid.uuid128[2], srvc_id->id.uuid.uuid.uuid128[3],
srvc_id->id.uuid.uuid.uuid128[4], srvc_id->id.uuid.uuid.uuid128[5], srvc_id->id.uuid.uuid.uuid128[6],
srvc_id->id.uuid.uuid.uuid128[7], srvc_id->id.uuid.uuid.uuid128[8], srvc_id->id.uuid.uuid.uuid128[9],
srvc_id->id.uuid.uuid.uuid128[10], srvc_id->id.uuid.uuid.uuid128[11], srvc_id->id.uuid.uuid.uuid128[12],
srvc_id->id.uuid.uuid.uuid128[13], srvc_id->id.uuid.uuid.uuid128[14], srvc_id->id.uuid.uuid.uuid128[15]);
} else {
ESP_LOGE(BLE_TAG, "UNKNOWN LEN %d", srvc_id->id.uuid.len);
}
ESP_LOGI(BLE_TAG, "(battery)srvc_id_len:%d [%x]", srvc_id->id.uuid.len, srvc_id->id.uuid.len);
if (srvc_id->id.uuid.len == ESP_UUID_LEN_16 && srvc_id->id.uuid.uuid.uuid16 == REMOTE_BATTERY_SERVICE_UUID) { // 0x180F
ESP_LOGI(BLE_TAG, "(battery)service found");
get_server = true;
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_start_handle = p_data->search_res.start_handle;
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_end_handle = p_data->search_res.end_handle;
ESP_LOGI(BLE_TAG, "(battery)UUID16: %x", srvc_id->id.uuid.uuid.uuid16);
}
break;
}
case ESP_GATTC_SEARCH_CMPL_EVT:
if (p_data->search_cmpl.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)search service failed, error status = %x", p_data->search_cmpl.status);
break;
}
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_SEARCH_CMPL_EVT");
if (get_server){
ESP_LOGI(BLE_TAG, "(battery)get_server");
uint16_t count = 0;
esp_gatt_status_t status = esp_ble_gattc_get_attr_count( gattc_if,
p_data->search_cmpl.conn_id,
ESP_GATT_DB_CHARACTERISTIC,
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_start_handle,
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_end_handle,
INVALID_HANDLE,
&count);
if (status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)esp_ble_gattc_get_attr_count error");
}
if (count > 0){
char_elem_result = (esp_gattc_char_elem_t *)malloc(sizeof(esp_gattc_char_elem_t) * count);
if (!char_elem_result){
ESP_LOGE(BLE_TAG, "(battery)gattc no mem");
}else{
status = esp_ble_gattc_get_char_by_uuid( gattc_if,
p_data->search_cmpl.conn_id,
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_start_handle,
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_end_handle,
remote_battery_filter_char_uuid, //remote_filter_char_uuid,
char_elem_result,
&count);
if (status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)esp_ble_gattc_get_char_by_uuid error");
}
/* Every service have only one char in our 'ESP_GATTS_DEMO' demo, so we used first 'char_elem_result' */
if (count > 0 && (char_elem_result[0].properties & ESP_GATT_CHAR_PROP_BIT_NOTIFY)){
gl_profile_tab[PROFILE_BATTERY_SERVICE].char_handle = char_elem_result[0].char_handle;
esp_err_t errorcode = esp_ble_gattc_register_for_notify (gattc_if, gl_profile_tab[PROFILE_BATTERY_SERVICE].remote_bda, char_elem_result[0].char_handle);
if(errorcode)
{
ESP_LOGI(BLE_TAG, "(battery)esp_ble_gattc_register_for_notify error, code: %x", errorcode);
}else{
ESP_LOGI(BLE_TAG, "(battery)esp_ble_gattc_register_for_notify success");
}
}
}
/* free char_elem_result */
free(char_elem_result);
}else{
ESP_LOGE(BLE_TAG, "(battery)no char found");
}
}else{
ESP_LOGI(BLE_TAG, "(battery)GATT server not found");
}
break;
case ESP_GATTC_REG_FOR_NOTIFY_EVT: {
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_REG_FOR_NOTIFY_EVT");
if (p_data->reg_for_notify.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)REG FOR NOTIFY failed: error status = %d", p_data->reg_for_notify.status);
}else{
uint16_t count = 0;
uint16_t notify_en = 1;
esp_gatt_status_t ret_status = esp_ble_gattc_get_attr_count( gattc_if,
gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id,
ESP_GATT_DB_DESCRIPTOR,
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_start_handle,
gl_profile_tab[PROFILE_BATTERY_SERVICE].service_end_handle,
gl_profile_tab[PROFILE_BATTERY_SERVICE].char_handle,
&count);
if (ret_status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)esp_ble_gattc_get_attr_count error");
}
if (count > 0)
{
descr_elem_result = malloc(sizeof(esp_gattc_descr_elem_t) * count);
if (!descr_elem_result){
ESP_LOGE(BLE_TAG, "(battery)malloc error, gattc no mem");
}else{
ret_status = esp_ble_gattc_get_descr_by_char_handle( gattc_if,
gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id,
p_data->reg_for_notify.handle,
notify_descr_uuid,
descr_elem_result,
&count);
if (ret_status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)esp_ble_gattc_get_descr_by_char_handle error");
}
/* Every char has only one descriptor in our 'ESP_GATTS_DEMO' demo, so we used first 'descr_elem_result' */
if (count > 0 && descr_elem_result[0].uuid.len == ESP_UUID_LEN_16 && descr_elem_result[0].uuid.uuid.uuid16 == ESP_GATT_UUID_CHAR_CLIENT_CONFIG){
// SHOULD HERE REPLACE WRITE TO READ ???
// ret_status = esp_ble_gattc_write_char_descr( gattc_if,
// gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id,
// descr_elem_result[0].handle,
// sizeof(notify_en),
// (uint8_t *)¬ify_en,
// ESP_GATT_WRITE_TYPE_RSP,
// ESP_GATT_AUTH_REQ_NONE);
ret_status = esp_ble_gattc_read_char_descr( gattc_if,
gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id,
descr_elem_result[0].handle,
ESP_GATT_AUTH_REQ_NONE);
}
if (ret_status != ESP_GATT_OK){
//ESP_LOGE(BLE_TAG, "(battery)esp_ble_gattc_write_char_descr error");
ESP_LOGE(BLE_TAG, "(battery)esp_ble_gattc_read_char_descr error, code: %x", ret_status);
}
/* free descr_elem_result */
free(descr_elem_result);
}
}
else{
ESP_LOGE(BLE_TAG, "(battery)decsr not found");
}
}
break;
}
case ESP_GATTC_NOTIFY_EVT:
if (p_data->notify.is_notify){
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_NOTIFY_EVT, receive notify value:");
}else{
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_NOTIFY_EVT, receive indicate value:");
}
esp_log_buffer_hex(BLE_TAG, p_data->notify.value, p_data->notify.value_len);
break;
case ESP_GATTC_READ_CHAR_EVT:
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_READ_CHAR_EVT");
if (p_data->read.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)read char failed, error status = %x", p_data->read.status);
break;
}
const char *char_pointer = (char*)p_data->read.value; //p_data->read.value: p_data is pointer of union type esp_ble_gattc_cb_param_t
//for accesing the read struc we need to use p_data->read.value sintaxis.
int battery_percentage = (int)*char_pointer;
ESP_LOGI(BLE_TAG, "(p_data->read.value) Battery level: %d %%",battery_percentage);
ESP_LOGI(BLE_TAG, "p_data->read.value_len %d",p_data->read.value_len);
break;
case ESP_GATTC_READ_DESCR_EVT:
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_READ_DESCR_EVT");
if (p_data->read.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)read descr failed, error status = %x", p_data->write.status);
break;
}
ESP_LOGI(BLE_TAG, "(battery)read descr success ");
esp_gatt_status_t ret_status = esp_ble_gattc_read_char( gattc_if,
gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id,
gl_profile_tab[PROFILE_BATTERY_SERVICE].char_handle,
ESP_GATT_AUTH_REQ_NONE);
if(ret_status){
ESP_LOGE(BLE_TAG, "(battery) esp_ble_gattc_read_char failed, error code = %x", ret_status);
}else{
ESP_LOGI(BLE_TAG, "(battery) esp_ble_gattc_read_char success ");
}
break;
case ESP_GATTC_WRITE_DESCR_EVT:
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_WRITE_DESCR_EVT");
// NO PERMISSION TO WRITE VALUE ON BATTERY SERVICE
// if (p_data->write.status != ESP_GATT_OK){
// ESP_LOGE(BLE_TAG, "(battery)write descr failed, error status = %x", p_data->write.status);
// break;
// }
// ESP_LOGI(BLE_TAG, "(battery)write descr success ");
// uint8_t write_char_data[35];
// for (int i = 0; i < sizeof(write_char_data); ++i)
// {
// write_char_data[i] = i % 256;
// }
// esp_ble_gattc_write_char( gattc_if,
// gl_profile_tab[PROFILE_BATTERY_SERVICE].conn_id,
// gl_profile_tab[PROFILE_BATTERY_SERVICE].char_handle,
// sizeof(write_char_data),
// write_char_data,
// ESP_GATT_WRITE_TYPE_RSP,
// ESP_GATT_AUTH_REQ_NONE);
break;
case ESP_GATTC_SRVC_CHG_EVT: {
esp_bd_addr_t bda;
memcpy(bda, p_data->srvc_chg.remote_bda, sizeof(esp_bd_addr_t));
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
esp_log_buffer_hex(BLE_TAG, bda, sizeof(esp_bd_addr_t));
break;
}
case ESP_GATTC_WRITE_CHAR_EVT:
if (p_data->write.status != ESP_GATT_OK){
ESP_LOGE(BLE_TAG, "(battery)write char failed, error status = %x", p_data->write.status);
break;
}
ESP_LOGI(BLE_TAG, "(battery)write char success ");
break;
case ESP_GATTC_DISCONNECT_EVT:
connect_ble = false;
get_server = false;
ESP_LOGI(BLE_TAG, "(battery)ESP_GATTC_DISCONNECT_EVT, reason = %d", p_data->disconnect.reason);
break;
default:
ESP_LOGI(BLE_TAG, "unregistered EVT:%d", event);
break;
}
}
And here is full log:
Code: Select all
[2018-05-22_13:16:37]ets Jun 8 2016 00:22:57
[2018-05-22_13:16:37]rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[2018-05-22_13:16:37]ets Jun 8 2016 00:22:57
[2018-05-22_13:16:37]rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[2018-05-22_13:16:37]configsip: 0, SPIWP:0xee
[2018-05-22_13:16:37]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[2018-05-22_13:16:37]mode:DIO, clock div:2
[2018-05-22_13:16:37]load:0x3fff0018,len:4
[2018-05-22_13:16:37]load:0x3fff001c,len:5672
[2018-05-22_13:16:37]load:0x40078000,len:0
[2018-05-22_13:16:37]ho 12 tail 0 room 4
[2018-05-22_13:16:37]load:0x40078000,len:13912
[2018-05-22_13:16:37]entry 0x40078fd8
[2018-05-22_13:16:37][0;32mI (31) boot: ESP-IDF v3.1-dev-578-g9ea38560 2nd stage bootloader[0m
[2018-05-22_13:16:37][0;32mI (31) boot: compile time 19:20:37[0m
[2018-05-22_13:16:37][0;32mI (31) boot: Enabling RNG early entropy source...[0m
[2018-05-22_13:16:37][0;32mI (37) boot: SPI Speed : 40MHz[0m
[2018-05-22_13:16:37][0;32mI (41) boot: SPI Mode : DIO[0m
[2018-05-22_13:16:37][0;32mI (45) boot: SPI Flash Size : 4MB[0m
[2018-05-22_13:16:37][0;32mI (49) boot: Partition Table:[0m
[2018-05-22_13:16:37][0;32mI (52) boot: ## Label Usage Type ST Offset Length[0m
[2018-05-22_13:16:37][0;32mI (60) boot: 0 nvs WiFi data 01 02 00009000 00006000[0m
[2018-05-22_13:16:37][0;32mI (67) boot: 1 phy_init RF data 01 01 0000f000 00001000[0m
[2018-05-22_13:16:37][0;32mI (75) boot: 2 factory factory app 00 00 00010000 00200000[0m
[2018-05-22_13:16:37][0;32mI (82) boot: End of partition table[0m
[2018-05-22_13:16:37][0;32mI (86) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x331c4 (209348) map[0m
[2018-05-22_13:16:37][0;32mI (168) esp_image: segment 1: paddr=0x000431ec vaddr=0x3ffc0000 size=0x029d4 ( 10708) load[0m
[2018-05-22_13:16:37][0;32mI (172) esp_image: segment 2: paddr=0x00045bc8 vaddr=0x40080000 size=0x00400 ( 1024) load[0m
[2018-05-22_13:16:37][0;32mI (175) esp_image: segment 3: paddr=0x00045fd0 vaddr=0x40080400 size=0x0a040 ( 41024) load[0m
[2018-05-22_13:16:37][0;32mI (200) esp_image: segment 4: paddr=0x00050018 vaddr=0x400d0018 size=0x7f9d8 (522712) map[0m
[2018-05-22_13:16:37][0;32mI (382) esp_image: segment 5: paddr=0x000cf9f8 vaddr=0x4008a440 size=0x036a0 ( 13984) load[0m
[2018-05-22_13:16:37][0;32mI (388) esp_image: segment 6: paddr=0x000d30a0 vaddr=0x400c0000 size=0x00000 ( 0) load[0m
[2018-05-22_13:16:38][0;32mI (397) boot: Loaded app from partition at offset 0x10000[0m
[2018-05-22_13:16:38][0;32mI (397) boot: Disabling RNG early entropy source...[0m
[2018-05-22_13:16:38][0;32mI (401) cpu_start: Pro cpu up.[0m
[2018-05-22_13:16:38][0;32mI (404) cpu_start: Starting app cpu, entry point is 0x40080f38[0m
[2018-05-22_13:16:38][0;32mI (0) cpu_start: App cpu up.[0m
[2018-05-22_13:16:38][0;32mI (415) heap_init: Initializing. RAM available for dynamic allocation:[0m
[2018-05-22_13:16:38][0;32mI (421) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM[0m
[2018-05-22_13:16:38][0;32mI (428) heap_init: At 3FFCF258 len 00010DA8 (67 KiB): DRAM[0m
[2018-05-22_13:16:38][0;32mI (434) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[2018-05-22_13:16:38][0;32mI (440) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[2018-05-22_13:16:38][0;32mI (446) heap_init: At 4008DAE0 len 00012520 (73 KiB): IRAM[0m
[2018-05-22_13:16:38][0;32mI (453) cpu_start: Pro cpu start user code[0m
[2018-05-22_13:16:38][0;32mI (135) cpu_start: Starting scheduler on PRO CPU.[0m
[2018-05-22_13:16:38][0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
[2018-05-22_13:16:38]This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 0, 4MB external flash
[2018-05-22_13:16:38]ID:30_AE_A4_06_95_90
[2018-05-22_13:16:38][0;32mI (205) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE[0m
[2018-05-22_13:16:38][0;32mI (505) phy: phy_version: 383.0, 79a622c, Jan 30 2018, 15:38:06, 0, 0[0m
[2018-05-22_13:16:38][0;32mI (545) BLE: (battery)REG_EVT[0m
[2018-05-22_13:16:38][0;32mI (545) BLE: scan start success[0m
[2018-05-22_13:16:38][0;32mI (975) BLE: e2 04 59 ac ac a7 [0m
[2018-05-22_13:16:38][0;32mI (975) BLE: searched Adv Data Len 27, Scan Response Len 0[0m
[2018-05-22_13:16:38][0;32mI (975) BLE: searched Device Name Len 10[0m
[2018-05-22_13:16:38][0;32mI (985) BLE: Nordic_HRM[0m
[2018-05-22_13:16:38][0;32mI (985) BLE:
[2018-05-22_13:16:38][0m
[2018-05-22_13:16:38][0;32mI (985) BLE: searched device Nordic_HRM
[2018-05-22_13:16:38][0m
[2018-05-22_13:16:38][0;32mI (995) BLE: connect to the remote device.[0m
[2018-05-22_13:16:38][0;32mI (1005) BLE: stop scan successfully[0m
[2018-05-22_13:16:39][0;32mI (1185) BLE: (battery)ESP_GATTC_CONNECT_EVT conn_id 0, if 2[0m
[2018-05-22_13:16:39][0;32mI (1185) BLE: (battery)REMOTE BDA:[0m
[2018-05-22_13:16:39][0;32mI (1185) BLE: e2 04 59 ac ac a7 [0m
[2018-05-22_13:16:39][0;32mI (1195) BLE: (battery)open success[0m
[2018-05-22_13:16:39][0;32mI (1875) BLE: (battery)ESP_GATTC_CFG_MTU_EVT, Status 0, MTU 247, conn_id 0[0m
[2018-05-22_13:16:39][0;32mI (1875) BLE: (battery)service found[0m
[2018-05-22_13:16:39][0;32mI (1875) BLE: (battery)ESP_GATTC_SEARCH_RES_EVT[0m
[2018-05-22_13:16:39][0;32mI (1875) BLE: UUID16: 180f[0m
[2018-05-22_13:16:39][0;32mI (1885) BLE: (battery)srvc_id_len:2 [2][0m
[2018-05-22_13:16:39][0;32mI (1885) BLE: (battery)service found[0m
[2018-05-22_13:16:39][0;32mI (1895) BLE: (battery)UUID16: 180f[0m
[2018-05-22_13:16:39][0;32mI (1895) BLE: (battery)ESP_GATTC_SEARCH_CMPL_EVT[0m
[2018-05-22_13:16:39][0;32mI (1905) BLE: (battery)get_server[0m
[2018-05-22_13:16:39][0;32mI (1905) BLE: (battery)esp_ble_gattc_register_for_notify success[0m
[2018-05-22_13:16:39][0;32mI (1915) BLE: (battery)ESP_GATTC_REG_FOR_NOTIFY_EVT[0m
[2018-05-22_13:16:39][0;32mI (1945) BLE: (battery)ESP_GATTC_READ_DESCR_EVT[0m
[2018-05-22_13:16:39][0;32mI (1945) BLE: (battery)read descr success [0m
[2018-05-22_13:16:39][0;32mI (1945) BLE: (battery) esp_ble_gattc_read_char success [0m
[2018-05-22_13:16:39][0;32mI (1975) BLE: (battery)ESP_GATTC_READ_CHAR_EVT[0m
[2018-05-22_13:16:39][0;32mI (1975) BLE: (p_data->read.value) Battery level: 91 %[0m
[2018-05-22_13:16:39][0;32mI (1975) BLE: p_data->read.value_len 1[0m
[2018-05-22_13:16:40][0;31mE (2205) BT: bta_gattc_cmpl_cback unknown conn_id = 1, ignore data[0m
[2018-05-22_13:17:09][0;31mE (31195) BT: bta_gattc_conn_cback() - cif=1 connected=0 conn_id=1 reason=0x0013[0m
[2018-05-22_13:17:09][0;31mE (31195) BT: bta_gattc_conn_cback() - cif=2 connected=0 conn_id=2 reason=0x0013[0m
[2018-05-22_13:17:09][0;32mI (31205) BLE: (battery)ESP_GATTC_DISCONNECT_EVT, reason = 19[0m
[2018-05-22_13:17:09][0;32mI (31215) BLE: unregistered EVT:5[0m
Regards