mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
feat(bt/blufi): Support Blufi start advertising with specified name
(cherry picked from commit ea8bcdc360
)
Co-authored-by: chenjianhua <chenjianhua@espressif.com>
This commit is contained in:
@@ -381,7 +381,15 @@ void esp_blufi_deinit(void)
|
||||
|
||||
void esp_blufi_adv_start(void)
|
||||
{
|
||||
esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME);
|
||||
esp_ble_gap_config_adv_data(&blufi_adv_data);
|
||||
}
|
||||
|
||||
void esp_blufi_adv_start_with_name(const char *name)
|
||||
{
|
||||
if (name != NULL) {
|
||||
esp_ble_gap_set_device_name(name);
|
||||
}
|
||||
|
||||
esp_ble_gap_config_adv_data(&blufi_adv_data);
|
||||
}
|
||||
|
||||
|
@@ -85,6 +85,9 @@ void esp_blufi_adv_stop(void);
|
||||
/* Start advertisement */
|
||||
void esp_blufi_adv_start(void);
|
||||
|
||||
/* Start advertisement with specified name. if the name is NULL just start advertisement */
|
||||
void esp_blufi_adv_start_with_name(const char *name);
|
||||
|
||||
void esp_blufi_send_encap(void *arg);
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
|
@@ -468,6 +468,15 @@ void esp_blufi_adv_start(void)
|
||||
}
|
||||
}
|
||||
|
||||
void esp_blufi_adv_start_with_name(const char *name)
|
||||
{
|
||||
if (name != NULL) {
|
||||
ble_svc_gap_device_name_set(name);
|
||||
}
|
||||
|
||||
esp_blufi_adv_start();
|
||||
}
|
||||
|
||||
uint8_t esp_blufi_init(void)
|
||||
{
|
||||
blufi_env.enabled = true;
|
||||
|
@@ -45,6 +45,13 @@ esp_err_t esp_blufi_host_init(void)
|
||||
}
|
||||
BLUFI_INFO("BD ADDR: "ESP_BD_ADDR_STR"\n", ESP_BD_ADDR_HEX(esp_bt_dev_get_address()));
|
||||
|
||||
/* Set the default device name */
|
||||
ret = esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME);
|
||||
if (ret) {
|
||||
BLUFI_ERROR("%s set device name failed: %s\n", __func__, esp_err_to_name(ret));
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user