mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(all): Remove usage old log macros
This commit is contained in:
parent
8823e1bc84
commit
668886842f
@ -189,7 +189,6 @@ tGATT_STATUS gatts_calculate_datebase_hash(BT_OCTET16 hash)
|
||||
#if SMP_INCLUDED == TRUE
|
||||
BT_OCTET16 key = {0};
|
||||
aes_cipher_msg_auth_code(key, data_buf, len, 16, hash);
|
||||
//ESP_LOG_BUFFER_HEX("db hash", hash, BT_OCTET16_LEN);
|
||||
#endif
|
||||
|
||||
osi_free(data_buf);
|
||||
|
@ -806,7 +806,7 @@ static esp_err_t start_command_read_blocks(slot_info_t *slot, sdspi_hw_cmd_t *cm
|
||||
crc_of_data = sdspi_crc16(data, will_receive + extra_data_size);
|
||||
if (crc_of_data != crc) {
|
||||
ESP_LOGE(TAG, "data CRC failed, got=0x%04x expected=0x%04x", crc_of_data, crc);
|
||||
esp_log_buffer_hex(TAG, data, 16);
|
||||
ESP_LOG_BUFFER_HEX(TAG, data, 16);
|
||||
return ESP_ERR_INVALID_CRC;
|
||||
}
|
||||
}
|
||||
|
@ -1543,7 +1543,6 @@ void test_add_device_master(void)
|
||||
|
||||
ESP_LOGI("Master", "dev %d communication:", i);
|
||||
ESP_LOG_BUFFER_HEX("Tx", master_sendbuf, sizeof(master_sendbuf));
|
||||
// ESP_LOG_BUFFER_HEX("Rx", master_recvbuf, sizeof(master_recvbuf));
|
||||
spitest_cmp_or_dump(master_expect, master_recvbuf, TEST_TRANS_LEN);
|
||||
|
||||
//swap self as a dummy device to free real cs line
|
||||
@ -1586,7 +1585,6 @@ void test_add_device_slave(void)
|
||||
|
||||
ESP_LOGI("Slave", "dev %d communication:", i);
|
||||
ESP_LOG_BUFFER_HEX("Tx", slave_sendbuf, sizeof(slave_sendbuf));
|
||||
// ESP_LOG_BUFFER_HEX("Rx", slave_recvbuf, sizeof(slave_recvbuf));
|
||||
spitest_cmp_or_dump(slave_expect, slave_recvbuf, TEST_TRANS_LEN);
|
||||
}
|
||||
|
||||
|
@ -639,12 +639,6 @@ TEST_CASE("Slave receive correct data", "[spi]")
|
||||
slave_cmpbuf[i] = rand_r(&slave_seed_cmp);
|
||||
}
|
||||
|
||||
// esp_log_buffer_hex("master_send", master_sendbuf, buf_size);
|
||||
// esp_log_buffer_hex("slave_recv", slave_recvbuf, buf_size);
|
||||
|
||||
// esp_log_buffer_hex("slave_send", slave_sendbuf, buf_size);
|
||||
// esp_log_buffer_hex("master_recv", master_recvbuf, buf_size);
|
||||
|
||||
int master_expected_len = MIN(master_trans_len, slave_trans_len);
|
||||
TEST_ASSERT_EQUAL_HEX8_ARRAY(master_cmpbuf, master_recvbuf, master_expected_len);
|
||||
|
||||
|
@ -381,8 +381,6 @@ static void test_hd_loop(const void* arg1, void* arg2)
|
||||
wait_rdbuf_sig(context, portMAX_DELAY);
|
||||
|
||||
ESP_LOGI("mem", "pos: %d, len: %d", pos, len);
|
||||
// ESP_LOG_BUFFER_HEX("recv_buffer", recv_buffer, len);
|
||||
// ESP_LOG_BUFFER_HEX("mem", &mem_ptr[pos], len);
|
||||
TEST_ASSERT_EQUAL_HEX8_ARRAY(&mem_ptr[pos], recv_buffer, len);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void esp_log_buffer_hexdump_internal(const char *tag, const void *buffer, uint16
|
||||
* @deprecated This function is deprecated and will be removed in the future.
|
||||
* Please use ESP_LOG_BUFFER_HEX
|
||||
*/
|
||||
// __attribute__((deprecated("Use 'ESP_LOG_BUFFER_HEX' instead")))
|
||||
__attribute__((deprecated("Use 'ESP_LOG_BUFFER_HEX' instead")))
|
||||
static inline void esp_log_buffer_hex(const char *tag, const void *buffer, uint16_t buff_len)
|
||||
{
|
||||
ESP_LOG_BUFFER_HEX(tag, buffer, buff_len);
|
||||
@ -166,7 +166,7 @@ static inline void esp_log_buffer_hex(const char *tag, const void *buffer, uint1
|
||||
* @deprecated This function is deprecated and will be removed in the future.
|
||||
* Please use ESP_LOG_BUFFER_CHAR
|
||||
*/
|
||||
// __attribute__((deprecated("Use 'ESP_LOG_BUFFER_CHAR' instead")))
|
||||
__attribute__((deprecated("Use 'ESP_LOG_BUFFER_CHAR' instead")))
|
||||
static inline void esp_log_buffer_char(const char *tag, const void *buffer, uint16_t buff_len)
|
||||
{
|
||||
ESP_LOG_BUFFER_CHAR(tag, buffer, buff_len);
|
||||
|
@ -13,3 +13,4 @@ ESP-IDF 5.x Migration Guide
|
||||
release-5.x/5.1/index
|
||||
release-5.x/5.2/index
|
||||
release-5.x/5.3/index
|
||||
release-5.x/5.4/index
|
||||
|
9
docs/en/migration-guides/release-5.x/5.4/index.rst
Normal file
9
docs/en/migration-guides/release-5.x/5.4/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
Migration from 5.3 to 5.4
|
||||
-------------------------
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
system
|
10
docs/en/migration-guides/release-5.x/5.4/system.rst
Normal file
10
docs/en/migration-guides/release-5.x/5.4/system.rst
Normal file
@ -0,0 +1,10 @@
|
||||
System
|
||||
======
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
Log
|
||||
---
|
||||
|
||||
- `esp_log_buffer_hex` is deprecated, use `ESP_LOG_BUFFER_HEX` instead.
|
||||
- `esp_log_buffer_char` is deprecated, use `ESP_LOG_BUFFER_CHAR` instead.
|
@ -13,3 +13,4 @@
|
||||
release-5.x/5.1/index
|
||||
release-5.x/5.2/index
|
||||
release-5.x/5.3/index
|
||||
release-5.x/5.4/index
|
||||
|
9
docs/zh_CN/migration-guides/release-5.x/5.4/index.rst
Normal file
9
docs/zh_CN/migration-guides/release-5.x/5.4/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
从 5.3 迁移到 5.4
|
||||
-----------------
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
system
|
10
docs/zh_CN/migration-guides/release-5.x/5.4/system.rst
Normal file
10
docs/zh_CN/migration-guides/release-5.x/5.4/system.rst
Normal file
@ -0,0 +1,10 @@
|
||||
系统
|
||||
======
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
Log
|
||||
---
|
||||
|
||||
- `esp_log_buffer_hex` 已弃用,应使用 `ESP_LOG_BUFFER_HEX` 替代。
|
||||
- `esp_log_buffer_char` 已弃用,应使用 `ESP_LOG_BUFFER_CHAR` 替代。
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -119,7 +119,6 @@ void esp_receive_apple_notification_source(uint8_t *message, uint16_t message_le
|
||||
|
||||
void esp_receive_apple_data_source(uint8_t *message, uint16_t message_len)
|
||||
{
|
||||
//esp_log_buffer_hex("data source", message, message_len);
|
||||
if (!message || message_len == 0) {
|
||||
return;
|
||||
}
|
||||
@ -141,32 +140,32 @@ void esp_receive_apple_data_source(uint8_t *message, uint16_t message_len)
|
||||
switch (AttributeID)
|
||||
{
|
||||
case NotificationAttributeIDAppIdentifier:
|
||||
esp_log_buffer_char("Identifier", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_CHAR("Identifier", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDTitle:
|
||||
esp_log_buffer_char("Title", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_CHAR("Title", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDSubtitle:
|
||||
esp_log_buffer_char("Subtitle", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_CHAR("Subtitle", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDMessage:
|
||||
esp_log_buffer_char("Message", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_CHAR("Message", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDMessageSize:
|
||||
esp_log_buffer_char("MessageSize", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_CHAR("MessageSize", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDDate:
|
||||
//yyyyMMdd'T'HHmmSS
|
||||
esp_log_buffer_char("Date", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_CHAR("Date", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDPositiveActionLabel:
|
||||
esp_log_buffer_hex("PActionLabel", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_HEX("PActionLabel", &attrs[3], len);
|
||||
break;
|
||||
case NotificationAttributeIDNegativeActionLabel:
|
||||
esp_log_buffer_hex("NActionLabel", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_HEX("NActionLabel", &attrs[3], len);
|
||||
break;
|
||||
default:
|
||||
esp_log_buffer_hex("unknownAttributeID", &attrs[3], len);
|
||||
ESP_LOG_BUFFER_HEX("unknownAttributeID", &attrs[3], len);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -294,7 +294,7 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
ESP_LOGI(BLE_ANCS_TAG, "The passkey Notify number:%06" PRIu32, param->ble_security.key_notif.passkey);
|
||||
break;
|
||||
case ESP_GAP_BLE_AUTH_CMPL_EVT: {
|
||||
esp_log_buffer_hex("addr", param->ble_security.auth_cmpl.bd_addr, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX("addr", param->ble_security.auth_cmpl.bd_addr, ESP_BD_ADDR_LEN);
|
||||
ESP_LOGI(BLE_ANCS_TAG, "pair status = %s",param->ble_security.auth_cmpl.success ? "success" : "fail");
|
||||
if (!param->ble_security.auth_cmpl.success) {
|
||||
ESP_LOGI(BLE_ANCS_TAG, "fail reason = 0x%x",param->ble_security.auth_cmpl.fail_reason);
|
||||
@ -504,7 +504,6 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
//esp_log_buffer_hex(BLE_ANCS_TAG, param->notify.value, param->notify.value_len);
|
||||
if (param->notify.handle == gl_profile_tab[PROFILE_A_APP_ID].notification_source_handle) {
|
||||
esp_receive_apple_notification_source(param->notify.value, param->notify.value_len);
|
||||
uint8_t *notificationUID = ¶m->notify.value[4];
|
||||
@ -542,7 +541,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
break;
|
||||
case ESP_GATTC_SRVC_CHG_EVT: {
|
||||
ESP_LOGI(BLE_ANCS_TAG, "ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
|
||||
esp_log_buffer_hex(BLE_ANCS_TAG, param->srvc_chg.remote_bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(BLE_ANCS_TAG, param->srvc_chg.remote_bda, 6);
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_WRITE_CHAR_EVT:
|
||||
@ -562,7 +561,6 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
break;
|
||||
case ESP_GATTC_CONNECT_EVT:
|
||||
//ESP_LOGI(BLE_ANCS_TAG, "ESP_GATTC_CONNECT_EVT");
|
||||
//esp_log_buffer_hex("bda", param->connect.remote_bda, 6);
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, param->connect.remote_bda, 6);
|
||||
// create gattc virtual connection
|
||||
esp_ble_gattc_open(gl_profile_tab[PROFILE_A_APP_ID].gattc_if, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, BLE_ADDR_TYPE_RANDOM, true);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -263,7 +263,7 @@ static void show_bonded_devices(void)
|
||||
EXAMPLE_DEBUG(EXAMPLE_TAG, "Bonded devices list : %d\n", dev_num);
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
#if DEBUG_ON
|
||||
esp_log_buffer_hex(EXAMPLE_TAG, (void *)dev_list[i].bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(EXAMPLE_TAG, (void *)dev_list[i].bd_addr, sizeof(esp_bd_addr_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -388,7 +388,7 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
case ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT: {
|
||||
EXAMPLE_DEBUG(EXAMPLE_TAG, "ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT status = %d", param->remove_bond_dev_cmpl.status);
|
||||
#if DEBUG_ON
|
||||
esp_log_buffer_hex(EXAMPLE_TAG, (void *)param->remove_bond_dev_cmpl.bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(EXAMPLE_TAG, (void *)param->remove_bond_dev_cmpl.bd_addr, sizeof(esp_bd_addr_t));
|
||||
#endif
|
||||
EXAMPLE_DEBUG(EXAMPLE_TAG, "------------------------------------");
|
||||
break;
|
||||
@ -541,7 +541,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
|
||||
ESP_LOGI(EXAMPLE_TAG, "notify/indicate disable ");
|
||||
}else{
|
||||
ESP_LOGE(EXAMPLE_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(EXAMPLE_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(EXAMPLE_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ static void esp_eddystone_show_inform(const esp_eddystone_result_t* res)
|
||||
ESP_LOGI(DEMO_TAG, "Eddystone UID inform:");
|
||||
ESP_LOGI(DEMO_TAG, "Measured power(RSSI at 0m distance):%d dbm", res->inform.uid.ranging_data);
|
||||
ESP_LOGI(DEMO_TAG, "EDDYSTONE_DEMO: Namespace ID:0x");
|
||||
esp_log_buffer_hex(DEMO_TAG, res->inform.uid.namespace_id, 10);
|
||||
ESP_LOG_BUFFER_HEX(DEMO_TAG, res->inform.uid.namespace_id, 10);
|
||||
ESP_LOGI(DEMO_TAG, "EDDYSTONE_DEMO: Instance ID:0x");
|
||||
esp_log_buffer_hex(DEMO_TAG, res->inform.uid.instance_id, 6);
|
||||
ESP_LOG_BUFFER_HEX(DEMO_TAG, res->inform.uid.instance_id, 6);
|
||||
break;
|
||||
}
|
||||
case EDDYSTONE_FRAME_TYPE_URL: {
|
||||
@ -114,7 +114,7 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* par
|
||||
// Here, we get the eddystone information in eddystone_res, we can use the data in res to do other things.
|
||||
// For example, just print them:
|
||||
ESP_LOGI(DEMO_TAG, "--------Eddystone Found----------");
|
||||
esp_log_buffer_hex("EDDYSTONE_DEMO: Device address:", scan_result->scan_rst.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX("EDDYSTONE_DEMO: Device address:", scan_result->scan_rst.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOGI(DEMO_TAG, "RSSI of packet:%d dbm", scan_result->scan_rst.rssi);
|
||||
esp_eddystone_show_inform(&eddystone_res);
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
if (esp_ble_is_ibeacon_packet(scan_result->scan_rst.ble_adv, scan_result->scan_rst.adv_data_len)){
|
||||
esp_ble_ibeacon_t *ibeacon_data = (esp_ble_ibeacon_t*)(scan_result->scan_rst.ble_adv);
|
||||
ESP_LOGI(DEMO_TAG, "----------iBeacon Found----------");
|
||||
esp_log_buffer_hex("IBEACON_DEMO: Device address:", scan_result->scan_rst.bda, ESP_BD_ADDR_LEN );
|
||||
esp_log_buffer_hex("IBEACON_DEMO: Proximity UUID:", ibeacon_data->ibeacon_vendor.proximity_uuid, ESP_UUID_LEN_128);
|
||||
ESP_LOG_BUFFER_HEX("IBEACON_DEMO: Device address:", scan_result->scan_rst.bda, ESP_BD_ADDR_LEN );
|
||||
ESP_LOG_BUFFER_HEX("IBEACON_DEMO: Proximity UUID:", ibeacon_data->ibeacon_vendor.proximity_uuid, ESP_UUID_LEN_128);
|
||||
|
||||
uint16_t major = ENDIAN_CHANGE_U16(ibeacon_data->ibeacon_vendor.major);
|
||||
uint16_t minor = ENDIAN_CHANGE_U16(ibeacon_data->ibeacon_vendor.minor);
|
||||
|
@ -133,7 +133,7 @@ static void notify_event_handler(esp_ble_gattc_cb_param_t * p_data)
|
||||
}
|
||||
if(handle == db[SPP_IDX_SPP_DATA_NTY_VAL].attribute_handle){
|
||||
#ifdef SPP_DEBUG_MODE
|
||||
esp_log_buffer_char(GATTC_TAG, (char *)p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, (char *)p_data->notify.value, p_data->notify.value_len);
|
||||
#else
|
||||
if((p_data->notify.value[0] == '#')&&(p_data->notify.value[1] == '#')){
|
||||
if((++notify_value_count) != p_data->notify.value[3]){
|
||||
@ -179,10 +179,10 @@ static void notify_event_handler(esp_ble_gattc_cb_param_t * p_data)
|
||||
}
|
||||
#endif
|
||||
}else if(handle == ((db+SPP_IDX_SPP_STATUS_VAL)->attribute_handle)){
|
||||
esp_log_buffer_char(GATTC_TAG, (char *)p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, (char *)p_data->notify.value, p_data->notify.value_len);
|
||||
//TODO:server notify status characteristic
|
||||
}else{
|
||||
esp_log_buffer_char(GATTC_TAG, (char *)p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, (char *)p_data->notify.value, p_data->notify.value_len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,11 +245,11 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
|
||||
switch (scan_result->scan_rst.search_evt) {
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOGI(GATTC_TAG, "Searched Adv Data Len %d, Scan Response Len %d", scan_result->scan_rst.adv_data_len, scan_result->scan_rst.scan_rsp_len);
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv, ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "Searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, " ");
|
||||
if (adv_name != NULL) {
|
||||
if ( strncmp((char *)adv_name, device_name, adv_name_len) == 0) {
|
||||
@ -317,7 +317,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
case ESP_GATTC_CONNECT_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_CONNECT_EVT: conn_id=%d, gatt_if = %d", spp_conn_id, gattc_if);
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
spp_gattc_if = gattc_if;
|
||||
is_connect = true;
|
||||
spp_conn_id = p_data->connect.conn_id;
|
||||
|
@ -451,7 +451,7 @@ void spp_cmd_task(void * arg)
|
||||
for(;;){
|
||||
vTaskDelay(50 / portTICK_PERIOD_MS);
|
||||
if(xQueueReceive(cmd_cmd_queue, &cmd_id, portMAX_DELAY)) {
|
||||
esp_log_buffer_char(GATTS_TABLE_TAG,(char *)(cmd_id),strlen((char *)cmd_id));
|
||||
ESP_LOG_BUFFER_CHAR(GATTS_TABLE_TAG,(char *)(cmd_id),strlen((char *)cmd_id));
|
||||
free(cmd_id);
|
||||
}
|
||||
}
|
||||
@ -550,7 +550,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
|
||||
#endif
|
||||
else if(res == SPP_IDX_SPP_DATA_RECV_VAL){
|
||||
#ifdef SPP_DEBUG_MODE
|
||||
esp_log_buffer_char(GATTS_TABLE_TAG,(char *)(p_data->write.value),p_data->write.len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTS_TABLE_TAG,(char *)(p_data->write.value),p_data->write.len);
|
||||
#else
|
||||
uart_write_bytes(UART_NUM_0, (char *)(p_data->write.value), p_data->write.len);
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -155,7 +155,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].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(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -334,7 +334,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
esp_bd_addr_t bda;
|
||||
memcpy(bda, p_data->srvc_chg.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
|
||||
esp_log_buffer_hex(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_WRITE_CHAR_EVT:
|
||||
@ -393,12 +393,12 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
|
||||
switch (scan_result->scan_rst.search_evt) {
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOGI(GATTC_TAG, "searched Adv Data Len %d, Scan Response Len %d", scan_result->scan_rst.adv_data_len, scan_result->scan_rst.scan_rsp_len);
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv,
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, " ");
|
||||
if (adv_name != NULL) {
|
||||
if (strlen(remote_device_name) == adv_name_len && strncmp((char *)adv_name, remote_device_name, adv_name_len) == 0) {
|
||||
|
@ -428,7 +428,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(GATTS_TAG, "notify/indicate disable ");
|
||||
}else{
|
||||
ESP_LOGE(GATTS_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].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(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -278,7 +278,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
}else{
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, receive indicate value:");
|
||||
}
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK){
|
||||
@ -303,7 +303,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
esp_bd_addr_t bda;
|
||||
memcpy(bda, p_data->srvc_chg.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
|
||||
esp_log_buffer_hex(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_WRITE_CHAR_EVT:
|
||||
@ -347,21 +347,21 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
|
||||
switch (scan_result->scan_rst.search_evt) {
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOGI(GATTC_TAG, "searched Adv Data Len %d, Scan Response Len %d", scan_result->scan_rst.adv_data_len, scan_result->scan_rst.scan_rsp_len);
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv,
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
|
||||
#if CONFIG_EXAMPLE_DUMP_ADV_DATA_AND_SCAN_RESP
|
||||
if (scan_result->scan_rst.adv_data_len > 0) {
|
||||
ESP_LOGI(GATTC_TAG, "adv data:");
|
||||
esp_log_buffer_hex(GATTC_TAG, &scan_result->scan_rst.ble_adv[0], scan_result->scan_rst.adv_data_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, &scan_result->scan_rst.ble_adv[0], scan_result->scan_rst.adv_data_len);
|
||||
}
|
||||
if (scan_result->scan_rst.scan_rsp_len > 0) {
|
||||
ESP_LOGI(GATTC_TAG, "scan resp:");
|
||||
esp_log_buffer_hex(GATTC_TAG, &scan_result->scan_rst.ble_adv[scan_result->scan_rst.adv_data_len], scan_result->scan_rst.scan_rsp_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, &scan_result->scan_rst.ble_adv[scan_result->scan_rst.adv_data_len], scan_result->scan_rst.scan_rsp_len);
|
||||
}
|
||||
#endif
|
||||
ESP_LOGI(GATTC_TAG, " ");
|
||||
|
@ -357,11 +357,11 @@ We are interested in the `ESP_GAP_SEARCH_INQ_RES_EVT` event, which is called eve
|
||||
esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
|
||||
switch (scan_result->scan_rst.search_evt) {
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOGI(GATTC_TAG, "searched Adv Data Len %d, Scan Response Len %d", scan_result->scan_rst.adv_data_len, scan_result->scan_rst.scan_rsp_len);
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv, ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, " ");
|
||||
if (adv_name != NULL) {
|
||||
if (strlen(remote_device_name) == adv_name_len && strncmp((char *)adv_name, remote_device_name, adv_name_len) == 0) {
|
||||
@ -386,7 +386,7 @@ Every time we receive a result from the `ESP_GAP_SEARCH_INQ_RES_EVT` event, the
|
||||
|
||||
```c
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
```
|
||||
|
||||
The client then prints the advertised data length and the scan response length:
|
||||
@ -400,7 +400,7 @@ In order to get the device name, we use the `esp_ble_resolve_adv_data()` functio
|
||||
```c
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv, ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
```
|
||||
|
||||
Finally if the remote device name is the same as we have defined above, the local device stops scanning and tries to open a connection to the remote device using the `esp_ble_gattc_open()` function. This function takes as parameters the Application Profile GATT interface, the remote server address and a boolean value. The boolean value is used to indicate if the connection is done directly or if it’s done in the background (auto-connection), at the moment this boolean value must be set to true in order to establish the connection. Notice that the client opens a virtual connection to the server. The virtual connection returns a connection ID. The virtual connection is the connection between the Application Profile and the remote server. Since many Application Profiles can run on one ESP32, there could be many virtual connection opened to the same remote server. There is also the physical connection which is the actual BLE link between the client and the server. Therefore, if the physical connection is disconnected with the `esp_ble_gap_disconnect()` function, all other virtual connections are closed as well. In this example, each Application Profile creates a virtual connection to the same server with the `esp_ble_gattc_open()` function, so when the close function is called, only that connection from the Application Profile is closed, while if the gap disconnect function is called, both connections will be closed. In addition, connect events are propagated to all profiles because it relates to the physical connection, while open events are propagated only to the profile that creates the virtual connection.
|
||||
@ -417,7 +417,7 @@ ATT_MTU is defined as the maximum size of any packet sent between a client and a
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, conn_id);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -433,7 +433,7 @@ gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->connect.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->connect.remote_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda,
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda,
|
||||
sizeof(esp_bd_addr_t));
|
||||
```
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -179,7 +179,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->open.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, p_data->open.conn_id);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -332,7 +332,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
}
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, receive notify value:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK){
|
||||
@ -345,7 +345,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
esp_bd_addr_t bda;
|
||||
memcpy(bda, p_data->srvc_chg.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
|
||||
esp_log_buffer_hex(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_WRITE_CHAR_EVT:
|
||||
@ -449,12 +449,12 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
|
||||
switch (scan_result->scan_rst.search_evt) {
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOGI(GATTC_TAG, "Searched Adv Data Len %d, Scan Response Len %d", scan_result->scan_rst.adv_data_len, scan_result->scan_rst.scan_rsp_len);
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv,
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "Searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, " ");
|
||||
if (adv_name != NULL) {
|
||||
if (strlen(remote_device_name) == adv_name_len && strncmp((char *)adv_name, remote_device_name, adv_name_len) == 0) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -272,7 +272,7 @@ static void show_bonded_devices(void)
|
||||
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "Bonded devices list : %d", dev_num);
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, (void *)dev_list[i].bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, (void *)dev_list[i].bd_addr, sizeof(esp_bd_addr_t));
|
||||
}
|
||||
|
||||
free(dev_list);
|
||||
@ -380,7 +380,7 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
ESP_LOGD(GATTS_TABLE_TAG, "ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT status = %d", param->remove_bond_dev_cmpl.status);
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GAP_BLE_REMOVE_BOND_DEV");
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "-----ESP_GAP_BLE_REMOVE_BOND_DEV----");
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, (void *)param->remove_bond_dev_cmpl.bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, (void *)param->remove_bond_dev_cmpl.bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "------------------------------------");
|
||||
break;
|
||||
}
|
||||
@ -426,7 +426,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event,
|
||||
break;
|
||||
case ESP_GATTS_WRITE_EVT:
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_WRITE_EVT, write value:");
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
break;
|
||||
case ESP_GATTS_EXEC_WRITE_EVT:
|
||||
break;
|
||||
|
@ -296,7 +296,7 @@ void example_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t *prepare
|
||||
|
||||
void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param){
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC){
|
||||
esp_log_buffer_hex(GATTS_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
}else{
|
||||
ESP_LOGI(GATTS_TAG,"ESP_GATT_PREP_WRITE_CANCEL");
|
||||
}
|
||||
@ -366,7 +366,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %" PRIu32 ", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_A_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value = param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -398,7 +398,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(GATTS_TAG, "notify/indicate disable ");
|
||||
}else{
|
||||
ESP_LOGE(GATTS_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
@ -496,7 +496,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT, status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK){
|
||||
esp_log_buffer_hex(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_OPEN_EVT:
|
||||
@ -538,7 +538,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %" PRIu32 ", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_B_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value= param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -639,7 +639,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK){
|
||||
esp_log_buffer_hex(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_DISCONNECT_EVT:
|
||||
|
@ -721,7 +721,7 @@ case ESP_GATTS_WRITE_EVT: {
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_B_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value= param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -920,7 +920,7 @@ Let’s take a look at the Executive Write function:
|
||||
```c
|
||||
void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param){
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC){
|
||||
esp_log_buffer_hex(GATTS_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
}
|
||||
else{
|
||||
ESP_LOGI(GATTS_TAG,"ESP_GATT_PREP_WRITE_CANCEL");
|
||||
@ -937,7 +937,7 @@ The executive write is used to either confirm or cancel the write procedure done
|
||||
|
||||
```c
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC){
|
||||
esp_log_buffer_hex(GATTS_TAG,
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG,
|
||||
prepare_write_env->prepare_buf,
|
||||
prepare_write_env->prepare_len);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -327,7 +327,7 @@ void example_prepare_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t
|
||||
|
||||
void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param){
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC && prepare_write_env->prepare_buf){
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
}else{
|
||||
ESP_LOGI(GATTS_TABLE_TAG,"ESP_GATT_PREP_WRITE_CANCEL");
|
||||
}
|
||||
@ -384,7 +384,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
|
||||
if (!param->write.is_prep){
|
||||
// the data length of gattc write must be less than GATTS_DEMO_CHAR_VAL_LEN_MAX.
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "GATT_WRITE_EVT, handle = %d, value len = %d, value :", param->write.handle, param->write.len);
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
if (heart_rate_handle_table[IDX_CHAR_CFG_A] == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value = param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -417,7 +417,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "notify/indicate disable ");
|
||||
}else{
|
||||
ESP_LOGE(GATTS_TABLE_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
@ -446,7 +446,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_
|
||||
break;
|
||||
case ESP_GATTS_CONNECT_EVT:
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_CONNECT_EVT, conn_id = %d", param->connect.conn_id);
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, param->connect.remote_bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, param->connect.remote_bda, 6);
|
||||
esp_ble_conn_update_params_t conn_params = {0};
|
||||
memcpy(conn_params.bda, param->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
/* For the iOS system, please refer to Apple official documents about the BLE connection parameters restrictions. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -161,7 +161,7 @@ static void gattc_profile_a_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->open.conn_id;
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_OPEN_EVT conn_id %d, if %d, status %d, mtu %d", p_data->open.conn_id, gattc_if, p_data->open.status, p_data->open.mtu);
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, p_data->open.conn_id);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -295,7 +295,7 @@ static void gattc_profile_a_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
|
||||
}
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, Receive notify value:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK){
|
||||
@ -367,7 +367,7 @@ static void gattc_profile_b_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
|
||||
gl_profile_tab[PROFILE_B_APP_ID].conn_id = p_data->open.conn_id;
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_OPEN_EVT conn_id %d, if %d, status %d, mtu %d", p_data->open.conn_id, gattc_if, p_data->open.status, p_data->open.mtu);
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, p_data->open.conn_id);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -506,7 +506,7 @@ static void gattc_profile_b_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
|
||||
}
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, Receive notify value:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK){
|
||||
@ -575,7 +575,7 @@ static void gattc_profile_c_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
|
||||
gl_profile_tab[PROFILE_C_APP_ID].conn_id = p_data->open.conn_id;
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_OPEN_EVT conn_id %d, if %d, status %d, mtu %d", p_data->open.conn_id, gattc_if, p_data->open.status, p_data->open.mtu);
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, p_data->open.conn_id);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -714,7 +714,7 @@ static void gattc_profile_c_event_handler(esp_gattc_cb_event_t event, esp_gatt_i
|
||||
}
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, Receive notify value:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK){
|
||||
@ -794,12 +794,12 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
esp_ble_gap_cb_param_t *scan_result = (esp_ble_gap_cb_param_t *)param;
|
||||
switch (scan_result->scan_rst.search_evt) {
|
||||
case ESP_GAP_SEARCH_INQ_RES_EVT:
|
||||
esp_log_buffer_hex(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, scan_result->scan_rst.bda, 6);
|
||||
ESP_LOGI(GATTC_TAG, "Searched Adv Data Len %d, Scan Response Len %d", scan_result->scan_rst.adv_data_len, scan_result->scan_rst.scan_rsp_len);
|
||||
adv_name = esp_ble_resolve_adv_data(scan_result->scan_rst.ble_adv,
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "Searched Device Name Len %d", adv_name_len);
|
||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_CHAR(GATTC_TAG, adv_name, adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, " ");
|
||||
if (Isconnecting){
|
||||
break;
|
||||
|
@ -152,7 +152,7 @@ case ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT:
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->open.conn_id;
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_OPEN_EVT conn_id %d, if %d, status %d, mtu %d", p_data->open.conn_id, gattc_if, p_data->open.status, p_data->open.mtu);
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_config_mtu (gattc_if, p_data->open.conn_id, 200);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -268,7 +268,7 @@ At this point the client has acquired all characteristics from the remote device
|
||||
```c
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, Receive notify value:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
//write back
|
||||
esp_ble_gattc_write_char(gattc_if,
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -215,7 +215,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
gl_profile_tab[PROFILE_A_APP_ID].conn_id = p_data->open.conn_id;
|
||||
memcpy(gl_profile_tab[PROFILE_A_APP_ID].remote_bda, p_data->open.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, gl_profile_tab[PROFILE_A_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
esp_err_t mtu_ret = esp_ble_gattc_send_mtu_req (gattc_if, p_data->open.conn_id);
|
||||
if (mtu_ret){
|
||||
ESP_LOGE(GATTC_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -373,7 +373,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
}
|
||||
case ESP_GATTC_NOTIFY_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_NOTIFY_EVT, receive notify value:");
|
||||
esp_log_buffer_hex(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK){
|
||||
@ -386,7 +386,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
esp_bd_addr_t bda;
|
||||
memcpy(bda, p_data->srvc_chg.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTC_TAG, "ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
|
||||
esp_log_buffer_hex(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTC_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_WRITE_CHAR_EVT:
|
||||
@ -499,8 +499,8 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
if (!connect && strlen(remote_device_name) == adv_name_len && strncmp((char *)adv_name, remote_device_name, adv_name_len) == 0) {
|
||||
connect = true;
|
||||
esp_ble_gap_stop_ext_scan();
|
||||
esp_log_buffer_hex("adv addr", param->ext_adv_report.params.addr, 6);
|
||||
esp_log_buffer_char("adv name", adv_name, adv_name_len);
|
||||
ESP_LOG_BUFFER_HEX("adv addr", param->ext_adv_report.params.addr, 6);
|
||||
ESP_LOG_BUFFER_CHAR("adv name", adv_name, adv_name_len);
|
||||
ESP_LOGI(GATTC_TAG, "Stop extend scan and create aux open, primary_phy %d secondary phy %d", param->ext_adv_report.params.primary_phy, param->ext_adv_report.params.secondly_phy);
|
||||
|
||||
esp_ble_gap_prefer_ext_connect_params_set(param->ext_adv_report.params.addr,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -241,7 +241,7 @@ static void show_bonded_devices(void)
|
||||
esp_ble_get_bond_device_list(&dev_num, dev_list);
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "Bonded devices number : %d", dev_num);
|
||||
for (int i = 0; i < dev_num; i++) {
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, (void *)dev_list[i].bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, (void *)dev_list[i].bd_addr, sizeof(esp_bd_addr_t));
|
||||
}
|
||||
|
||||
free(dev_list);
|
||||
@ -343,7 +343,7 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
ESP_LOGD(GATTS_TABLE_TAG, "ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT status = %d", param->remove_bond_dev_cmpl.status);
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GAP_BLE_REMOVE_BOND_DEV");
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "-----ESP_GAP_BLE_REMOVE_BOND_DEV----");
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, (void *)param->remove_bond_dev_cmpl.bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, (void *)param->remove_bond_dev_cmpl.bd_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "------------------------------------");
|
||||
break;
|
||||
}
|
||||
@ -380,7 +380,7 @@ static void gatts_profile_event_handler(esp_gatts_cb_event_t event,
|
||||
break;
|
||||
case ESP_GATTS_WRITE_EVT:
|
||||
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_WRITE_EVT, write value:");
|
||||
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TABLE_TAG, param->write.value, param->write.len);
|
||||
break;
|
||||
case ESP_GATTS_EXEC_WRITE_EVT:
|
||||
break;
|
||||
|
@ -99,7 +99,7 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
break;
|
||||
case ESP_GAP_BLE_PERIODIC_ADV_SYNC_ESTAB_EVT:
|
||||
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_SYNC_ESTAB_EVT, status %d", param->periodic_adv_sync_estab.status);
|
||||
esp_log_buffer_hex("sync addr", param->periodic_adv_sync_estab.adv_addr, 6);
|
||||
ESP_LOG_BUFFER_HEX("sync addr", param->periodic_adv_sync_estab.adv_addr, 6);
|
||||
ESP_LOGI(LOG_TAG, "sync handle %d sid %d perioic adv interval %d adv phy %d", param->periodic_adv_sync_estab.sync_handle,
|
||||
param->periodic_adv_sync_estab.sid,
|
||||
param->periodic_adv_sync_estab.period_adv_interval,
|
||||
|
@ -317,7 +317,7 @@ ic_adv_sync_lost.sync_handle);
|
||||
case ESP_GAP_BLE_PERIODIC_ADV_SYNC_ESTAB_EVT:
|
||||
ESP_LOGI(LOG_TAG, "ESP_GAP_BLE_PERIODIC_ADV_SYNC_ESTAB_EVT, status %d", param->periodic_a
|
||||
dv_sync_estab.status);
|
||||
esp_log_buffer_hex("sync addr", param->periodic_adv_sync_estab.adv_addr, 6);
|
||||
ESP_LOG_BUFFER_HEX("sync addr", param->periodic_adv_sync_estab.adv_addr, 6);
|
||||
ESP_LOGI(LOG_TAG, "sync handle %d sid %d perioic adv interval %d adv phy %d", param->periodic_adv_sync_estab.sync_handle,
|
||||
param->periodic_adv_sync_estab.sid,
|
||||
param->periodic_adv_sync_estab.period_adv_interval,
|
||||
|
@ -75,7 +75,7 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT: {
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(BT_AV_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(BT_AV_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(BT_AV_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(BT_AV_TAG, "authentication failed, status: %d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT: {
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(BT_AV_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(BT_AV_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(BT_AV_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(BT_AV_TAG, "authentication failed, status: %d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT: {
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "authentication failed, status:%d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -142,7 +142,6 @@ static void l2cap_read_handle(void * param)
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
} else {
|
||||
ESP_LOGI(L2CAP_TAG, "fd = %d data_len = %d", fd, size);
|
||||
// esp_log_buffer_hex(L2CAP_TAG, l2cap_data, size);
|
||||
/* To avoid task watchdog */
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
||||
ESP_LOGI(SPP_TAG, "ESP_SPP_DATA_IND_EVT len:%d handle:%"PRIu32,
|
||||
param->data_ind.len, param->data_ind.handle);
|
||||
if (param->data_ind.len < 128) {
|
||||
esp_log_buffer_hex("", param->data_ind.data, param->data_ind.len);
|
||||
ESP_LOG_BUFFER_HEX("", param->data_ind.data, param->data_ind.len);
|
||||
}
|
||||
#else
|
||||
gettimeofday(&time_new, NULL);
|
||||
|
@ -192,7 +192,7 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
|
||||
ESP_LOGI(SPP_TAG, "ESP_SPP_WRITE_EVT len:%d handle:%"PRIu32" cong:%d", param->write.len, param->write.handle,
|
||||
param->write.cong);
|
||||
if (param->write.len < 128) {
|
||||
esp_log_buffer_hex("", spp_data, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX("", spp_data, param->write.len);
|
||||
/* Delay a little to avoid the task watch dog */
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
@ -249,12 +249,12 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
switch(event){
|
||||
case ESP_BT_GAP_DISC_RES_EVT:
|
||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_DISC_RES_EVT");
|
||||
esp_log_buffer_hex(SPP_TAG, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(SPP_TAG, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
/* Find the target peer device name in the EIR data */
|
||||
for (int i = 0; i < param->disc_res.num_prop; i++){
|
||||
if (param->disc_res.prop[i].type == ESP_BT_GAP_DEV_PROP_EIR
|
||||
&& get_name_from_eir(param->disc_res.prop[i].val, peer_bdname, &peer_bdname_len)){
|
||||
esp_log_buffer_char(SPP_TAG, peer_bdname, peer_bdname_len);
|
||||
ESP_LOG_BUFFER_CHAR(SPP_TAG, peer_bdname, peer_bdname_len);
|
||||
if (strlen(remote_device_name) == peer_bdname_len
|
||||
&& strncmp(peer_bdname, remote_device_name, peer_bdname_len) == 0) {
|
||||
memcpy(peer_bd_addr, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
@ -278,7 +278,7 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT:{
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(SPP_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(SPP_TAG, "authentication failed, status:%d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ static void spp_read_handle(void * param)
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
} else {
|
||||
ESP_LOGI(SPP_TAG, "fd = %d data_len = %d", fd, size);
|
||||
esp_log_buffer_hex(SPP_TAG, spp_data, size);
|
||||
ESP_LOG_BUFFER_HEX(SPP_TAG, spp_data, size);
|
||||
/* To avoid task watchdog */
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
}
|
||||
@ -162,7 +162,7 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT:{
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(SPP_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(SPP_TAG, "authentication failed, status:%d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -211,12 +211,12 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
switch(event){
|
||||
case ESP_BT_GAP_DISC_RES_EVT:
|
||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_DISC_RES_EVT");
|
||||
esp_log_buffer_hex(SPP_TAG, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(SPP_TAG, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
/* Find the target peer device name in the EIR data */
|
||||
for (int i = 0; i < param->disc_res.num_prop; i++){
|
||||
if (param->disc_res.prop[i].type == ESP_BT_GAP_DEV_PROP_EIR
|
||||
&& get_name_from_eir(param->disc_res.prop[i].val, peer_bdname, &peer_bdname_len)){
|
||||
esp_log_buffer_char(SPP_TAG, peer_bdname, peer_bdname_len);
|
||||
ESP_LOG_BUFFER_CHAR(SPP_TAG, peer_bdname, peer_bdname_len);
|
||||
if (strlen(remote_device_name) == peer_bdname_len
|
||||
&& strncmp(peer_bdname, remote_device_name, peer_bdname_len) == 0) {
|
||||
memcpy(peer_bd_addr, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
@ -240,7 +240,7 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT:{
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(SPP_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(SPP_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(SPP_TAG, "authentication failed, status:%d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||
if (strcmp(peer_bdname, remote_device_name) == 0) {
|
||||
memcpy(peer_addr, param->disc_res.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOGI(BT_HF_TAG, "Found a target device address:");
|
||||
esp_log_buffer_hex(BT_HF_TAG, peer_addr, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(BT_HF_TAG, peer_addr, ESP_BD_ADDR_LEN);
|
||||
ESP_LOGI(BT_HF_TAG, "Found a target device name: %s", peer_bdname);
|
||||
printf("Connect.\n");
|
||||
esp_hf_client_connect(peer_addr);
|
||||
@ -92,7 +92,7 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT: {
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(BT_HF_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(BT_HF_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(BT_HF_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(BT_HF_TAG, "authentication failed, status:%d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ void example_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t *prepare
|
||||
|
||||
void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param){
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC){
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
}else{
|
||||
ESP_LOGI(BT_BLE_COEX_TAG,"ESP_GATT_PREP_WRITE_CANCEL");
|
||||
}
|
||||
@ -287,7 +287,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_A_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value = param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -319,7 +319,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "notify/indicate disable ");
|
||||
}else{
|
||||
ESP_LOGE(BT_BLE_COEX_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
@ -393,7 +393,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "ESP_GATTS_CONF_EVT, status %d", param->conf.status);
|
||||
if (param->conf.status != ESP_GATT_OK){
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_OPEN_EVT:
|
||||
@ -435,7 +435,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_B_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value= param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -536,7 +536,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "ESP_GATTS_CONF_EVT status %d", param->conf.status);
|
||||
if (param->conf.status != ESP_GATT_OK){
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_DISCONNECT_EVT:
|
||||
@ -627,7 +627,7 @@ static void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
||||
case ESP_BT_GAP_AUTH_CMPL_EVT: {
|
||||
if (param->auth_cmpl.stat == ESP_BT_STATUS_SUCCESS) {
|
||||
ESP_LOGI(BT_BLE_COEX_TAG, "authentication success: %s", param->auth_cmpl.device_name);
|
||||
esp_log_buffer_hex(BT_BLE_COEX_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
ESP_LOG_BUFFER_HEX(BT_BLE_COEX_TAG, param->auth_cmpl.bda, ESP_BD_ADDR_LEN);
|
||||
} else {
|
||||
ESP_LOGE(BT_BLE_COEX_TAG, "authentication failed, status: %d", param->auth_cmpl.stat);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -297,7 +297,7 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
|
||||
// Update peer gatt server address
|
||||
memcpy(peer_gatts_addr, scan_result->scan_rst.bda, sizeof(esp_bd_addr_t));
|
||||
esp_log_buffer_hex("the remote device addr", peer_gatts_addr, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX("the remote device addr", peer_gatts_addr, sizeof(esp_bd_addr_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,7 +334,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
gattc_profile_tab[GATTC_PROFILE_C_APP_ID].conn_id = p_data->connect.conn_id;
|
||||
memcpy(gattc_profile_tab[GATTC_PROFILE_C_APP_ID].remote_bda, p_data->connect.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(COEX_TAG, "REMOTE BDA:");
|
||||
esp_log_buffer_hex(COEX_TAG, gattc_profile_tab[GATTC_PROFILE_C_APP_ID].remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, gattc_profile_tab[GATTC_PROFILE_C_APP_ID].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(COEX_TAG, "config MTU error, error code = %x", mtu_ret);
|
||||
@ -502,7 +502,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
} else {
|
||||
ESP_LOGI(COEX_TAG, "ESP_GATTC_NOTIFY_EVT, receive indicate value:");
|
||||
}
|
||||
esp_log_buffer_hex(COEX_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, p_data->notify.value, p_data->notify.value_len);
|
||||
break;
|
||||
case ESP_GATTC_WRITE_DESCR_EVT:
|
||||
if (p_data->write.status != ESP_GATT_OK) {
|
||||
@ -526,7 +526,7 @@ static void gattc_profile_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
||||
esp_bd_addr_t bda;
|
||||
memcpy(bda, p_data->srvc_chg.remote_bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOGI(COEX_TAG, "ESP_GATTC_SRVC_CHG_EVT, bd_addr:");
|
||||
esp_log_buffer_hex(COEX_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, bda, sizeof(esp_bd_addr_t));
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_WRITE_CHAR_EVT:
|
||||
@ -602,7 +602,7 @@ static void example_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t *
|
||||
static void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param)
|
||||
{
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
|
||||
esp_log_buffer_hex(COEX_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
} else {
|
||||
ESP_LOGI(COEX_TAG, "ESP_GATT_PREP_WRITE_CANCEL");
|
||||
}
|
||||
@ -673,7 +673,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(COEX_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep) {
|
||||
ESP_LOGI(COEX_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(COEX_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, param->write.value, param->write.len);
|
||||
if (gatts_profile_tab[GATTS_PROFILE_A_APP_ID].descr_handle == param->write.handle && param->write.len == 2) {
|
||||
uint16_t descr_value = param->write.value[1] << 8 | param->write.value[0];
|
||||
if (descr_value == NOTIFY_ENABLE) {
|
||||
@ -702,7 +702,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(COEX_TAG, "notify/indicate disable ");
|
||||
} else {
|
||||
ESP_LOGE(COEX_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(COEX_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
@ -779,7 +779,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(COEX_TAG, "ESP_GATTS_CONF_EVT, status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK) {
|
||||
esp_log_buffer_hex(COEX_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_OPEN_EVT:
|
||||
@ -818,7 +818,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(COEX_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep) {
|
||||
ESP_LOGI(COEX_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(COEX_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, param->write.value, param->write.len);
|
||||
if (gatts_profile_tab[GATTS_PROFILE_B_APP_ID].descr_handle == param->write.handle && param->write.len == 2) {
|
||||
uint16_t descr_value = param->write.value[1] << 8 | param->write.value[0];
|
||||
if (descr_value == NOTIFY_ENABLE) {
|
||||
@ -920,7 +920,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(COEX_TAG, "ESP_GATTS_CONF_EVT status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK) {
|
||||
esp_log_buffer_hex(COEX_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(COEX_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_DISCONNECT_EVT:
|
||||
|
@ -427,7 +427,7 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para
|
||||
}
|
||||
case ESP_BLUFI_EVENT_RECV_CUSTOM_DATA:
|
||||
BLUFI_INFO("Recv Custom Data %" PRIu32 "\n", param->custom_data.data_len);
|
||||
esp_log_buffer_hex("Custom Data", param->custom_data.data, param->custom_data.data_len);
|
||||
ESP_LOG_BUFFER_HEX("Custom Data", param->custom_data.data, param->custom_data.data_len);
|
||||
break;
|
||||
case ESP_BLUFI_EVENT_RECV_USERNAME:
|
||||
/* Not handle currently */
|
||||
|
@ -109,7 +109,6 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");
|
||||
if (output_buffer != NULL) {
|
||||
// Response is accumulated in output_buffer. Uncomment the below line to print the accumulated response
|
||||
// ESP_LOG_BUFFER_HEX(TAG, output_buffer, output_len);
|
||||
free(output_buffer);
|
||||
output_buffer = NULL;
|
||||
}
|
||||
@ -145,7 +144,7 @@ static void http_rest_with_url(void)
|
||||
// it is used by functions like strlen(). The buffer should only be used upto size MAX_HTTP_OUTPUT_BUFFER
|
||||
char local_response_buffer[MAX_HTTP_OUTPUT_BUFFER + 1] = {0};
|
||||
/**
|
||||
* NOTE: All the configuration parameters for http_client must be spefied either in URL or as host and path parameters.
|
||||
* NOTE: All the configuration parameters for http_client must be specified either in URL or as host and path parameters.
|
||||
* If host and path parameters are not set, query parameter will be ignored. In such cases,
|
||||
* query parameter should be specified in URL.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -85,7 +85,7 @@ static struct gatts_profile_inst gl_profile_tab[PROFILE_NUM] = {
|
||||
void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param)
|
||||
{
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC) {
|
||||
esp_log_buffer_hex(TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "ESP_GATT_PREP_WRITE_CANCEL");
|
||||
}
|
||||
@ -204,7 +204,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat
|
||||
ESP_LOGI(TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep) {
|
||||
ESP_LOGI(TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_A_APP_ID].descr_handle == param->write.handle && param->write.len == 2) {
|
||||
uint16_t descr_value = param->write.value[1] << 8 | param->write.value[0];
|
||||
if (descr_value == 0x0001) {
|
||||
@ -233,7 +233,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat
|
||||
ESP_LOGI(TAG, "notify/indicate disable ");
|
||||
} else {
|
||||
ESP_LOGE(TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
@ -331,7 +331,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(TAG, "ESP_GATTS_CONF_EVT, status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK) {
|
||||
esp_log_buffer_hex(TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_OPEN_EVT:
|
||||
|
Loading…
Reference in New Issue
Block a user