Skip to content

Commit e43e524

Browse files
committed
Bluetooth: Host: Deprecate old Bluetooth device name APIs
The following Kconfig APIs are deprecated: - `CONFIG_BT_DEVICE_NAME` - `CONFIG_BT_DEVICE_DYNAMIC` - `CONFIG_BT_DEVICE_NAME_MAX` The following C APIs are deprecated: - `bt_get_name()` - `bt_set_name()` They are deprecated because the current APIs are not thread safe and can be confusing. The Kconfig APIs are replaced by the `BT_GAP_DEVICE_NAME_TYPE` choice. When selecting `CONFIG_BT_GAP_DEVICE_NAME_STATIC`, the name must be set using `CONFIG_BT_GAP_DEVICE_NAME`. When selecting `CONFIG_BT_GAP_DEVICE_NAME_DYNAMIC`, the GAP device name must be set using `bt_gap_set_device_name()` and retrieved using `bt_gap_get_device_name()`. The the maximum size of the GAP device name can now be set using `CONFIG_BT_GAP_DEVICE_NAME_DYNAMIC_MAX`. Signed-off-by: Théo Battrel <[email protected]>
1 parent a6589d4 commit e43e524

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

doc/releases/release-notes-4.2.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ Deprecated APIs and options
9999
* ``xiao_esp32c6`` board target has been deprecated and renamed to
100100
``xiao_esp32c6/esp32c6/hpcore``.
101101

102+
* The :c:func:`bt_get_name` and :c:func:`bt_set_name` are deprecated in favor of
103+
the new :c:func:`bt_gap_get_device_name` and :c:func:`bt_gap_set_device_name`.
104+
:kconfig:option:`CONFIG_BT_DEVICE_NAME`,
105+
:kconfig:option:`CONFIG_BT_DEVICE_NAME_DYNAMIC` and
106+
:kconfig:option:`CONFIG_BT_DEVICE_NAME_MAX` are deprecated in favor of
107+
:kconfig:option:`CONFIG_BT_GAP_DEVICE_NAME`,
108+
:kconfig:option:`CONFIG_BT_GAP_DEVICE_NAME_DYNAMIC` and
109+
:kconfig:option:`CONFIG_BT_GAP_DEVICE_NAME_DYNAMIC_MAX`.
110+
102111
New APIs and options
103112
====================
104113

include/zephyr/bluetooth/bluetooth.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ bool bt_is_ready(void);
359359
*
360360
* @return Zero on success or (negative) error code otherwise.
361361
*/
362-
int bt_set_name(const char *name);
362+
__deprecated int bt_set_name(const char *name);
363363

364364
/**
365365
* @brief Get Bluetooth Device Name
@@ -368,7 +368,7 @@ int bt_set_name(const char *name);
368368
*
369369
* @return Bluetooth Device Name
370370
*/
371-
const char *bt_get_name(void);
371+
__deprecated const char *bt_get_name(void);
372372

373373
/**
374374
* @brief Get local Bluetooth appearance

subsys/bluetooth/host/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,13 +862,14 @@ config BT_SCAN_AND_INITIATE_IN_PARALLEL
862862
feature is enabled.
863863

864864
config BT_DEVICE_NAME_DYNAMIC
865-
bool "Allow to set Bluetooth device name on runtime"
865+
bool "Allow to set Bluetooth device name on runtime [DEPRECATED]"
866+
select DEPRECATED
866867
help
867868
Enabling this option allows for runtime configuration of Bluetooth
868869
device name.
869870

870871
config BT_DEVICE_NAME_MAX
871-
int "Maximum size in bytes for device name"
872+
int "Maximum size in bytes for device name [DEPRECATED]"
872873
depends on BT_DEVICE_NAME_DYNAMIC
873874
default 28
874875
range 2 248
@@ -877,7 +878,7 @@ config BT_DEVICE_NAME_MAX
877878
long (excluding NULL termination).
878879

879880
config BT_DEVICE_NAME
880-
string "Bluetooth device name"
881+
string "Bluetooth device name [DEPRECATED]"
881882
default "Zephyr"
882883
help
883884
Bluetooth device name. Name can be up to 248 bytes long (excluding

0 commit comments

Comments
 (0)