Skip to content

Commit 5f865a8

Browse files
committed
Merge branch 'refactor/ble_example_print_on_bluedroid' into 'master'
refactor(bt/bluedroid): Refactor the print for BLE examples Closes BLERP-904, BLERP-910, BLERP-1026, and BLERP-1031 See merge request espressif/esp-idf!33296
2 parents cb2624f + 53a8345 commit 5f865a8

37 files changed

+561
-400
lines changed

examples/bluetooth/bluedroid/ble/ble_ibeacon/main/ibeacon_demo.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -82,13 +82,17 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
8282
case ESP_GAP_BLE_SCAN_START_COMPLETE_EVT:
8383
//scan start complete event to indicate scan start successfully or failed
8484
if ((err = param->scan_start_cmpl.status) != ESP_BT_STATUS_SUCCESS) {
85-
ESP_LOGE(DEMO_TAG, "Scan start failed: %s", esp_err_to_name(err));
85+
ESP_LOGE(DEMO_TAG, "Scanning start failed, error %s", esp_err_to_name(err));
86+
} else {
87+
ESP_LOGI(DEMO_TAG, "Scanning start successfully");
8688
}
8789
break;
8890
case ESP_GAP_BLE_ADV_START_COMPLETE_EVT:
8991
//adv start complete event to indicate adv start successfully or failed
9092
if ((err = param->adv_start_cmpl.status) != ESP_BT_STATUS_SUCCESS) {
91-
ESP_LOGE(DEMO_TAG, "Adv start failed: %s", esp_err_to_name(err));
93+
ESP_LOGE(DEMO_TAG, "Advertising start failed, error %s", esp_err_to_name(err));
94+
} else {
95+
ESP_LOGI(DEMO_TAG, "Advertising start successfully");
9296
}
9397
break;
9498
case ESP_GAP_BLE_SCAN_RESULT_EVT: {
@@ -99,15 +103,15 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
99103
if (esp_ble_is_ibeacon_packet(scan_result->scan_rst.ble_adv, scan_result->scan_rst.adv_data_len)){
100104
esp_ble_ibeacon_t *ibeacon_data = (esp_ble_ibeacon_t*)(scan_result->scan_rst.ble_adv);
101105
ESP_LOGI(DEMO_TAG, "----------iBeacon Found----------");
102-
ESP_LOG_BUFFER_HEX("IBEACON_DEMO: Device address:", scan_result->scan_rst.bda, ESP_BD_ADDR_LEN );
103-
ESP_LOG_BUFFER_HEX("IBEACON_DEMO: Proximity UUID:", ibeacon_data->ibeacon_vendor.proximity_uuid, ESP_UUID_LEN_128);
106+
ESP_LOGI(DEMO_TAG, "Device address: "ESP_BD_ADDR_STR"", ESP_BD_ADDR_HEX(scan_result->scan_rst.bda));
107+
ESP_LOG_BUFFER_HEX("IBEACON_DEMO: Proximity UUID", ibeacon_data->ibeacon_vendor.proximity_uuid, ESP_UUID_LEN_128);
104108

105109
uint16_t major = ENDIAN_CHANGE_U16(ibeacon_data->ibeacon_vendor.major);
106110
uint16_t minor = ENDIAN_CHANGE_U16(ibeacon_data->ibeacon_vendor.minor);
107111
ESP_LOGI(DEMO_TAG, "Major: 0x%04x (%d)", major, major);
108112
ESP_LOGI(DEMO_TAG, "Minor: 0x%04x (%d)", minor, minor);
109-
ESP_LOGI(DEMO_TAG, "Measured power (RSSI at a 1m distance):%d dbm", ibeacon_data->ibeacon_vendor.measured_power);
110-
ESP_LOGI(DEMO_TAG, "RSSI of packet:%d dbm", scan_result->scan_rst.rssi);
113+
ESP_LOGI(DEMO_TAG, "Measured power (RSSI at a 1m distance): %d dBm", ibeacon_data->ibeacon_vendor.measured_power);
114+
ESP_LOGI(DEMO_TAG, "RSSI of packet: %d dbm", scan_result->scan_rst.rssi);
111115
}
112116
break;
113117
default:
@@ -118,19 +122,19 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
118122

119123
case ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT:
120124
if ((err = param->scan_stop_cmpl.status) != ESP_BT_STATUS_SUCCESS){
121-
ESP_LOGE(DEMO_TAG, "Scan stop failed: %s", esp_err_to_name(err));
125+
ESP_LOGE(DEMO_TAG, "Scanning stop failed, error %s", esp_err_to_name(err));
122126
}
123127
else {
124-
ESP_LOGI(DEMO_TAG, "Stop scan successfully");
128+
ESP_LOGI(DEMO_TAG, "Scanning stop successfully");
125129
}
126130
break;
127131

128132
case ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT:
129133
if ((err = param->adv_stop_cmpl.status) != ESP_BT_STATUS_SUCCESS){
130-
ESP_LOGE(DEMO_TAG, "Adv stop failed: %s", esp_err_to_name(err));
134+
ESP_LOGE(DEMO_TAG, "Advertising stop failed, error %s", esp_err_to_name(err));
131135
}
132136
else {
133-
ESP_LOGI(DEMO_TAG, "Stop adv successfully");
137+
ESP_LOGI(DEMO_TAG, "Advertising stop successfully");
134138
}
135139
break;
136140

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
menu "Example 'GATT CLIENT THROUGHPUT' Config"
22

3-
config GATTS_NOTIFY_THROUGHPUT
3+
config EXAMPLE_GATTS_NOTIFY_THROUGHPUT
44
bool "test the gatts notify throughput"
55
help
6-
If this config item is set, then the 'GATTC_WRITE_THROUGHPUT' config should be close, it can't test both
7-
write or notify at the same time at this demo
6+
If this config item is set, then the 'EXAMPLE_GATTC_WRITE_THROUGHPUT' config should be close,
7+
it can't test both write or notify at the same time at this demo
88

9-
config GATTC_WRITE_THROUGHPUT
9+
config EXAMPLE_GATTC_WRITE_THROUGHPUT
1010
bool "test the gattc write throughput"
1111
help
12-
If this config item is set, then the 'GATTS_NOTIFY_THROUGHPUT' config should be close, it can't test both
13-
write or notify at the same time at this demo
12+
If this config item is set, then the 'EXAMPLE_GATTS_NOTIFY_THROUGHPUT' config should be close,
13+
it can't test both write or notify at the same time at this demo
14+
15+
config EXAMPLE_CI_ID
16+
int
17+
default 60
18+
help
19+
This config the example id for CI test. Only for internal used.
20+
21+
config EXAMPLE_CI_PIPELINE_ID
22+
int "The pipeline id for CI test"
23+
default 0
24+
help
25+
This config the pipeline id for CI test. Only for internal used.
26+
1427
endmenu

0 commit comments

Comments
 (0)