File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed
components/bt/common/btc/profile/esp/blufi
examples/bluetooth/blufi/main Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,15 @@ void esp_blufi_deinit(void)
381381
382382void esp_blufi_adv_start (void )
383383{
384- esp_ble_gap_set_device_name (BLUFI_DEVICE_NAME );
384+ esp_ble_gap_config_adv_data (& blufi_adv_data );
385+ }
386+
387+ void esp_blufi_adv_start_with_name (const char * name )
388+ {
389+ if (name != NULL ) {
390+ esp_ble_gap_set_device_name (name );
391+ }
392+
385393 esp_ble_gap_config_adv_data (& blufi_adv_data );
386394}
387395
Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ void esp_blufi_adv_stop(void);
8585/* Start advertisement */
8686void esp_blufi_adv_start (void );
8787
88+ /* Start advertisement with specified name. if the name is NULL just start advertisement */
89+ void esp_blufi_adv_start_with_name (const char * name );
90+
8891void esp_blufi_send_encap (void * arg );
8992
9093#ifdef CONFIG_BT_NIMBLE_ENABLED
Original file line number Diff line number Diff line change @@ -468,6 +468,15 @@ void esp_blufi_adv_start(void)
468468 }
469469}
470470
471+ void esp_blufi_adv_start_with_name (const char * name )
472+ {
473+ if (name != NULL ) {
474+ ble_svc_gap_device_name_set (name );
475+ }
476+
477+ esp_blufi_adv_start ();
478+ }
479+
471480uint8_t esp_blufi_init (void )
472481{
473482 blufi_env .enabled = true;
Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ esp_err_t esp_blufi_host_init(void)
4545 }
4646 BLUFI_INFO ("BD ADDR: " ESP_BD_ADDR_STR "\n" , ESP_BD_ADDR_HEX (esp_bt_dev_get_address ()));
4747
48+ /* Set the default device name */
49+ ret = esp_ble_gap_set_device_name (BLUFI_DEVICE_NAME );
50+ if (ret ) {
51+ BLUFI_ERROR ("%s set device name failed: %s\n" , __func__ , esp_err_to_name (ret ));
52+ return ESP_FAIL ;
53+ }
54+
4855 return ESP_OK ;
4956
5057}
You can’t perform that action at this time.
0 commit comments