mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
Merge branch 'bugfix/make_blufi_adv_custom_v5.4' into 'release/v5.4'
feat(nimble): Add a way to make blufi advertising customizable (v5.4) See merge request espressif/esp-idf!40530
This commit is contained in:
@@ -298,7 +298,7 @@ int esp_blufi_gatt_svr_deinit(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
int
|
||||||
esp_blufi_gap_event(struct ble_gap_event *event, void *arg)
|
esp_blufi_gap_event(struct ble_gap_event *event, void *arg)
|
||||||
{
|
{
|
||||||
struct ble_gap_conn_desc desc;
|
struct ble_gap_conn_desc desc;
|
||||||
@@ -331,7 +331,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
}
|
}
|
||||||
if (event->connect.status != 0) {
|
if (event->connect.status != 0) {
|
||||||
/* Connection failed; resume advertising. */
|
/* Connection failed; resume advertising. */
|
||||||
esp_blufi_adv_start();
|
((void(*)(void))arg)();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case BLE_GAP_EVENT_DISCONNECT:
|
case BLE_GAP_EVENT_DISCONNECT:
|
||||||
@@ -366,7 +366,7 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg)
|
|||||||
case BLE_GAP_EVENT_ADV_COMPLETE:
|
case BLE_GAP_EVENT_ADV_COMPLETE:
|
||||||
ESP_LOGI(TAG, "advertise complete; reason=%d",
|
ESP_LOGI(TAG, "advertise complete; reason=%d",
|
||||||
event->adv_complete.reason);
|
event->adv_complete.reason);
|
||||||
esp_blufi_adv_start();
|
((void(*)(void))arg)();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case BLE_GAP_EVENT_SUBSCRIBE:
|
case BLE_GAP_EVENT_SUBSCRIBE:
|
||||||
@@ -461,7 +461,7 @@ void esp_blufi_adv_start(void)
|
|||||||
adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
|
adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
|
||||||
adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
|
adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
|
||||||
rc = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER,
|
rc = ble_gap_adv_start(own_addr_type, NULL, BLE_HS_FOREVER,
|
||||||
&adv_params, esp_blufi_gap_event, NULL);
|
&adv_params, esp_blufi_gap_event, esp_blufi_adv_start);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
ESP_LOGE(TAG, "error enabling advertisement; rc=%d", rc);
|
ESP_LOGE(TAG, "error enabling advertisement; rc=%d", rc);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user