Generic Access Profile (GAP)
API Reference
- group bt_gap
Generic Access Profile (GAP)
- Since
1.0
- Version
1.0.0
Defines
-
BT_ID_DEFAULT
Convenience macro for specifying the default identity.
This helps make the code more readable, especially when only one identity is supported.
-
BT_DATA_SERIALIZED_SIZE(data_len)
Bluetooth data serialized size.
Get the size of a serialized bt_data given its data length.
Size of ‘AD Structure’->’Length’ field, equal to 1. Size of ‘AD Structure’->’Data’->’AD Type’ field, equal to 1. Size of ‘AD Structure’->’Data’->’AD Data’ field, equal to data_len.
See Core Specification Version 5.4 Vol. 3 Part C, 11, Figure 11.1.
-
BT_DATA(_type, _data, _data_len)
Helper to declare elements of bt_data arrays.
This macro is mainly for creating an array of struct bt_data elements which is then passed to e.g. bt_le_adv_start().
- Parameters:
_type – Type of advertising data field
_data – Pointer to the data field payload
_data_len – Number of bytes behind the _data pointer
-
BT_DATA_BYTES(_type, _bytes...)
Helper to declare elements of bt_data arrays.
This macro is mainly for creating an array of struct bt_data elements which is then passed to e.g. bt_le_adv_start().
- Parameters:
_type – Type of advertising data field
_bytes – Variable number of single-byte parameters
-
BT_LE_ADV_PARAM_INIT(_options, _int_min, _int_max, _peer)
Initialize advertising parameters.
- Parameters:
_options – Advertising Options
_int_min – Minimum advertising interval
_int_max – Maximum advertising interval
_peer – Peer address, set to NULL for undirected advertising or address of peer for directed advertising.
-
BT_LE_ADV_PARAM(_options, _int_min, _int_max, _peer)
Helper to declare advertising parameters inline.
- Parameters:
_options – Advertising Options
_int_min – Minimum advertising interval
_int_max – Maximum advertising interval
_peer – Peer address, set to NULL for undirected advertising or address of peer for directed advertising.
-
BT_LE_ADV_CONN_DIR(_peer)
-
BT_LE_ADV_CONN
-
BT_LE_ADV_CONN_ONE_TIME
This is the recommended default for connectable advertisers.
-
BT_LE_ADV_CONN_NAME
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
-
BT_LE_ADV_CONN_NAME_AD
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
-
BT_LE_ADV_CONN_DIR_LOW_DUTY(_peer)
-
BT_LE_ADV_NCONN
Non-connectable advertising with private address.
-
BT_LE_ADV_NCONN_NAME
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Non-connectable advertising with BT_LE_ADV_OPT_USE_NAME
-
BT_LE_ADV_NCONN_IDENTITY
Non-connectable advertising with BT_LE_ADV_OPT_USE_IDENTITY.
-
BT_LE_EXT_ADV_CONN
Connectable extended advertising.
-
BT_LE_EXT_ADV_CONN_NAME
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Connectable extended advertising with BT_LE_ADV_OPT_USE_NAME
-
BT_LE_EXT_ADV_SCAN
Scannable extended advertising.
-
BT_LE_EXT_ADV_SCAN_NAME
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Scannable extended advertising with BT_LE_ADV_OPT_USE_NAME
-
BT_LE_EXT_ADV_NCONN
Non-connectable extended advertising with private address.
-
BT_LE_EXT_ADV_NCONN_NAME
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Non-connectable extended advertising with BT_LE_ADV_OPT_USE_NAME
-
BT_LE_EXT_ADV_NCONN_IDENTITY
Non-connectable extended advertising with BT_LE_ADV_OPT_USE_IDENTITY.
-
BT_LE_EXT_ADV_CODED_NCONN
Non-connectable extended advertising on coded PHY with private address.
-
BT_LE_EXT_ADV_CODED_NCONN_NAME
- Deprecated:
This macro will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Non-connectable extended advertising on coded PHY with BT_LE_ADV_OPT_USE_NAME
-
BT_LE_EXT_ADV_CODED_NCONN_IDENTITY
Non-connectable extended advertising on coded PHY with BT_LE_ADV_OPT_USE_IDENTITY.
-
BT_LE_EXT_ADV_START_PARAM_INIT(_timeout, _n_evts)
Helper to initialize extended advertising start parameters inline.
- Parameters:
_timeout – Advertiser timeout
_n_evts – Number of advertising events
-
BT_LE_EXT_ADV_START_PARAM(_timeout, _n_evts)
Helper to declare extended advertising start parameters inline.
- Parameters:
_timeout – Advertiser timeout
_n_evts – Number of advertising events
-
BT_LE_EXT_ADV_START_DEFAULT
-
BT_LE_PER_ADV_PARAM_INIT(_int_min, _int_max, _options)
Helper to declare periodic advertising parameters inline.
- Parameters:
_int_min – Minimum periodic advertising interval
_int_max – Maximum periodic advertising interval
_options – Periodic advertising properties bitfield.
-
BT_LE_PER_ADV_PARAM(_int_min, _int_max, _options)
Helper to declare periodic advertising parameters inline.
- Parameters:
_int_min – Minimum periodic advertising interval
_int_max – Maximum periodic advertising interval
_options – Periodic advertising properties bitfield.
-
BT_LE_PER_ADV_DEFAULT
-
BT_LE_SCAN_OPT_FILTER_WHITELIST
-
BT_LE_SCAN_PARAM_INIT(_type, _options, _interval, _window)
Initialize scan parameters.
- Parameters:
_type – Scan Type, BT_LE_SCAN_TYPE_ACTIVE or BT_LE_SCAN_TYPE_PASSIVE.
_options – Scan options
_interval – Scan Interval (N * 0.625 ms)
_window – Scan Window (N * 0.625 ms)
-
BT_LE_SCAN_PARAM(_type, _options, _interval, _window)
Helper to declare scan parameters inline.
- Parameters:
_type – Scan Type, BT_LE_SCAN_TYPE_ACTIVE or BT_LE_SCAN_TYPE_PASSIVE.
_options – Scan options
_interval – Scan Interval (N * 0.625 ms)
_window – Scan Window (N * 0.625 ms)
-
BT_LE_SCAN_ACTIVE
Helper macro to enable active scanning to discover new devices.
-
BT_LE_SCAN_ACTIVE_CONTINUOUS
Helper macro to enable active scanning to discover new devices with window == interval.
Continuous scanning should be used to maximize the chances of receiving advertising packets.
-
BT_LE_SCAN_PASSIVE
Helper macro to enable passive scanning to discover new devices.
This macro should be used if information required for device identification (e.g., UUID) are known to be placed in Advertising Data.
-
BT_LE_SCAN_PASSIVE_CONTINUOUS
Helper macro to enable passive scanning to discover new devices with window==interval.
This macro should be used if information required for device identification (e.g., UUID) are known to be placed in Advertising Data.
-
BT_LE_SCAN_CODED_ACTIVE
Helper macro to enable active scanning to discover new devices.
Include scanning on Coded PHY in addition to 1M PHY.
-
BT_LE_SCAN_CODED_PASSIVE
Helper macro to enable passive scanning to discover new devices.
Include scanning on Coded PHY in addition to 1M PHY.
This macro should be used if information required for device identification (e.g., UUID) are known to be placed in Advertising Data.
Typedefs
-
typedef void (*bt_ready_cb_t)(int err)
Callback for notifying that Bluetooth has been enabled.
- Param err:
zero on success or (negative) error code otherwise.
-
typedef void bt_le_scan_cb_t(const bt_addr_le_t *addr, int8_t rssi, uint8_t adv_type, struct net_buf_simple *buf)
Callback type for reporting LE scan results.
A function of this type is given to the bt_le_scan_start() function and will be called for any discovered LE device.
- Param addr:
Advertiser LE address and type.
- Param rssi:
Strength of advertiser signal.
- Param adv_type:
Type of advertising response from advertiser. Uses the BT_GAP_ADV_TYPE_* values.
- Param buf:
Buffer containing advertiser data.
-
typedef void bt_br_discovery_cb_t(struct bt_br_discovery_result *results, size_t count)
Callback type for reporting BR/EDR discovery (inquiry) results.
A callback of this type is given to the bt_br_discovery_start() function and will be called at the end of the discovery with information about found devices populated in the results array.
- Param results:
Storage used for discovery results
- Param count:
Number of valid discovery results.
Enums
-
enum [anonymous]
Advertising options.
Values:
-
enumerator BT_LE_ADV_OPT_NONE = 0
Convenience value when no options are specified.
-
enumerator BT_LE_ADV_OPT_CONNECTABLE = BIT(0)
Advertise as connectable.
Advertise as connectable. If not connectable then the type of advertising is determined by providing scan response data. The advertiser address is determined by the type of advertising and/or enabling privacy
CONFIG_BT_PRIVACY
.
-
enumerator BT_LE_ADV_OPT_ONE_TIME = BIT(1)
Advertise one time.
Don’t try to resume connectable advertising after a connection. This option is only meaningful when used together with BT_LE_ADV_OPT_CONNECTABLE. If set the advertising will be stopped when bt_le_adv_stop() is called or when an incoming (peripheral) connection happens. If this option is not set the stack will take care of keeping advertising enabled even as connections occur. If Advertising directed or the advertiser was started with bt_le_ext_adv_start then this behavior is the default behavior and this flag has no effect.
-
enumerator BT_LE_ADV_OPT_USE_IDENTITY = BIT(2)
Advertise using identity address.
Advertise using the identity address as the advertiser address.
Note
The address used for advertising will not be the same as returned by bt_le_oob_get_local, instead bt_id_get should be used to get the LE address.
Warning
This will compromise the privacy of the device, so care must be taken when using this option.
-
enumerator BT_LE_ADV_OPT_USE_NAME = BIT(3)
Advertise using GAP device name.
- Deprecated:
This option will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Include the GAP device name automatically when advertising. By default the GAP device name is put at the end of the scan response data. When advertising using BT_LE_ADV_OPT_EXT_ADV and not BT_LE_ADV_OPT_SCANNABLE then it will be put at the end of the advertising data. If the GAP device name does not fit into advertising data it will be converted to a shortened name if possible. BT_LE_ADV_OPT_FORCE_NAME_IN_AD can be used to force the device name to appear in the advertising data of an advert with scan response data.
The application can set the device name itself by including the following in the advertising data.
BT_DATA(BT_DATA_NAME_COMPLETE, name, sizeof(name) - 1)
-
enumerator BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY = BIT(4)
Low duty cycle directed advertising.
Use low duty directed advertising mode, otherwise high duty mode will be used.
-
enumerator BT_LE_ADV_OPT_DIR_ADDR_RPA = BIT(5)
Directed advertising to privacy-enabled peer.
Enable use of Resolvable Private Address (RPA) as the target address in directed advertisements. This is required if the remote device is privacy-enabled and supports address resolution of the target address in directed advertisement. It is the responsibility of the application to check that the remote device supports address resolution of directed advertisements by reading its Central Address Resolution characteristic.
-
enumerator BT_LE_ADV_OPT_FILTER_SCAN_REQ = BIT(6)
Use filter accept list to filter devices that can request scan response data.
-
enumerator BT_LE_ADV_OPT_FILTER_CONN = BIT(7)
Use filter accept list to filter devices that can connect.
-
enumerator BT_LE_ADV_OPT_NOTIFY_SCAN_REQ = BIT(8)
Notify the application when a scan response data has been sent to an active scanner.
-
enumerator BT_LE_ADV_OPT_SCANNABLE = BIT(9)
Support scan response data.
When used together with BT_LE_ADV_OPT_EXT_ADV then this option cannot be used together with the BT_LE_ADV_OPT_CONNECTABLE option. When used together with BT_LE_ADV_OPT_EXT_ADV then scan response data must be set.
-
enumerator BT_LE_ADV_OPT_EXT_ADV = BIT(10)
Advertise with extended advertising.
This options enables extended advertising in the advertising set. In extended advertising the advertising set will send a small header packet on the three primary advertising channels. This small header points to the advertising data packet that will be sent on one of the 37 secondary advertising channels. The advertiser will send primary advertising on LE 1M PHY, and secondary advertising on LE 2M PHY. Connections will be established on LE 2M PHY.
Without this option the advertiser will send advertising data on the three primary advertising channels.
Note
Enabling this option requires extended advertising support in the peer devices scanning for advertisement packets.
Note
This cannot be used with bt_le_adv_start().
-
enumerator BT_LE_ADV_OPT_NO_2M = BIT(11)
Disable use of LE 2M PHY on the secondary advertising channel.
Disabling the use of LE 2M PHY could be necessary if scanners don’t support the LE 2M PHY. The advertiser will send primary advertising on LE 1M PHY, and secondary advertising on LE 1M PHY. Connections will be established on LE 1M PHY.
Note
Cannot be set if BT_LE_ADV_OPT_CODED is set.
Note
Requires BT_LE_ADV_OPT_EXT_ADV.
-
enumerator BT_LE_ADV_OPT_CODED = BIT(12)
Advertise on the LE Coded PHY (Long Range).
The advertiser will send both primary and secondary advertising on the LE Coded PHY. This gives the advertiser increased range with the trade-off of lower data rate and higher power consumption. Connections will be established on LE Coded PHY.
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
enumerator BT_LE_ADV_OPT_ANONYMOUS = BIT(13)
Advertise without a device address (identity or RPA).
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
enumerator BT_LE_ADV_OPT_USE_TX_POWER = BIT(14)
Advertise with transmit power.
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
enumerator BT_LE_ADV_OPT_FORCE_NAME_IN_AD = BIT(18)
Put GAP device name into advert data.
- Deprecated:
This option will be removed in the near future, see https://github.com/zephyrproject-rtos/zephyr/issues/71686
Will place the GAP device name into the advertising data rather than the scan response data.
Note
Requires BT_LE_ADV_OPT_USE_NAME
-
enumerator BT_LE_ADV_OPT_USE_NRPA = BIT(19)
Advertise using a Non-Resolvable Private Address.
A new NRPA is set when updating the advertising parameters.
This is an advanced feature; most users will want to enable
CONFIG_BT_EXT_ADV
instead.Note
Not implemented when
CONFIG_BT_PRIVACY
.Note
Mutually exclusive with BT_LE_ADV_OPT_USE_IDENTITY.
-
enumerator BT_LE_ADV_OPT_NONE = 0
-
enum [anonymous]
Periodic Advertising options.
Values:
-
enumerator BT_LE_PER_ADV_OPT_NONE = 0
Convenience value when no options are specified.
-
enumerator BT_LE_PER_ADV_OPT_USE_TX_POWER = BIT(1)
Advertise with transmit power.
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
enumerator BT_LE_PER_ADV_OPT_INCLUDE_ADI = BIT(2)
Advertise with included AdvDataInfo (ADI).
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
enumerator BT_LE_PER_ADV_OPT_NONE = 0
-
enum [anonymous]
Periodic advertising sync options.
Values:
-
enumerator BT_LE_PER_ADV_SYNC_OPT_NONE = 0
Convenience value when no options are specified.
-
enumerator BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST = BIT(0)
Use the periodic advertising list to sync with advertiser.
When this option is set, the address and SID of the parameters are ignored.
-
enumerator BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED = BIT(1)
Disables periodic advertising reports.
No advertisement reports will be handled until enabled.
-
enumerator BT_LE_PER_ADV_SYNC_OPT_FILTER_DUPLICATE = BIT(2)
Filter duplicate Periodic Advertising reports.
-
enumerator BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOA = BIT(3)
Sync with Angle of Arrival (AoA) constant tone extension.
-
enumerator BT_LE_PER_ADV_SYNC_OPT_DONT_SYNC_AOD_1US = BIT(4)
Sync with Angle of Departure (AoD) 1 us constant tone extension.
-
enumerator BT_LE_PER_ADV_SYNC_OPT_NONE = 0
-
enum [anonymous]
Periodic Advertising Sync Transfer options.
Values:
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE = 0
Convenience value when no options are specified.
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOA = BIT(0)
No Angle of Arrival (AoA)
Do not sync with Angle of Arrival (AoA) constant tone extension
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_1US = BIT(1)
No Angle of Departure (AoD) 1 us.
Do not sync with Angle of Departure (AoD) 1 us constant tone extension
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_NO_AOD_2US = BIT(2)
No Angle of Departure (AoD) 2.
Do not sync with Angle of Departure (AoD) 2 us constant tone extension
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_SYNC_ONLY_CTE = BIT(3)
Only sync to packets with constant tone extension.
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED = BIT(4)
Sync to received PAST packets but don’t generate sync reports.
This option must not be set at the same time as BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES.
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_FILTER_DUPLICATES = BIT(5)
Sync to received PAST packets and generate sync reports with duplicate filtering.
This option must not be set at the same time as BT_LE_PER_ADV_SYNC_TRANSFER_OPT_REPORTING_INITIALLY_DISABLED.
-
enumerator BT_LE_PER_ADV_SYNC_TRANSFER_OPT_NONE = 0
-
enum [anonymous]
Values:
-
enumerator BT_LE_SCAN_OPT_NONE = 0
Convenience value when no options are specified.
-
enumerator BT_LE_SCAN_OPT_NO_1M = BIT(3)
Disable scan on 1M phy.
Note
Requires BT_LE_SCAN_OPT_CODED.
-
enumerator BT_LE_SCAN_OPT_NONE = 0
-
enum [anonymous]
Values:
-
enumerator BT_LE_SCAN_TYPE_PASSIVE = 0x00
Scan without requesting additional information from advertisers.
-
enumerator BT_LE_SCAN_TYPE_ACTIVE = 0x01
Scan and request additional information from advertisers.
Using this scan type will automatically send scan requests to all devices. Scan responses are received in the same manner and using the same callbacks as advertising reports.
-
enumerator BT_LE_SCAN_TYPE_PASSIVE = 0x00
Functions
-
int bt_enable(bt_ready_cb_t cb)
Enable Bluetooth.
Enable Bluetooth. Must be the called before any calls that require communication with the local Bluetooth hardware.
When
CONFIG_BT_SETTINGS
is enabled, the application must load the Bluetooth settings after this API call successfully completes before Bluetooth APIs can be used. Loading the settings before calling this function is insufficient. Bluetooth settings can be loaded with settings_load() or settings_load_subtree() with argument “bt”. The latter selectively loads only Bluetooth settings and is recommended if settings_load() has been called earlier.- Parameters:
cb – Callback to notify completion or NULL to perform the enabling synchronously.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_disable(void)
Disable Bluetooth.
Disable Bluetooth. Can’t be called before bt_enable has completed.
This API will clear all configured identities and keys that are not persistently stored with
CONFIG_BT_SETTINGS
. These can be restored with settings_load() before reenabling the stack.This API does not clear previously registered callbacks like bt_le_scan_cb_register and bt_conn_cb_register. That is, the application shall not re-register them when the Bluetooth subsystem is re-enabled later.
Close and release HCI resources. Result is architecture dependent.
- Returns:
Zero on success or (negative) error code otherwise.
-
bool bt_is_ready(void)
Check if Bluetooth is ready.
- Returns:
true when Bluetooth is ready, false otherwise
-
int bt_set_name(const char *name)
Set Bluetooth Device Name.
Set Bluetooth GAP Device Name.
When advertising with device name in the advertising data the name should be updated by calling bt_le_adv_update_data or bt_le_ext_adv_set_data.
See also
Note
Requires
CONFIG_BT_DEVICE_NAME_DYNAMIC
.- Parameters:
name – New name
- Returns:
Zero on success or (negative) error code otherwise.
-
const char *bt_get_name(void)
Get Bluetooth Device Name.
Get Bluetooth GAP Device Name.
- Returns:
Bluetooth Device Name
-
uint16_t bt_get_appearance(void)
Get local Bluetooth appearance.
Bluetooth Appearance is a description of the external appearance of a device in terms of an Appearance Value.
- Returns:
Appearance Value of local Bluetooth host.
-
int bt_set_appearance(uint16_t new_appearance)
Set local Bluetooth appearance.
Automatically preserves the new appearance across reboots if
CONFIG_BT_SETTINGS
is enabled.This symbol is linkable if
CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC
is enabled.- Parameters:
new_appearance – Appearance Value
- Return values:
0 – Success.
other – Persistent storage failed. Appearance was not updated.
-
void bt_id_get(bt_addr_le_t *addrs, size_t *count)
Get the currently configured identities.
Returns an array of the currently configured identity addresses. To make sure all available identities can be retrieved, the number of elements in the addrs array should be CONFIG_BT_ID_MAX. The identity identifier that some APIs expect (such as advertising parameters) is simply the index of the identity in the addrs array.
If addrs is passed as NULL, then returned count contains the count of all available identities that can be retrieved with a subsequent call to this function with non-NULL addrs parameter.
Note
Deleted identities may show up as BT_ADDR_LE_ANY in the returned array.
- Parameters:
addrs – Array where to store the configured identities.
count – Should be initialized to the array size. Once the function returns it will contain the number of returned identities.
-
int bt_id_create(bt_addr_le_t *addr, uint8_t *irk)
Create a new identity.
Create a new identity using the given address and IRK. This function can be called before calling bt_enable(). However, the new identity will only be stored persistently in flash when this API is used after bt_enable(). The reason is that the persistent settings are loaded after bt_enable() and would therefore cause potential conflicts with the stack blindly overwriting what’s stored in flash. The identity will also not be written to flash in case a pre-defined address is provided, since in such a situation the app clearly has some place it got the address from and will be able to repeat the procedure on every power cycle, i.e. it would be redundant to also store the information in flash.
Generating random static address or random IRK is not supported when calling this function before bt_enable().
If the application wants to have the stack randomly generate identities and store them in flash for later recovery, the way to do it would be to first initialize the stack (using bt_enable), then call settings_load(), and after that check with bt_id_get() how many identities were recovered. If an insufficient amount of identities were recovered the app may then call bt_id_create() to create new ones.
If supported by the HCI driver (indicated by setting
CONFIG_BT_HCI_SET_PUBLIC_ADDR
), the first call to this function can be used to set the controller’s public identity address. This call must happen before calling bt_enable(). Subsequent calls always add/generate random static addresses.- Parameters:
addr – Address to use for the new identity. If NULL or initialized to BT_ADDR_LE_ANY the stack will generate a new random static address for the identity and copy it to the given parameter upon return from this function (in case the parameter was non-NULL).
irk – Identity Resolving Key (16 bytes) to be used with this identity. If set to all zeroes or NULL, the stack will generate a random IRK for the identity and copy it back to the parameter upon return from this function (in case the parameter was non-NULL). If privacy
CONFIG_BT_PRIVACY
is not enabled this parameter must be NULL.
- Returns:
Identity identifier (>= 0) in case of success, or a negative error code on failure.
-
int bt_id_reset(uint8_t id, bt_addr_le_t *addr, uint8_t *irk)
Reset/reclaim an identity for reuse.
The semantics of the addr and irk parameters of this function are the same as with bt_id_create(). The difference is the first id parameter that needs to be an existing identity (if it doesn’t exist this function will return an error). When given an existing identity this function will disconnect any connections created using it, remove any pairing keys or other data associated with it, and then create a new identity in the same slot, based on the addr and irk parameters.
Note
the default identity (BT_ID_DEFAULT) cannot be reset, i.e. this API will return an error if asked to do that.
- Parameters:
id – Existing identity identifier.
addr – Address to use for the new identity. If NULL or initialized to BT_ADDR_LE_ANY the stack will generate a new static random address for the identity and copy it to the given parameter upon return from this function (in case the parameter was non-NULL).
irk – Identity Resolving Key (16 bytes) to be used with this identity. If set to all zeroes or NULL, the stack will generate a random IRK for the identity and copy it back to the parameter upon return from this function (in case the parameter was non-NULL). If privacy
CONFIG_BT_PRIVACY
is not enabled this parameter must be NULL.
- Returns:
Identity identifier (>= 0) in case of success, or a negative error code on failure.
-
int bt_id_delete(uint8_t id)
Delete an identity.
When given a valid identity this function will disconnect any connections created using it, remove any pairing keys or other data associated with it, and then flag is as deleted, so that it can not be used for any operations. To take back into use the slot the identity was occupying the bt_id_reset() API needs to be used.
Note
the default identity (BT_ID_DEFAULT) cannot be deleted, i.e. this API will return an error if asked to do that.
- Parameters:
id – Existing identity identifier.
- Returns:
0 in case of success, or a negative error code on failure.
-
size_t bt_data_get_len(const struct bt_data data[], size_t data_count)
Get the total size (in bytes) of a given set of bt_data structures.
-
size_t bt_data_serialize(const struct bt_data *input, uint8_t *output)
Serialize a bt_data struct into an advertising structure (a flat byte array).
The data are formatted according to the Bluetooth Core Specification v. 5.4, vol. 3, part C, 11.
- Parameters:
input – [in] Single bt_data structure to read from.
output – [out] Buffer large enough to store the advertising structure in
input
. The size of it must be at least the size of theinput->data_len + 2
(for the type and the length).
- Returns:
Number of bytes written in
output
.
-
int bt_le_adv_start(const struct bt_le_adv_param *param, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len)
Start advertising.
Set advertisement data, scan response data, advertisement parameters and start advertising.
When the advertisement parameter peer address has been set the advertising will be directed to the peer. In this case advertisement data and scan response data parameters are ignored. If the mode is high duty cycle the timeout will be BT_GAP_ADV_HIGH_DUTY_CYCLE_MAX_TIMEOUT.
This function cannot be used with BT_LE_ADV_OPT_EXT_ADV in the
param.options
. For extended advertising, the bt_le_ext_adv_* functions must be used.- Parameters:
param – Advertising parameters.
ad – Data to be used in advertisement packets.
ad_len – Number of elements in ad
sd – Data to be used in scan response packets.
sd_len – Number of elements in sd
- Returns:
Zero on success or (negative) error code otherwise.
- Returns:
-ENOMEM No free connection objects available for connectable advertiser.
- Returns:
-ECONNREFUSED When connectable advertising is requested and there is already maximum number of connections established in the controller. This error code is only guaranteed when using Zephyr controller, for other controllers code returned in this case may be -EIO.
-
int bt_le_adv_update_data(const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len)
Update advertising.
Update advertisement and scan response data.
- Parameters:
ad – Data to be used in advertisement packets.
ad_len – Number of elements in ad
sd – Data to be used in scan response packets.
sd_len – Number of elements in sd
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_adv_stop(void)
Stop advertising.
Stops ongoing advertising.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_ext_adv_create(const struct bt_le_adv_param *param, const struct bt_le_ext_adv_cb *cb, struct bt_le_ext_adv **adv)
Create advertising set.
Create a new advertising set and set advertising parameters. Advertising parameters can be updated with bt_le_ext_adv_update_param.
- Parameters:
param – [in] Advertising parameters.
cb – [in] Callback struct to notify about advertiser activity. Can be NULL. Must point to valid memory during the lifetime of the advertising set.
adv – [out] Valid advertising set object on success.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_ext_adv_start(struct bt_le_ext_adv *adv, const struct bt_le_ext_adv_start_param *param)
Start advertising with the given advertising set.
If the advertiser is limited by either the timeout or number of advertising events the application will be notified by the advertiser sent callback once the limit is reached. If the advertiser is limited by both the timeout and the number of advertising events then the limit that is reached first will stop the advertiser.
- Parameters:
adv – Advertising set object.
param – Advertise start parameters.
-
int bt_le_ext_adv_stop(struct bt_le_ext_adv *adv)
Stop advertising with the given advertising set.
Stop advertising with a specific advertising set. When using this function the advertising sent callback will not be called.
- Parameters:
adv – Advertising set object.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_ext_adv_set_data(struct bt_le_ext_adv *adv, const struct bt_data *ad, size_t ad_len, const struct bt_data *sd, size_t sd_len)
Set an advertising set’s advertising or scan response data.
Set advertisement data or scan response data. If the advertising set is currently advertising then the advertising data will be updated in subsequent advertising events.
When both BT_LE_ADV_OPT_EXT_ADV and BT_LE_ADV_OPT_SCANNABLE are enabled then advertising data is ignored. When BT_LE_ADV_OPT_SCANNABLE is not enabled then scan response data is ignored.
If the advertising set has been configured to send advertising data on the primary advertising channels then the maximum data length is BT_GAP_ADV_MAX_ADV_DATA_LEN bytes. If the advertising set has been configured for extended advertising, then the maximum data length is defined by the controller with the maximum possible of BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN bytes.
Note
Not all scanners support extended data length advertising data.
Note
When updating the advertising data while advertising the advertising data and scan response data length must be smaller or equal to what can be fit in a single advertising packet. Otherwise the advertiser must be stopped.
- Parameters:
adv – Advertising set object.
ad – Data to be used in advertisement packets.
ad_len – Number of elements in ad
sd – Data to be used in scan response packets.
sd_len – Number of elements in sd
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_ext_adv_update_param(struct bt_le_ext_adv *adv, const struct bt_le_adv_param *param)
Update advertising parameters.
Update the advertising parameters. The function will return an error if the advertiser set is currently advertising. Stop the advertising set before calling this function.
Note
When changing the option BT_LE_ADV_OPT_USE_NAME then bt_le_ext_adv_set_data needs to be called in order to update the advertising data and scan response data.
- Parameters:
adv – Advertising set object.
param – Advertising parameters.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_ext_adv_delete(struct bt_le_ext_adv *adv)
Delete advertising set.
Delete advertising set. This will free up the advertising set and make it possible to create a new advertising set.
- Returns:
Zero on success or (negative) error code otherwise.
-
uint8_t bt_le_ext_adv_get_index(struct bt_le_ext_adv *adv)
Get array index of an advertising set.
This function is used to map bt_adv to index of an array of advertising sets. The array has CONFIG_BT_EXT_ADV_MAX_ADV_SET elements.
- Parameters:
adv – Advertising set.
- Returns:
Index of the advertising set object. The range of the returned value is 0..CONFIG_BT_EXT_ADV_MAX_ADV_SET-1
-
int bt_le_ext_adv_get_info(const struct bt_le_ext_adv *adv, struct bt_le_ext_adv_info *info)
Get advertising set info.
- Parameters:
adv – Advertising set object
info – Advertising set info object
- Returns:
Zero on success or (negative) error code on failure.
-
int bt_le_per_adv_set_param(struct bt_le_ext_adv *adv, const struct bt_le_per_adv_param *param)
Set or update the periodic advertising parameters.
The periodic advertising parameters can only be set or updated on an extended advertisement set which is neither scannable, connectable nor anonymous.
- Parameters:
adv – Advertising set object.
param – Advertising parameters.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_set_data(const struct bt_le_ext_adv *adv, const struct bt_data *ad, size_t ad_len)
Set or update the periodic advertising data.
The periodic advertisement data can only be set or updated on an extended advertisement set which is neither scannable, connectable nor anonymous.
- Parameters:
adv – Advertising set object.
ad – Advertising data.
ad_len – Advertising data length.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_set_subevent_data(const struct bt_le_ext_adv *adv, uint8_t num_subevents, const struct bt_le_per_adv_subevent_data_params *params)
Set the periodic advertising with response subevent data.
Set the data for one or more subevents of a Periodic Advertising with Responses Advertiser in reply data request.
- Parameters:
adv – The extended advertiser the PAwR train belongs to.
num_subevents – The number of subevents to set data for.
params – Subevent parameters.
- Pre:
There are
num_subevents
elements inparams
.- Pre:
The controller has requested data for the subevents in
params
.- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_start(struct bt_le_ext_adv *adv)
Starts periodic advertising.
Enabling the periodic advertising can be done independently of extended advertising, but both periodic advertising and extended advertising shall be enabled before any periodic advertising data is sent. The periodic advertising and extended advertising can be enabled in any order.
Once periodic advertising has been enabled, it will continue advertising until bt_le_per_adv_stop() has been called, or if the advertising set is deleted by bt_le_ext_adv_delete(). Calling bt_le_ext_adv_stop() will not stop the periodic advertising.
- Parameters:
adv – Advertising set object.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_stop(struct bt_le_ext_adv *adv)
Stops periodic advertising.
Disabling the periodic advertising can be done independently of extended advertising. Disabling periodic advertising will not disable extended advertising.
- Parameters:
adv – Advertising set object.
- Returns:
Zero on success or (negative) error code otherwise.
-
uint8_t bt_le_per_adv_sync_get_index(struct bt_le_per_adv_sync *per_adv_sync)
Get array index of an periodic advertising sync object.
This function is get the index of an array of periodic advertising sync objects. The array has CONFIG_BT_PER_ADV_SYNC_MAX elements.
- Parameters:
per_adv_sync – The periodic advertising sync object.
- Returns:
Index of the periodic advertising sync object. The range of the returned value is 0..CONFIG_BT_PER_ADV_SYNC_MAX-1
-
struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_index(uint8_t index)
Get a periodic advertising sync object from the array index.
This function is to get the periodic advertising sync object from the array index. The array has CONFIG_BT_PER_ADV_SYNC_MAX elements.
- Parameters:
index – The index of the periodic advertising sync object. The range of the index value is 0..CONFIG_BT_PER_ADV_SYNC_MAX-1
- Returns:
The periodic advertising sync object of the array index or NULL if invalid index.
-
int bt_le_per_adv_sync_get_info(struct bt_le_per_adv_sync *per_adv_sync, struct bt_le_per_adv_sync_info *info)
Get periodic adv sync information.
- Parameters:
per_adv_sync – Periodic advertising sync object.
info – Periodic advertising sync info object
- Returns:
Zero on success or (negative) error code on failure.
-
struct bt_le_per_adv_sync *bt_le_per_adv_sync_lookup_addr(const bt_addr_le_t *adv_addr, uint8_t sid)
Look up an existing periodic advertising sync object by advertiser address.
- Parameters:
adv_addr – Advertiser address.
sid – The advertising set ID.
- Returns:
Periodic advertising sync object or NULL if not found.
-
int bt_le_per_adv_sync_create(const struct bt_le_per_adv_sync_param *param, struct bt_le_per_adv_sync **out_sync)
Create a periodic advertising sync object.
Create a periodic advertising sync object that can try to synchronize to periodic advertising reports from an advertiser. Scan shall either be disabled or extended scan shall be enabled.
This function does not timeout, and will continue to look for an advertiser until it either finds it or bt_le_per_adv_sync_delete() is called. It is thus suggested to implement a timeout when using this, if it is expected to find the advertiser within a reasonable timeframe.
- Parameters:
param – [in] Periodic advertising sync parameters.
out_sync – [out] Periodic advertising sync object on.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_sync_delete(struct bt_le_per_adv_sync *per_adv_sync)
Delete periodic advertising sync.
Delete the periodic advertising sync object. Can be called regardless of the state of the sync. If the syncing is currently syncing, the syncing is cancelled. If the sync has been established, it is terminated. The periodic advertising sync object will be invalidated afterwards.
If the state of the sync object is syncing, then a new periodic advertising sync object may not be created until the controller has finished canceling this object.
- Parameters:
per_adv_sync – The periodic advertising sync object.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_sync_cb_register(struct bt_le_per_adv_sync_cb *cb)
Register periodic advertising sync callbacks.
Adds the callback structure to the list of callback structures for periodic advertising syncs.
This callback will be called for all periodic advertising sync activity, such as synced, terminated and when data is received.
- Parameters:
cb – Callback struct. Must point to memory that remains valid.
- Return values:
0 – Success.
-EEXIST – if
cb
was already registered.
-
int bt_le_per_adv_sync_recv_enable(struct bt_le_per_adv_sync *per_adv_sync)
Enables receiving periodic advertising reports for a sync.
If the sync is already receiving the reports, -EALREADY is returned.
- Parameters:
per_adv_sync – The periodic advertising sync object.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_sync_recv_disable(struct bt_le_per_adv_sync *per_adv_sync)
Disables receiving periodic advertising reports for a sync.
If the sync report receiving is already disabled, -EALREADY is returned.
- Parameters:
per_adv_sync – The periodic advertising sync object.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_sync_transfer(const struct bt_le_per_adv_sync *per_adv_sync, const struct bt_conn *conn, uint16_t service_data)
Transfer the periodic advertising sync information to a peer device.
This will allow another device to quickly synchronize to the same periodic advertising train that this device is currently synced to.
- Parameters:
per_adv_sync – The periodic advertising sync to transfer.
conn – The peer device that will receive the sync information.
service_data – Application service data provided to the remote host.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_set_info_transfer(const struct bt_le_ext_adv *adv, const struct bt_conn *conn, uint16_t service_data)
Transfer the information about a periodic advertising set.
This will allow another device to quickly synchronize to periodic advertising set from this device.
- Parameters:
adv – The periodic advertising set to transfer info of.
conn – The peer device that will receive the information.
service_data – Application service data provided to the remote host.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_sync_transfer_subscribe(const struct bt_conn *conn, const struct bt_le_per_adv_sync_transfer_param *param)
Subscribe to periodic advertising sync transfers (PASTs).
Sets the parameters and allow other devices to transfer periodic advertising syncs.
- Parameters:
conn – The connection to set the parameters for. If NULL default parameters for all connections will be set. Parameters set for specific connection will always have precedence.
param – The periodic advertising sync transfer parameters.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_sync_transfer_unsubscribe(const struct bt_conn *conn)
Unsubscribe from periodic advertising sync transfers (PASTs).
Remove the parameters that allow other devices to transfer periodic advertising syncs.
- Parameters:
conn – The connection to remove the parameters for. If NULL default parameters for all connections will be removed. Unsubscribing for a specific device, will still allow other devices to transfer periodic advertising syncs.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_list_add(const bt_addr_le_t *addr, uint8_t sid)
Add a device to the periodic advertising list.
Add peer device LE address to the periodic advertising list. This will make it possibly to automatically create a periodic advertising sync to this device.
- Parameters:
addr – Bluetooth LE identity address.
sid – The advertising set ID. This value is obtained from the bt_le_scan_recv_info in the scan callback.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_list_remove(const bt_addr_le_t *addr, uint8_t sid)
Remove a device from the periodic advertising list.
Removes peer device LE address from the periodic advertising list.
- Parameters:
addr – Bluetooth LE identity address.
sid – The advertising set ID. This value is obtained from the bt_le_scan_recv_info in the scan callback.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_per_adv_list_clear(void)
Clear the periodic advertising list.
Clears the entire periodic advertising list.
- Returns:
Zero on success or (negative) error code otherwise.
-
int bt_le_scan_start(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb)
Start (LE) scanning.
Start LE scanning with given parameters and provide results through the specified callback.
Note
The LE scanner by default does not use the Identity Address of the local device when
CONFIG_BT_PRIVACY
is disabled. This is to prevent the active scanner from disclosing the identity information when requesting additional information from advertisers. In order to enable directed advertiser reports thenCONFIG_BT_SCAN_WITH_IDENTITY
must be enabled.Note
Setting the
param.timeout
parameter is not supported whenCONFIG_BT_PRIVACY
is enabled, when the param.type is BT_LE_SCAN_TYPE_ACTIVE. Supplying a non-zero timeout will result in an -EINVAL error code.- Parameters:
param – Scan parameters.
cb – Callback to notify scan results. May be NULL if callback registration through bt_le_scan_cb_register is preferred.
- Return values:
-EBUSY – if the scanner is already being started in a different thread.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
int bt_le_scan_stop(void)
Stop (LE) scanning.
Stops ongoing LE scanning.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
int bt_le_scan_cb_register(struct bt_le_scan_cb *cb)
Register scanner packet callbacks.
Adds the callback structure to the list of callback structures that monitors scanner activity.
This callback will be called for all scanner activity, regardless of what API was used to start the scanner.
- Parameters:
cb – Callback struct. Must point to memory that remains valid.
- Return values:
0 – Success.
-EEXIST – if
cb
was already registered.
-
void bt_le_scan_cb_unregister(struct bt_le_scan_cb *cb)
Unregister scanner packet callbacks.
Remove the callback structure from the list of scanner callbacks.
- Parameters:
cb – Callback struct. Must point to memory that remains valid.
-
int bt_le_filter_accept_list_add(const bt_addr_le_t *addr)
Add device (LE) to filter accept list.
Add peer device LE address to the filter accept list.
Note
The filter accept list cannot be modified when an LE role is using the filter accept list, i.e advertiser or scanner using a filter accept list or automatic connecting to devices using filter accept list.
- Parameters:
addr – Bluetooth LE identity address.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
static inline int bt_le_whitelist_add(const bt_addr_le_t *addr)
-
int bt_le_filter_accept_list_remove(const bt_addr_le_t *addr)
Remove device (LE) from filter accept list.
Remove peer device LE address from the filter accept list.
Note
The filter accept list cannot be modified when an LE role is using the filter accept list, i.e advertiser or scanner using a filter accept list or automatic connecting to devices using filter accept list.
- Parameters:
addr – Bluetooth LE identity address.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
static inline int bt_le_whitelist_rem(const bt_addr_le_t *addr)
-
int bt_le_filter_accept_list_clear(void)
Clear filter accept list.
Clear all devices from the filter accept list.
Note
The filter accept list cannot be modified when an LE role is using the filter accept list, i.e advertiser or scanner using a filter accept list or automatic connecting to devices using filter accept list.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
static inline int bt_le_whitelist_clear(void)
-
int bt_le_set_chan_map(uint8_t chan_map[5])
Set (LE) channel map.
- Parameters:
chan_map – Channel map.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
int bt_le_set_rpa_timeout(uint16_t new_rpa_timeout)
Set the Resolvable Private Address timeout in runtime.
The new RPA timeout value will be used for the next RPA rotation and all subsequent rotations until another override is scheduled with this API.
Initially, the if
CONFIG_BT_RPA_TIMEOUT
is used as the RPA timeout.This symbol is linkable if
CONFIG_BT_RPA_TIMEOUT_DYNAMIC
is enabled.- Parameters:
new_rpa_timeout – Resolvable Private Address timeout in seconds
- Return values:
0 – Success.
-EINVAL – RPA timeout value is invalid. Valid range is 1s - 3600s.
-
void bt_data_parse(struct net_buf_simple *ad, bool (*func)(struct bt_data *data, void *user_data), void *user_data)
Helper for parsing advertising (or EIR or OOB) data.
A helper for parsing the basic data types used for Extended Inquiry Response (EIR), Advertising Data (AD), and OOB data blocks. The most common scenario is to call this helper on the advertising data received in the callback that was given to bt_le_scan_start().
Warning
This helper function will consume
ad
when parsing. The user should make a copy if the original data is to be used afterwards- Parameters:
ad – Advertising data as given to the bt_le_scan_cb_t callback.
func – Callback function which will be called for each element that’s found in the data. The callback should return true to continue parsing, or false to stop parsing.
user_data – User data to be passed to the callback.
-
int bt_le_oob_get_local(uint8_t id, struct bt_le_oob *oob)
Get local LE Out of Band (OOB) information.
This function allows to get local information that are useful for Out of Band pairing or connection creation.
If privacy
CONFIG_BT_PRIVACY
is enabled this will result in generating new Resolvable Private Address (RPA) that is valid forCONFIG_BT_RPA_TIMEOUT
seconds. This address will be used for advertising started by bt_le_adv_start, active scanning and connection creation.Note
If privacy is enabled the RPA cannot be refreshed in the following cases:
Creating a connection in progress, wait for the connected callback. In addition when extended advertising
CONFIG_BT_EXT_ADV
is not enabled or not supported by the controller:Advertiser is enabled using a Random Static Identity Address for a different local identity.
The local identity conflicts with the local identity used by other roles.
- Parameters:
id – [in] Local identity, in most cases BT_ID_DEFAULT.
oob – [out] LE OOB information
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
int bt_le_ext_adv_oob_get_local(struct bt_le_ext_adv *adv, struct bt_le_oob *oob)
Get local LE Out of Band (OOB) information.
This function allows to get local information that are useful for Out of Band pairing or connection creation.
If privacy
CONFIG_BT_PRIVACY
is enabled this will result in generating new Resolvable Private Address (RPA) that is valid forCONFIG_BT_RPA_TIMEOUT
seconds. This address will be used by the advertising set.Note
When generating OOB information for multiple advertising set all OOB information needs to be generated at the same time.
Note
If privacy is enabled the RPA cannot be refreshed in the following cases:
Creating a connection in progress, wait for the connected callback.
- Parameters:
adv – [in] The advertising set object
oob – [out] LE OOB information
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
int bt_br_discovery_start(const struct bt_br_discovery_param *param, struct bt_br_discovery_result *results, size_t count, bt_br_discovery_cb_t cb)
Start BR/EDR discovery.
Start BR/EDR discovery (inquiry) and provide results through the specified callback. When bt_br_discovery_cb_t is called it indicates that discovery has completed. If more inquiry results were received during session than fits in provided result storage, only ones with highest RSSI will be reported.
- Parameters:
param – Discovery parameters.
results – Storage for discovery results.
count – Number of results in storage. Valid range: 1-255.
cb – Callback to notify discovery results.
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error
-
int bt_br_discovery_stop(void)
Stop BR/EDR discovery.
Stops ongoing BR/EDR discovery. If discovery was stopped by this call results won’t be reported
- Returns:
Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error.
-
int bt_br_oob_get_local(struct bt_br_oob *oob)
Get BR/EDR local Out Of Band information.
This function allows to get local controller information that are useful for Out Of Band pairing or connection creation process.
- Parameters:
oob – Out Of Band information
-
int bt_br_set_discoverable(bool enable)
Enable/disable set controller in discoverable state.
Allows make local controller to listen on INQUIRY SCAN channel and responds to devices making general inquiry. To enable this state it’s mandatory to first be in connectable state.
- Parameters:
enable – Value allowing/disallowing controller to become discoverable.
- Returns:
Negative if fail set to requested state or requested state has been already set. Zero if done successfully.
-
int bt_br_set_connectable(bool enable)
Enable/disable set controller in connectable state.
Allows make local controller to be connectable. It means the controller start listen to devices requests on PAGE SCAN channel. If disabled also resets discoverability if was set.
- Parameters:
enable – Value allowing/disallowing controller to be connectable.
- Returns:
Negative if fail set to requested state or requested state has been already set. Zero if done successfully.
-
int bt_unpair(uint8_t id, const bt_addr_le_t *addr)
Clear pairing information.
- Parameters:
id – Local identity (mostly just BT_ID_DEFAULT).
addr – Remote address, NULL or BT_ADDR_LE_ANY to clear all remote devices.
- Returns:
0 on success or negative error value on failure.
-
void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info, void *user_data), void *user_data)
Iterate through all existing bonds.
- Parameters:
id – Local identity (mostly just BT_ID_DEFAULT).
func – Function to call for each bond.
user_data – Data to pass to the callback function.
-
int bt_configure_data_path(uint8_t dir, uint8_t id, uint8_t vs_config_len, const uint8_t *vs_config)
Configure vendor data path.
Request the Controller to configure the data transport path in a given direction between the Controller and the Host.
- Parameters:
dir – Direction to be configured, BT_HCI_DATAPATH_DIR_HOST_TO_CTLR or BT_HCI_DATAPATH_DIR_CTLR_TO_HOST
id – Vendor specific logical transport channel ID, range [BT_HCI_DATAPATH_ID_VS..BT_HCI_DATAPATH_ID_VS_END]
vs_config_len – Length of additional vendor specific configuration data
vs_config – Pointer to additional vendor specific configuration data
- Returns:
0 in case of success or negative value in case of error.
-
int bt_le_per_adv_sync_subevent(struct bt_le_per_adv_sync *per_adv_sync, struct bt_le_per_adv_sync_subevent_params *params)
Synchronize with a subset of subevents.
Until this command is issued, the subevent(s) the controller is synchronized to is unspecified.
- Parameters:
per_adv_sync – The periodic advertising sync object.
params – Parameters.
- Returns:
0 in case of success or negative value in case of error.
-
int bt_le_per_adv_set_response_data(struct bt_le_per_adv_sync *per_adv_sync, const struct bt_le_per_adv_response_params *params, const struct net_buf_simple *data)
Set the data for a response slot in a specific subevent of the PAwR.
This function is called by the application to set the response data. The data for a response slot shall be transmitted only once.
- Parameters:
per_adv_sync – The periodic advertising sync object.
params – Parameters.
data – The response data to send.
- Returns:
Zero on success or (negative) error code otherwise.
-
struct bt_le_ext_adv_sent_info
- #include <bluetooth.h>
Public Members
-
uint8_t num_sent
The number of advertising events completed.
-
uint8_t num_sent
-
struct bt_le_ext_adv_connected_info
- #include <bluetooth.h>
Public Members
-
struct bt_conn *conn
Connection object of the new connection.
-
struct bt_conn *conn
-
struct bt_le_ext_adv_scanned_info
- #include <bluetooth.h>
Public Members
-
bt_addr_le_t *addr
Active scanner LE address and type.
-
bt_addr_le_t *addr
-
struct bt_le_per_adv_data_request
- #include <bluetooth.h>
-
struct bt_le_per_adv_response_info
- #include <bluetooth.h>
Public Members
-
uint8_t subevent
The subevent the response was received in.
-
uint8_t tx_status
Status of the subevent indication.
0 if subevent indication was transmitted. 1 if subevent indication was not transmitted. All other values RFU.
-
int8_t tx_power
The TX power of the response in dBm.
-
int8_t rssi
The RSSI of the response in dBm.
-
uint8_t cte_type
The Constant Tone Extension (CTE) of the advertisement (bt_df_cte_type)
-
uint8_t response_slot
The slot the response was received in.
-
uint8_t subevent
-
struct bt_le_ext_adv_cb
- #include <bluetooth.h>
Public Members
-
void (*sent)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_sent_info *info)
The advertising set has finished sending adv data.
This callback notifies the application that the advertising set has finished sending advertising data. The advertising set can either have been stopped by a timeout or because the specified number of advertising events has been reached.
- Param adv:
The advertising set object.
- Param info:
Information about the sent event.
-
void (*connected)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_connected_info *info)
The advertising set has accepted a new connection.
This callback notifies the application that the advertising set has accepted a new connection.
- Param adv:
The advertising set object.
- Param info:
Information about the connected event.
-
void (*scanned)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_scanned_info *info)
The advertising set has sent scan response data.
This callback notifies the application that the advertising set has has received a Scan Request packet, and has sent a Scan Response packet.
- Param adv:
The advertising set object.
- Param addr:
Information about the scanned event.
-
void (*sent)(struct bt_le_ext_adv *adv, struct bt_le_ext_adv_sent_info *info)
-
struct bt_data
- #include <bluetooth.h>
Bluetooth data.
Description of different data types that can be encoded into advertising data. Used to form arrays that are passed to the bt_le_adv_start() function.
-
struct bt_le_adv_param
- #include <bluetooth.h>
LE Advertising Parameters.
Public Members
-
uint8_t id
Local identity.
Note
When extended advertising
CONFIG_BT_EXT_ADV
is not enabled or not supported by the controller it is not possible to scan and advertise simultaneously using two different random addresses.
-
uint8_t sid
Advertising Set Identifier, valid range 0x00 - 0x0f.
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
uint8_t secondary_max_skip
Secondary channel maximum skip count.
Maximum advertising events the advertiser can skip before it must send advertising data on the secondary advertising channel.
Note
Requires BT_LE_ADV_OPT_EXT_ADV
-
uint32_t options
Bit-field of advertising options.
-
uint32_t interval_min
Minimum Advertising Interval (N * 0.625 milliseconds) Minimum Advertising Interval shall be less than or equal to the Maximum Advertising Interval.
The Minimum Advertising Interval and Maximum Advertising Interval should not be the same value (as stated in Bluetooth Core Spec 5.2, section 7.8.5) Range: 0x0020 to 0x4000
-
uint32_t interval_max
Maximum Advertising Interval (N * 0.625 milliseconds) Minimum Advertising Interval shall be less than or equal to the Maximum Advertising Interval.
The Minimum Advertising Interval and Maximum Advertising Interval should not be the same value (as stated in Bluetooth Core Spec 5.2, section 7.8.5) Range: 0x0020 to 0x4000
-
const bt_addr_le_t *peer
Directed advertising to peer.
When this parameter is set the advertiser will send directed advertising to the remote device.
The advertising type will either be high duty cycle, or low duty cycle if the BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY option is enabled. When using BT_LE_ADV_OPT_EXT_ADV then only low duty cycle is allowed.
In case of connectable high duty cycle if the connection could not be established within the timeout the connected() callback will be called with the status set to BT_HCI_ERR_ADV_TIMEOUT.
-
uint8_t id
-
struct bt_le_per_adv_param
- #include <bluetooth.h>
Public Members
-
uint16_t interval_min
Minimum Periodic Advertising Interval (N * 1.25 ms)
Shall be greater or equal to BT_GAP_PER_ADV_MIN_INTERVAL and less or equal to interval_max.
-
uint16_t interval_max
Maximum Periodic Advertising Interval (N * 1.25 ms)
Shall be less or equal to BT_GAP_PER_ADV_MAX_INTERVAL and greater or equal to interval_min.
-
uint32_t options
Bit-field of periodic advertising options.
-
uint16_t interval_min
-
struct bt_le_ext_adv_start_param
- #include <bluetooth.h>
Public Members
-
uint16_t timeout
Advertiser timeout (N * 10 ms).
Application will be notified by the advertiser sent callback. Set to zero for no timeout.
When using high duty cycle directed connectable advertising then this parameters must be set to a non-zero value less than or equal to the maximum of BT_GAP_ADV_HIGH_DUTY_CYCLE_MAX_TIMEOUT.
If privacy
CONFIG_BT_PRIVACY
is enabled then the timeout must be less thanCONFIG_BT_RPA_TIMEOUT
.
-
uint8_t num_events
Number of advertising events.
Application will be notified by the advertiser sent callback. Set to zero for no limit.
-
uint16_t timeout
-
struct bt_le_ext_adv_info
- #include <bluetooth.h>
Advertising set info structure.
Public Members
-
int8_t tx_power
Currently selected Transmit Power (dBM).
-
const bt_addr_le_t *addr
Current local advertising address used.
-
int8_t tx_power
-
struct bt_le_per_adv_subevent_data_params
- #include <bluetooth.h>
Public Members
-
uint8_t subevent
The subevent to set data for.
-
uint8_t response_slot_start
The first response slot to listen to.
-
uint8_t response_slot_count
The number of response slots to listen to.
-
const struct net_buf_simple *data
The data to send.
-
uint8_t subevent
-
struct bt_le_per_adv_sync_synced_info
- #include <bluetooth.h>
Public Members
-
const bt_addr_le_t *addr
Advertiser LE address and type.
-
uint8_t sid
Advertiser SID.
-
uint16_t interval
Periodic advertising interval (N * 1.25 ms)
-
uint8_t phy
Advertiser PHY.
-
bool recv_enabled
True if receiving periodic advertisements, false otherwise.
-
uint16_t service_data
Service Data provided by the peer when sync is transferred.
Will always be 0 when the sync is locally created.
-
struct bt_conn *conn
Peer that transferred the periodic advertising sync.
Will always be 0 when the sync is locally created.
-
const bt_addr_le_t *addr
-
struct bt_le_per_adv_sync_term_info
- #include <bluetooth.h>
Public Members
-
const bt_addr_le_t *addr
Advertiser LE address and type.
-
uint8_t sid
Advertiser SID.
-
uint8_t reason
Cause of periodic advertising termination.
-
const bt_addr_le_t *addr
-
struct bt_le_per_adv_sync_recv_info
- #include <bluetooth.h>
Public Members
-
const bt_addr_le_t *addr
Advertiser LE address and type.
-
uint8_t sid
Advertiser SID.
-
int8_t tx_power
The TX power of the advertisement.
-
int8_t rssi
The RSSI of the advertisement excluding any CTE.
-
uint8_t cte_type
The Constant Tone Extension (CTE) of the advertisement (bt_df_cte_type)
-
const bt_addr_le_t *addr
-
struct bt_le_per_adv_sync_state_info
- #include <bluetooth.h>
Public Members
-
bool recv_enabled
True if receiving periodic advertisements, false otherwise.
-
bool recv_enabled
-
struct bt_le_per_adv_sync_cb
- #include <bluetooth.h>
Public Members
-
void (*synced)(struct bt_le_per_adv_sync *sync, struct bt_le_per_adv_sync_synced_info *info)
The periodic advertising has been successfully synced.
This callback notifies the application that the periodic advertising set has been successfully synced, and will now start to receive periodic advertising reports.
- Param sync:
The periodic advertising sync object.
- Param info:
Information about the sync event.
-
void (*term)(struct bt_le_per_adv_sync *sync, const struct bt_le_per_adv_sync_term_info *info)
The periodic advertising sync has been terminated.
This callback notifies the application that the periodic advertising sync has been terminated, either by local request, remote request or because due to missing data, e.g. by being out of range or sync.
- Param sync:
The periodic advertising sync object.
-
void (*recv)(struct bt_le_per_adv_sync *sync, const struct bt_le_per_adv_sync_recv_info *info, struct net_buf_simple *buf)
Periodic advertising data received.
This callback notifies the application of an periodic advertising report.
- Param sync:
The advertising set object.
- Param info:
Information about the periodic advertising event.
- Param buf:
Buffer containing the periodic advertising data. NULL if the controller failed to receive a subevent indication. Only happens if
CONFIG_BT_PER_ADV_SYNC_RSP
is enabled.
-
void (*state_changed)(struct bt_le_per_adv_sync *sync, const struct bt_le_per_adv_sync_state_info *info)
The periodic advertising sync state has changed.
This callback notifies the application about changes to the sync state. Initialize sync and termination is handled by their individual callbacks, and won’t be notified here.
- Param sync:
The periodic advertising sync object.
- Param info:
Information about the state change.
-
void (*biginfo)(struct bt_le_per_adv_sync *sync, const struct bt_iso_biginfo *biginfo)
BIGInfo advertising report received.
This callback notifies the application of a BIGInfo advertising report. This is received if the advertiser is broadcasting isochronous streams in a BIG. See iso.h for more information.
- Param sync:
The advertising set object.
- Param biginfo:
The BIGInfo report.
-
void (*cte_report_cb)(struct bt_le_per_adv_sync *sync, struct bt_df_per_adv_sync_iq_samples_report const *info)
Callback for IQ samples report collected when sampling CTE received with periodic advertising PDU.
- Param sync:
The periodic advertising sync object.
- Param info:
Information about the sync event.
-
void (*synced)(struct bt_le_per_adv_sync *sync, struct bt_le_per_adv_sync_synced_info *info)
-
struct bt_le_per_adv_sync_param
- #include <bluetooth.h>
Public Members
-
bt_addr_le_t addr
Periodic Advertiser Address.
Only valid if not using the periodic advertising list (BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST)
-
uint8_t sid
Advertiser SID.
Only valid if not using the periodic advertising list (BT_LE_PER_ADV_SYNC_OPT_USE_PER_ADV_LIST)
-
uint32_t options
Bit-field of periodic advertising sync options.
-
uint16_t skip
Maximum event skip.
Maximum number of periodic advertising events that can be skipped after a successful receive. Range: 0x0000 to 0x01F3
-
uint16_t timeout
Synchronization timeout (N * 10 ms)
Synchronization timeout for the periodic advertising sync. Range 0x000A to 0x4000 (100 ms to 163840 ms)
-
bt_addr_le_t addr
-
struct bt_le_per_adv_sync_info
- #include <bluetooth.h>
Advertising set info structure.
Public Members
-
bt_addr_le_t addr
Periodic Advertiser Address.
-
uint8_t sid
Advertiser SID.
-
uint16_t interval
Periodic advertising interval (N * 1.25 ms)
-
uint8_t phy
Advertiser PHY.
-
bt_addr_le_t addr
-
struct bt_le_per_adv_sync_transfer_param
- #include <bluetooth.h>
Public Members
-
uint16_t skip
Maximum event skip.
The number of periodic advertising packets that can be skipped after a successful receive.
-
uint16_t timeout
Synchronization timeout (N * 10 ms)
Synchronization timeout for the periodic advertising sync. Range 0x000A to 0x4000 (100 ms to 163840 ms)
-
uint32_t options
Periodic Advertising Sync Transfer options.
-
uint16_t skip
-
struct bt_le_scan_param
- #include <bluetooth.h>
LE scan parameters.
Public Members
-
uint8_t type
Scan type (BT_LE_SCAN_TYPE_ACTIVE or BT_LE_SCAN_TYPE_PASSIVE)
-
uint32_t options
Bit-field of scanning options.
-
uint16_t interval
Scan interval (N * 0.625 ms)
-
uint16_t window
Scan window (N * 0.625 ms)
-
uint16_t timeout
Scan timeout (N * 10 ms)
Application will be notified by the scan timeout callback. Set zero to disable timeout.
-
uint16_t interval_coded
Scan interval LE Coded PHY (N * 0.625 MS)
Set zero to use same as LE 1M PHY scan interval.
-
uint16_t window_coded
Scan window LE Coded PHY (N * 0.625 MS)
Set zero to use same as LE 1M PHY scan window.
-
uint8_t type
-
struct bt_le_scan_recv_info
- #include <bluetooth.h>
LE advertisement and scan response packet information.
Public Members
-
const bt_addr_le_t *addr
Advertiser LE address and type.
If advertiser is anonymous then this address will be BT_ADDR_LE_ANY.
-
uint8_t sid
Advertising Set Identifier.
-
int8_t rssi
Strength of advertiser signal.
-
int8_t tx_power
Transmit power of the advertiser.
-
uint8_t adv_type
Advertising packet type.
Uses the BT_GAP_ADV_TYPE_* value.
May indicate that this is a scan response if the type is BT_GAP_ADV_TYPE_SCAN_RSP.
-
uint16_t adv_props
Advertising packet properties bitfield.
Uses the BT_GAP_ADV_PROP_* values. May indicate that this is a scan response if the value contains the BT_GAP_ADV_PROP_SCAN_RESPONSE bit.
-
uint16_t interval
Periodic advertising interval (N * 1.25 ms).
If 0 there is no periodic advertising.
-
uint8_t primary_phy
Primary advertising channel PHY.
-
uint8_t secondary_phy
Secondary advertising channel PHY.
-
const bt_addr_le_t *addr
-
struct bt_le_scan_cb
- #include <bluetooth.h>
Listener context for (LE) scanning.
Public Members
-
void (*recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf)
Advertisement packet and scan response received callback.
- Param info:
Advertiser packet and scan response information.
- Param buf:
Buffer containing advertiser data.
-
void (*timeout)(void)
The scanner has stopped scanning after scan timeout.
-
void (*recv)(const struct bt_le_scan_recv_info *info, struct net_buf_simple *buf)
-
struct bt_le_oob_sc_data
- #include <bluetooth.h>
LE Secure Connections pairing Out of Band data.
-
struct bt_le_oob
- #include <bluetooth.h>
LE Out of Band information.
Public Members
-
bt_addr_le_t addr
LE address.
If privacy is enabled this is a Resolvable Private Address.
-
struct bt_le_oob_sc_data le_sc_data
LE Secure Connections pairing Out of Band data.
-
bt_addr_le_t addr
-
struct bt_br_discovery_result
- #include <bluetooth.h>
BR/EDR discovery result structure.
-
struct bt_br_discovery_param
- #include <bluetooth.h>
BR/EDR discovery parameters.
-
struct bt_br_oob
- #include <bluetooth.h>
-
struct bt_bond_info
- #include <bluetooth.h>
Information about a bond with a remote device.
Public Members
-
bt_addr_le_t addr
Address of the remote device.
-
bt_addr_le_t addr
-
struct bt_le_per_adv_sync_subevent_params
- #include <bluetooth.h>
Public Members
-
uint16_t properties
Periodic Advertising Properties.
Bit 6 is include TxPower, all others RFU.
-
uint8_t num_subevents
Number of subevents to sync to.
-
uint8_t *subevents
The subevent(s) to synchronize with.
The array must have num_subevents elements.
-
uint16_t properties
-
struct bt_le_per_adv_response_params
- #include <bluetooth.h>
Public Members
-
uint16_t request_event
The periodic event counter of the request the response is sent to.
Note
The response can be sent up to one periodic interval after the request was received.
-
uint8_t request_subevent
The subevent counter of the request the response is sent to.
-
uint8_t response_subevent
The subevent the response shall be sent in.
-
uint8_t response_slot
The response slot the response shall be sent in.
-
uint16_t request_event
- group bt_addr
Bluetooth device address definitions and utilities.
Defines
-
BT_ADDR_LE_PUBLIC
-
BT_ADDR_LE_RANDOM
-
BT_ADDR_LE_PUBLIC_ID
-
BT_ADDR_LE_RANDOM_ID
-
BT_ADDR_LE_UNRESOLVED
-
BT_ADDR_LE_ANONYMOUS
-
BT_ADDR_SIZE
Length in bytes of a standard Bluetooth address.
-
BT_ADDR_LE_SIZE
Length in bytes of an LE Bluetooth address.
Not packed, so no sizeof()
-
BT_ADDR_ANY
Bluetooth device “any” address, not a valid address.
-
BT_ADDR_NONE
Bluetooth device “none” address, not a valid address.
-
BT_ADDR_LE_ANY
Bluetooth LE device “any” address, not a valid address.
-
BT_ADDR_LE_NONE
Bluetooth LE device “none” address, not a valid address.
-
BT_ADDR_IS_RPA(a)
Check if a Bluetooth LE random address is resolvable private address.
-
BT_ADDR_IS_NRPA(a)
Check if a Bluetooth LE random address is a non-resolvable private address.
-
BT_ADDR_IS_STATIC(a)
Check if a Bluetooth LE random address is a static address.
-
BT_ADDR_SET_RPA(a)
Set a Bluetooth LE random address as a resolvable private address.
-
BT_ADDR_SET_NRPA(a)
Set a Bluetooth LE random address as a non-resolvable private address.
-
BT_ADDR_SET_STATIC(a)
Set a Bluetooth LE random address as a static address.
-
BT_ADDR_STR_LEN
Recommended length of user string buffer for Bluetooth address.
The recommended length guarantee the output of address conversion will not lose valuable information about address being processed.
-
BT_ADDR_LE_STR_LEN
Recommended length of user string buffer for Bluetooth LE address.
The recommended length guarantee the output of address conversion will not lose valuable information about address being processed.
Functions
-
static inline int bt_addr_cmp(const bt_addr_t *a, const bt_addr_t *b)
Compare Bluetooth device addresses.
- Parameters:
a – First Bluetooth device address to compare
b – Second Bluetooth device address to compare
- Returns:
negative value if a < b, 0 if a == b, else positive
-
static inline bool bt_addr_eq(const bt_addr_t *a, const bt_addr_t *b)
Determine equality of two Bluetooth device addresses.
- Return values:
true – if the two addresses are equal
false – otherwise
-
static inline int bt_addr_le_cmp(const bt_addr_le_t *a, const bt_addr_le_t *b)
Compare Bluetooth LE device addresses.
See also
- Parameters:
a – First Bluetooth LE device address to compare
b – Second Bluetooth LE device address to compare
- Returns:
negative value if a < b, 0 if a == b, else positive
-
static inline bool bt_addr_le_eq(const bt_addr_le_t *a, const bt_addr_le_t *b)
Determine equality of two Bluetooth LE device addresses.
The Bluetooth LE addresses are equal if and only if both the types and the 48-bit addresses are numerically equal.
- Return values:
true – if the two addresses are equal
false – otherwise
-
static inline void bt_addr_copy(bt_addr_t *dst, const bt_addr_t *src)
Copy Bluetooth device address.
- Parameters:
dst – Bluetooth device address destination buffer.
src – Bluetooth device address source buffer.
-
static inline void bt_addr_le_copy(bt_addr_le_t *dst, const bt_addr_le_t *src)
Copy Bluetooth LE device address.
- Parameters:
dst – Bluetooth LE device address destination buffer.
src – Bluetooth LE device address source buffer.
-
int bt_addr_le_create_nrpa(bt_addr_le_t *addr)
Create a Bluetooth LE random non-resolvable private address.
-
int bt_addr_le_create_static(bt_addr_le_t *addr)
Create a Bluetooth LE random static address.
-
static inline bool bt_addr_le_is_rpa(const bt_addr_le_t *addr)
Check if a Bluetooth LE address is a random private resolvable address.
- Parameters:
addr – Bluetooth LE device address.
- Returns:
true if address is a random private resolvable address.
-
static inline bool bt_addr_le_is_identity(const bt_addr_le_t *addr)
Check if a Bluetooth LE address is valid identity address.
Valid Bluetooth LE identity addresses are either public address or random static address.
- Parameters:
addr – Bluetooth LE device address.
- Returns:
true if address is a valid identity address.
-
static inline int bt_addr_to_str(const bt_addr_t *addr, char *str, size_t len)
Converts binary Bluetooth address to string.
- Parameters:
addr – Address of buffer containing binary Bluetooth address.
str – Address of user buffer with enough room to store formatted string containing binary address.
len – Length of data to be copied to user string buffer. Refer to BT_ADDR_STR_LEN about recommended value.
- Returns:
Number of successfully formatted bytes from binary address.
-
static inline int bt_addr_le_to_str(const bt_addr_le_t *addr, char *str, size_t len)
Converts binary LE Bluetooth address to string.
- Parameters:
addr – Address of buffer containing binary LE Bluetooth address.
str – Address of user buffer with enough room to store formatted string containing binary LE address.
len – Length of data to be copied to user string buffer. Refer to BT_ADDR_LE_STR_LEN about recommended value.
- Returns:
Number of successfully formatted bytes from binary address.
-
int bt_addr_from_str(const char *str, bt_addr_t *addr)
Convert Bluetooth address from string to binary.
- Parameters:
str – [in] The string representation of a Bluetooth address.
addr – [out] Address of buffer to store the Bluetooth address
- Return values:
0 – Success. The parsed address is stored in
addr
.- Returns:
-EINVAL Invalid address string.
str
is not a well-formed Bluetooth address.
-
int bt_addr_le_from_str(const char *str, const char *type, bt_addr_le_t *addr)
Convert LE Bluetooth address from string to binary.
- Parameters:
str – [in] The string representation of an LE Bluetooth address.
type – [in] The string representation of the LE Bluetooth address type.
addr – [out] Address of buffer to store the LE Bluetooth address
- Returns:
Zero on success or (negative) error code otherwise.
-
struct bt_addr_t
- #include <addr.h>
Bluetooth Device Address.
-
struct bt_addr_le_t
- #include <addr.h>
Bluetooth LE Device Address.
-
BT_ADDR_LE_PUBLIC
- group bt_gap_defines
Bluetooth Generic Access Profile defines and Assigned Numbers.
Company Identifiers (see Bluetooth Assigned Numbers)
-
BT_COMP_ID_LF
The Linux Foundation.
EIR/AD data type definitions
-
BT_DATA_FLAGS
AD flags.
-
BT_DATA_UUID16_SOME
16-bit UUID, more available
-
BT_DATA_UUID16_ALL
16-bit UUID, all listed
-
BT_DATA_UUID32_SOME
32-bit UUID, more available
-
BT_DATA_UUID32_ALL
32-bit UUID, all listed
-
BT_DATA_UUID128_SOME
128-bit UUID, more available
-
BT_DATA_UUID128_ALL
128-bit UUID, all listed
-
BT_DATA_NAME_SHORTENED
Shortened name.
-
BT_DATA_NAME_COMPLETE
Complete name.
-
BT_DATA_TX_POWER
Tx Power.
-
BT_DATA_SM_TK_VALUE
Security Manager TK Value.
-
BT_DATA_SM_OOB_FLAGS
Security Manager OOB Flags.
-
BT_DATA_PERIPHERAL_INT_RANGE
Peripheral Connection Interval Range.
-
BT_DATA_SOLICIT16
Solicit UUIDs, 16-bit.
-
BT_DATA_SOLICIT128
Solicit UUIDs, 128-bit.
-
BT_DATA_SVC_DATA16
Service data, 16-bit UUID.
-
BT_DATA_PUB_TARGET_ADDR
Public Target Address.
-
BT_DATA_RAND_TARGET_ADDR
Random Target Address.
-
BT_DATA_GAP_APPEARANCE
GAP appearance.
-
BT_DATA_ADV_INT
Advertising Interval.
-
BT_DATA_LE_BT_DEVICE_ADDRESS
LE Bluetooth Device Address.
-
BT_DATA_LE_ROLE
LE Role.
-
BT_DATA_SIMPLE_PAIRING_HASH
Simple Pairing Hash C256.
-
BT_DATA_SIMPLE_PAIRING_RAND
Simple Pairing Randomizer R256.
-
BT_DATA_SOLICIT32
Solicit UUIDs, 32-bit.
-
BT_DATA_SVC_DATA32
Service data, 32-bit UUID.
-
BT_DATA_SVC_DATA128
Service data, 128-bit UUID.
-
BT_DATA_LE_SC_CONFIRM_VALUE
LE SC Confirmation Value.
-
BT_DATA_LE_SC_RANDOM_VALUE
LE SC Random Value.
-
BT_DATA_URI
URI.
-
BT_DATA_INDOOR_POS
Indoor Positioning.
-
BT_DATA_TRANS_DISCOVER_DATA
Transport Discovery Data.
-
BT_DATA_LE_SUPPORTED_FEATURES
LE Supported Features.
-
BT_DATA_CHANNEL_MAP_UPDATE_IND
Channel Map Update Indication.
-
BT_DATA_MESH_PROV
Mesh Provisioning PDU.
-
BT_DATA_MESH_MESSAGE
Mesh Networking PDU.
-
BT_DATA_MESH_BEACON
Mesh Beacon.
-
BT_DATA_BIG_INFO
BIGInfo.
-
BT_DATA_BROADCAST_CODE
Broadcast Code.
-
BT_DATA_CSIS_RSI
CSIS Random Set ID type.
-
BT_DATA_ADV_INT_LONG
Advertising Interval long.
-
BT_DATA_BROADCAST_NAME
Broadcast Name.
-
BT_DATA_ENCRYPTED_AD_DATA
Encrypted Advertising Data.
-
BT_DATA_3D_INFO
3D Information Data
-
BT_DATA_MANUFACTURER_DATA
Manufacturer Specific Data.
-
BT_LE_AD_LIMITED
Limited Discoverable.
-
BT_LE_AD_GENERAL
General Discoverable.
-
BT_LE_AD_NO_BREDR
BR/EDR not supported.
Appearance Values
Last Modified on 2023-01-05
-
BT_APPEARANCE_UNKNOWN
Generic Unknown.
-
BT_APPEARANCE_GENERIC_PHONE
Generic Phone.
-
BT_APPEARANCE_GENERIC_COMPUTER
Generic Computer.
-
BT_APPEARANCE_COMPUTER_DESKTOP_WORKSTATION
Desktop Workstation.
-
BT_APPEARANCE_COMPUTER_SERVER_CLASS
Server-class Computer.
-
BT_APPEARANCE_COMPUTER_LAPTOP
Laptop.
-
BT_APPEARANCE_COMPUTER_HANDHELD_PCPDA
Handheld PC/PDA (clamshell)
-
BT_APPEARANCE_COMPUTER_PALMSIZE_PCPDA
Palmsize PC/PDA.
-
BT_APPEARANCE_COMPUTER_WEARABLE_COMPUTER
Wearable computer (watch size)
-
BT_APPEARANCE_COMPUTER_TABLET
Tablet.
-
BT_APPEARANCE_COMPUTER_DOCKING_STATION
Docking Station.
-
BT_APPEARANCE_COMPUTER_ALL_IN_ONE
All in One.
-
BT_APPEARANCE_COMPUTER_BLADE_SERVER
Blade Server.
-
BT_APPEARANCE_COMPUTER_CONVERTIBLE
Convertible.
-
BT_APPEARANCE_COMPUTER_DETACHABLE
Detachable.
-
BT_APPEARANCE_COMPUTER_IOT_GATEWAY
IoT Gateway.
-
BT_APPEARANCE_COMPUTER_MINI_PC
Mini PC.
-
BT_APPEARANCE_COMPUTER_STICK_PC
Stick PC.
-
BT_APPEARANCE_GENERIC_WATCH
Generic Watch.
-
BT_APPEARANCE_SPORTS_WATCH
Sports Watch.
-
BT_APPEARANCE_SMARTWATCH
Smartwatch.
-
BT_APPEARANCE_GENERIC_CLOCK
Generic Clock.
-
BT_APPEARANCE_GENERIC_DISPLAY
Generic Display.
-
BT_APPEARANCE_GENERIC_REMOTE
Generic Remote Control.
-
BT_APPEARANCE_GENERIC_EYEGLASSES
Generic Eye-glasses.
-
BT_APPEARANCE_GENERIC_TAG
Generic Tag.
-
BT_APPEARANCE_GENERIC_KEYRING
Generic Keyring.
-
BT_APPEARANCE_GENERIC_MEDIA_PLAYER
Generic Media Player.
-
BT_APPEARANCE_GENERIC_BARCODE_SCANNER
Generic Barcode Scanner.
-
BT_APPEARANCE_GENERIC_THERMOMETER
Generic Thermometer.
-
BT_APPEARANCE_THERMOMETER_EAR
Ear Thermometer.
-
BT_APPEARANCE_GENERIC_HEART_RATE
Generic Heart Rate Sensor.
-
BT_APPEARANCE_HEART_RATE_BELT
Heart Rate Belt.
-
BT_APPEARANCE_GENERIC_BLOOD_PRESSURE
Generic Blood Pressure.
-
BT_APPEARANCE_BLOOD_PRESSURE_ARM
Arm Blood Pressure.
-
BT_APPEARANCE_BLOOD_PRESSURE_WRIST
Wrist Blood Pressure.
-
BT_APPEARANCE_GENERIC_HID
Generic Human Interface Device.
-
BT_APPEARANCE_HID_KEYBOARD
Keyboard.
-
BT_APPEARANCE_HID_MOUSE
Mouse.
-
BT_APPEARANCE_HID_JOYSTICK
Joystick.
-
BT_APPEARANCE_HID_GAMEPAD
Gamepad.
-
BT_APPEARANCE_HID_DIGITIZER_TABLET
Digitizer Tablet.
-
BT_APPEARANCE_HID_CARD_READER
Card Reader.
-
BT_APPEARANCE_HID_DIGITAL_PEN
Digital Pen.
-
BT_APPEARANCE_HID_BARCODE_SCANNER
Barcode Scanner.
-
BT_APPEARANCE_HID_TOUCHPAD
Touchpad.
-
BT_APPEARANCE_HID_PRESENTATION_REMOTE
Presentation Remote.
-
BT_APPEARANCE_GENERIC_GLUCOSE
Generic Glucose Meter.
-
BT_APPEARANCE_GENERIC_WALKING
Generic Running Walking Sensor.
-
BT_APPEARANCE_WALKING_IN_SHOE
In-Shoe Running Walking Sensor.
-
BT_APPEARANCE_WALKING_ON_SHOE
On-Shoe Running Walking Sensor.
-
BT_APPEARANCE_WALKING_ON_HIP
On-Hip Running Walking Sensor.
-
BT_APPEARANCE_GENERIC_CYCLING
Generic Cycling.
-
BT_APPEARANCE_CYCLING_COMPUTER
Cycling Computer.
-
BT_APPEARANCE_CYCLING_SPEED
Speed Sensor.
-
BT_APPEARANCE_CYCLING_CADENCE
Cadence Sensor.
-
BT_APPEARANCE_CYCLING_POWER
Power Sensor.
-
BT_APPEARANCE_CYCLING_SPEED_CADENCE
Speed and Cadence Sensor.
-
BT_APPEARANCE_GENERIC_CONTROL_DEVICE
Generic Control Device.
-
BT_APPEARANCE_CONTROL_SWITCH
Switch.
-
BT_APPEARANCE_CONTROL_MULTI_SWITCH
Multi-switch.
-
BT_APPEARANCE_CONTROL_BUTTON
Button.
-
BT_APPEARANCE_CONTROL_SLIDER
Slider.
-
BT_APPEARANCE_CONTROL_ROTARY_SWITCH
Rotary Switch.
-
BT_APPEARANCE_CONTROL_TOUCH_PANEL
Touch Panel.
-
BT_APPEARANCE_CONTROL_SINGLE_SWITCH
Single Switch.
-
BT_APPEARANCE_CONTROL_DOUBLE_SWITCH
Double Switch.
-
BT_APPEARANCE_CONTROL_TRIPLE_SWITCH
Triple Switch.
-
BT_APPEARANCE_CONTROL_BATTERY_SWITCH
Battery Switch.
-
BT_APPEARANCE_CONTROL_ENERGY_HARVESTING_SWITCH
Energy Harvesting Switch.
-
BT_APPEARANCE_CONTROL_PUSH_BUTTON
Push Button.
-
BT_APPEARANCE_GENERIC_NETWORK_DEVICE
Generic Network Device.
-
BT_APPEARANCE_NETWORK_ACCESS_POINT
Access Point.
-
BT_APPEARANCE_NETWORK_MESH_DEVICE
Mesh Device.
-
BT_APPEARANCE_NETWORK_MESH_PROXY
Mesh Network Proxy.
-
BT_APPEARANCE_GENERIC_SENSOR
Generic Sensor.
-
BT_APPEARANCE_SENSOR_MOTION
Motion Sensor.
-
BT_APPEARANCE_SENSOR_AIR_QUALITY
Air quality Sensor.
-
BT_APPEARANCE_SENSOR_TEMPERATURE
Temperature Sensor.
-
BT_APPEARANCE_SENSOR_HUMIDITY
Humidity Sensor.
-
BT_APPEARANCE_SENSOR_LEAK
Leak Sensor.
-
BT_APPEARANCE_SENSOR_SMOKE
Smoke Sensor.
-
BT_APPEARANCE_SENSOR_OCCUPANCY
Occupancy Sensor.
-
BT_APPEARANCE_SENSOR_CONTACT
Contact Sensor.
-
BT_APPEARANCE_SENSOR_CARBON_MONOXIDE
Carbon Monoxide Sensor.
-
BT_APPEARANCE_SENSOR_CARBON_DIOXIDE
Carbon Dioxide Sensor.
-
BT_APPEARANCE_SENSOR_AMBIENT_LIGHT
Ambient Light Sensor.
-
BT_APPEARANCE_SENSOR_ENERGY
Energy Sensor.
-
BT_APPEARANCE_SENSOR_COLOR_LIGHT
Color Light Sensor.
-
BT_APPEARANCE_SENSOR_RAIN
Rain Sensor.
-
BT_APPEARANCE_SENSOR_FIRE
Fire Sensor.
-
BT_APPEARANCE_SENSOR_WIND
Wind Sensor.
-
BT_APPEARANCE_SENSOR_PROXIMITY
Proximity Sensor.
-
BT_APPEARANCE_SENSOR_MULTI
Multi-Sensor.
-
BT_APPEARANCE_SENSOR_FLUSH_MOUNTED
Flush Mounted Sensor.
-
BT_APPEARANCE_SENSOR_CEILING_MOUNTED
Ceiling Mounted Sensor.
-
BT_APPEARANCE_SENSOR_WALL_MOUNTED
Wall Mounted Sensor.
-
BT_APPEARANCE_MULTISENSOR
Multisensor.
-
BT_APPEARANCE_SENSOR_ENERGY_METER
Energy Meter.
-
BT_APPEARANCE_SENSOR_FLAME_DETECTOR
Flame Detector.
-
BT_APPEARANCE_SENSOR_VEHICLE_TIRE_PRESSURE
Vehicle Tire Pressure Sensor.
-
BT_APPEARANCE_GENERIC_LIGHT_FIXTURES
Generic Light Fixtures.
-
BT_APPEARANCE_LIGHT_FIXTURES_WALL
Wall Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_CEILING
Ceiling Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_FLOOR
Floor Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_CABINET
Cabinet Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_DESK
Desk Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_TROFFER
Troffer Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_PENDANT
Pendant Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_IN_GROUND
In-ground Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_FLOOD
Flood Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_UNDERWATER
Underwater Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_BOLLARD_WITH
Bollard with Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_PATHWAY
Pathway Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_GARDEN
Garden Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_POLE_TOP
Pole-top Light.
-
BT_APPEARANCE_SPOT_LIGHT
Spotlight.
-
BT_APPEARANCE_LIGHT_FIXTURES_LINEAR
Linear Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_STREET
Street Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_SHELVES
Shelves Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_BAY
Bay Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_EMERGENCY_EXIT
Emergency Exit Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_CONTROLLER
Light Controller.
-
BT_APPEARANCE_LIGHT_FIXTURES_DRIVER
Light Driver.
-
BT_APPEARANCE_LIGHT_FIXTURES_BULB
Bulb.
-
BT_APPEARANCE_LIGHT_FIXTURES_LOW_BAY
Low-bay Light.
-
BT_APPEARANCE_LIGHT_FIXTURES_HIGH_BAY
High-bay Light.
-
BT_APPEARANCE_GENERIC_FAN
Generic Fan.
-
BT_APPEARANCE_FAN_CEILING
Ceiling Fan.
-
BT_APPEARANCE_FAN_AXIAL
Axial Fan.
-
BT_APPEARANCE_FAN_EXHAUST
Exhaust Fan.
-
BT_APPEARANCE_FAN_PEDESTAL
Pedestal Fan.
-
BT_APPEARANCE_FAN_DESK
Desk Fan.
-
BT_APPEARANCE_FAN_WALL
Wall Fan.
-
BT_APPEARANCE_GENERIC_HVAC
Generic HVAC.
-
BT_APPEARANCE_HVAC_THERMOSTAT
Thermostat.
-
BT_APPEARANCE_HVAC_HUMIDIFIER
Humidifier.
-
BT_APPEARANCE_HVAC_DEHUMIDIFIER
De-humidifier.
-
BT_APPEARANCE_HVAC_HEATER
Heater.
-
BT_APPEARANCE_HVAC_RADIATOR
Radiator.
-
BT_APPEARANCE_HVAC_BOILER
Boiler.
-
BT_APPEARANCE_HVAC_HEAT_PUMP
Heat Pump.
-
BT_APPEARANCE_HVAC_INFRARED_HEATER
Infrared Heater.
-
BT_APPEARANCE_HVAC_RADIANT_PANEL_HEATER
Radiant Panel Heater.
-
BT_APPEARANCE_HVAC_FAN_HEATER
Fan Heater.
-
BT_APPEARANCE_HVAC_AIR_CURTAIN
Air Curtain.
-
BT_APPEARANCE_GENERIC_AIR_CONDITIONING
Generic Air Conditioning.
-
BT_APPEARANCE_GENERIC_HUMIDIFIER
Generic Humidifier.
-
BT_APPEARANCE_GENERIC_HEATING
Generic Heating.
-
BT_APPEARANCE_HEATING_RADIATOR
Radiator.
-
BT_APPEARANCE_HEATING_BOILER
Boiler.
-
BT_APPEARANCE_HEATING_HEAT_PUMP
Heat Pump.
-
BT_APPEARANCE_HEATING_INFRARED_HEATER
Infrared Heater.
-
BT_APPEARANCE_HEATING_RADIANT_PANEL_HEATER
Radiant Panel Heater.
-
BT_APPEARANCE_HEATING_FAN_HEATER
Fan Heater.
-
BT_APPEARANCE_HEATING_AIR_CURTAIN
Air Curtain.
-
BT_APPEARANCE_GENERIC_ACCESS_CONTROL
Generic Access Control.
-
BT_APPEARANCE_CONTROL_ACCESS_DOOR
Access Door.
-
BT_APPEARANCE_CONTROL_GARAGE_DOOR
Garage Door.
-
BT_APPEARANCE_CONTROL_EMERGENCY_EXIT_DOOR
Emergency Exit Door.
-
BT_APPEARANCE_CONTROL_ACCESS_LOCK
Access Lock.
-
BT_APPEARANCE_CONTROL_ELEVATOR
Elevator.
-
BT_APPEARANCE_CONTROL_WINDOW
Window.
-
BT_APPEARANCE_CONTROL_ENTRANCE_GATE
Entrance Gate.
-
BT_APPEARANCE_CONTROL_DOOR_LOCK
Door Lock.
-
BT_APPEARANCE_CONTROL_LOCKER
Locker.
-
BT_APPEARANCE_GENERIC_MOTORIZED_DEVICE
Generic Motorized Device.
-
BT_APPEARANCE_MOTORIZED_GATE
Motorized Gate.
-
BT_APPEARANCE_MOTORIZED_AWNING
Awning.
-
BT_APPEARANCE_MOTORIZED_BLINDS_OR_SHADES
Blinds or Shades.
-
BT_APPEARANCE_MOTORIZED_CURTAINS
Curtains.
-
BT_APPEARANCE_MOTORIZED_SCREEN
Screen.
-
BT_APPEARANCE_GENERIC_POWER_DEVICE
Generic Power Device.
-
BT_APPEARANCE_POWER_OUTLET
Power Outlet.
-
BT_APPEARANCE_POWER_STRIP
Power Strip.
-
BT_APPEARANCE_POWER_PLUG
Plug.
-
BT_APPEARANCE_POWER_SUPPLY
Power Supply.
-
BT_APPEARANCE_POWER_LED_DRIVER
LED Driver.
-
BT_APPEARANCE_POWER_FLUORESCENT_LAMP_GEAR
Fluorescent Lamp Gear.
-
BT_APPEARANCE_POWER_HID_LAMP_GEAR
HID Lamp Gear.
-
BT_APPEARANCE_POWER_CHARGE_CASE
Charge Case.
-
BT_APPEARANCE_POWER_POWER_BANK
Power Bank.
-
BT_APPEARANCE_GENERIC_LIGHT_SOURCE
Generic Light Source.
-
BT_APPEARANCE_LIGHT_SOURCE_INCANDESCENT_BULB
Incandescent Light Bulb.
-
BT_APPEARANCE_LIGHT_SOURCE_LED_LAMP
LED Lamp.
-
BT_APPEARANCE_LIGHT_SOURCE_HID_LAMP
HID Lamp.
-
BT_APPEARANCE_LIGHT_SOURCE_FLUORESCENT_LAMP
Fluorescent Lamp.
-
BT_APPEARANCE_LIGHT_SOURCE_LED_ARRAY
LED Array.
-
BT_APPEARANCE_LIGHT_SOURCE_MULTICOLOR_LED_ARRAY
Multi-Color LED Array.
-
BT_APPEARANCE_LIGHT_SOURCE_LOW_VOLTAGE_HALOGEN
Low voltage halogen.
-
BT_APPEARANCE_LIGHT_SOURCE_OLED
Organic light emitting diode.
-
BT_APPEARANCE_GENERIC_WINDOW_COVERING
Generic Window Covering.
-
BT_APPEARANCE_WINDOW_SHADES
Window Shades.
-
BT_APPEARANCE_WINDOW_BLINDS
Window Blinds.
-
BT_APPEARANCE_WINDOW_AWNING
Window Awning.
-
BT_APPEARANCE_WINDOW_CURTAIN
Window Curtain.
-
BT_APPEARANCE_WINDOW_EXTERIOR_SHUTTER
Exterior Shutter.
-
BT_APPEARANCE_WINDOW_EXTERIOR_SCREEN
Exterior Screen.
-
BT_APPEARANCE_GENERIC_AUDIO_SINK
Generic Audio Sink.
-
BT_APPEARANCE_AUDIO_SINK_STANDALONE_SPEAKER
Standalone Speaker.
-
BT_APPEARANCE_AUDIO_SINK_SOUNDBAR
Soundbar.
-
BT_APPEARANCE_AUDIO_SINK_BOOKSHELF_SPEAKER
Bookshelf Speaker.
-
BT_APPEARANCE_AUDIO_SINK_STANDMOUNTED_SPEAKER
Standmounted Speaker.
-
BT_APPEARANCE_AUDIO_SINK_SPEAKERPHONE
Speakerphone.
-
BT_APPEARANCE_GENERIC_AUDIO_SOURCE
Generic Audio Source.
-
BT_APPEARANCE_AUDIO_SOURCE_MICROPHONE
Microphone.
-
BT_APPEARANCE_AUDIO_SOURCE_ALARM
Alarm.
-
BT_APPEARANCE_AUDIO_SOURCE_BELL
Bell.
-
BT_APPEARANCE_AUDIO_SOURCE_HORN
Horn.
-
BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_DEVICE
Broadcasting Device.
-
BT_APPEARANCE_AUDIO_SOURCE_SERVICE_DESK
Service Desk.
-
BT_APPEARANCE_AUDIO_SOURCE_KIOSK
Kiosk.
-
BT_APPEARANCE_AUDIO_SOURCE_BROADCASTING_ROOM
Broadcasting Room.
-
BT_APPEARANCE_AUDIO_SOURCE_AUDITORIUM
Auditorium.
-
BT_APPEARANCE_GENERIC_MOTORIZED_VEHICLE
Generic Motorized Vehicle.
-
BT_APPEARANCE_VEHICLE_CAR
Car.
-
BT_APPEARANCE_VEHICLE_LARGE_GOODS
Large Goods Vehicle.
-
BT_APPEARANCE_VEHICLE_TWO_WHEELED
2-Wheeled Vehicle
-
BT_APPEARANCE_VEHICLE_MOTORBIKE
Motorbike.
-
BT_APPEARANCE_VEHICLE_SCOOTER
Scooter.
-
BT_APPEARANCE_VEHICLE_MOPED
Moped.
-
BT_APPEARANCE_VEHICLE_THREE_WHEELED
3-Wheeled Vehicle
-
BT_APPEARANCE_VEHICLE_LIGHT
Light Vehicle.
-
BT_APPEARANCE_VEHICLE_QUAD_BIKE
Quad Bike.
-
BT_APPEARANCE_VEHICLE_MINIBUS
Minibus.
-
BT_APPEARANCE_VEHICLE_BUS
Bus.
-
BT_APPEARANCE_VEHICLE_TROLLEY
Trolley.
-
BT_APPEARANCE_VEHICLE_AGRICULTURAL
Agricultural Vehicle.
-
BT_APPEARANCE_VEHICLE_CAMPER_OR_CARAVAN
Camper/Caravan.
-
BT_APPEARANCE_VEHICLE_RECREATIONAL
Recreational Vehicle/Motor Home.
-
BT_APPEARANCE_GENERIC_DOMESTIC_APPLIANCE
Generic Domestic Appliance.
-
BT_APPEARANCE_APPLIANCE_REFRIGERATOR
Refrigerator.
-
BT_APPEARANCE_APPLIANCE_FREEZER
Freezer.
-
BT_APPEARANCE_APPLIANCE_OVEN
Oven.
-
BT_APPEARANCE_APPLIANCE_MICROWAVE
Microwave.
-
BT_APPEARANCE_APPLIANCE_TOASTER
Toaster.
-
BT_APPEARANCE_APPLIANCE_WASHING_MACHINE
Washing Machine.
-
BT_APPEARANCE_APPLIANCE_DRYER
Dryer.
-
BT_APPEARANCE_APPLIANCE_COFFEE_MAKER
Coffee maker.
-
BT_APPEARANCE_APPLIANCE_CLOTHES_IRON
Clothes iron.
-
BT_APPEARANCE_APPLIANCE_CURLING_IRON
Curling iron.
-
BT_APPEARANCE_APPLIANCE_HAIR_DRYER
Hair dryer.
-
BT_APPEARANCE_APPLIANCE_VACUUM_CLEANER
Vacuum cleaner.
-
BT_APPEARANCE_APPLIANCE_ROBOTIC_VACUUM_CLEANER
Robotic vacuum cleaner.
-
BT_APPEARANCE_APPLIANCE_RICE_COOKER
Rice cooker.
-
BT_APPEARANCE_APPLIANCE_CLOTHES_STEAMER
Clothes steamer.
-
BT_APPEARANCE_GENERIC_WEARABLE_AUDIO_DEVICE
Generic Wearable Audio Device.
-
BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_EARBUD
Earbud.
-
BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADSET
Headset.
-
BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_HEADPHONES
Headphones.
-
BT_APPEARANCE_WEARABLE_AUDIO_DEVICE_NECK_BAND
Neck Band.
-
BT_APPEARANCE_GENERIC_AIRCRAFT
Generic Aircraft.
-
BT_APPEARANCE_AIRCRAFT_LIGHT
Light Aircraft.
-
BT_APPEARANCE_AIRCRAFT_MICROLIGHT
Microlight.
-
BT_APPEARANCE_AIRCRAFT_PARAGLIDER
Paraglider.
-
BT_APPEARANCE_AIRCRAFT_LARGE_PASSENGER
Large Passenger Aircraft.
-
BT_APPEARANCE_GENERIC_AV_EQUIPMENT
Generic AV Equipment.
-
BT_APPEARANCE_AV_EQUIPMENT_AMPLIFIER
Amplifier.
-
BT_APPEARANCE_AV_EQUIPMENT_RECEIVER
Receiver.
-
BT_APPEARANCE_AV_EQUIPMENT_RADIO
Radio.
-
BT_APPEARANCE_AV_EQUIPMENT_TUNER
Tuner.
-
BT_APPEARANCE_AV_EQUIPMENT_TURNTABLE
Turntable.
-
BT_APPEARANCE_AV_EQUIPMENT_CD_PLAYER
CD Player.
-
BT_APPEARANCE_AV_EQUIPMENT_DVD_PLAYER
DVD Player.
-
BT_APPEARANCE_AV_EQUIPMENT_BLURAY_PLAYER
Bluray Player.
-
BT_APPEARANCE_AV_EQUIPMENT_OPTICAL_DISC_PLAYER
Optical Disc Player.
-
BT_APPEARANCE_AV_EQUIPMENT_SET_TOP_BOX
Set-Top Box.
-
BT_APPEARANCE_GENERIC_DISPLAY_EQUIPMENT
Generic Display Equipment.
-
BT_APPEARANCE_DISPLAY_EQUIPMENT_TELEVISION
Television.
-
BT_APPEARANCE_DISPLAY_EQUIPMENT_MONITOR
Monitor.
-
BT_APPEARANCE_DISPLAY_EQUIPMENT_PROJECTOR
Projector.
-
BT_APPEARANCE_GENERIC_HEARING_AID
Generic Hearing aid.
-
BT_APPEARANCE_HEARING_AID_IN_EAR
In-ear hearing aid.
-
BT_APPEARANCE_HEARING_AID_BEHIND_EAR
Behind-ear hearing aid.
-
BT_APPEARANCE_HEARING_AID_COCHLEAR_IMPLANT
Cochlear Implant.
-
BT_APPEARANCE_GENERIC_GAMING
Generic Gaming.
-
BT_APPEARANCE_HOME_VIDEO_GAME_CONSOLE
Home Video Game Console.
-
BT_APPEARANCE_PORTABLE_HANDHELD_CONSOLE
Portable handheld console.
-
BT_APPEARANCE_GENERIC_SIGNAGE
Generic Signage.
-
BT_APPEARANCE_SIGNAGE_DIGITAL
Digital Signage.
-
BT_APPEARANCE_SIGNAGE_ELECTRONIC_LABEL
Electronic Label.
-
BT_APPEARANCE_GENERIC_PULSE_OXIMETER
Generic Pulse Oximeter.
-
BT_APPEARANCE_PULSE_OXIMETER_FINGERTIP
Fingertip Pulse Oximeter.
-
BT_APPEARANCE_PULSE_OXIMETER_WRIST
Wrist Worn Pulse Oximeter.
-
BT_APPEARANCE_GENERIC_WEIGHT_SCALE
Generic Weight Scale.
-
BT_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE
Generic Personal Mobility Device.
-
BT_APPEARANCE_MOBILITY_POWERED_WHEELCHAIR
Powered Wheelchair.
-
BT_APPEARANCE_MOBILITY_SCOOTER
Mobility Scooter.
-
BT_APPEARANCE_CONTINUOUS_GLUCOSE_MONITOR
Continuous Glucose Monitor.
-
BT_APPEARANCE_GENERIC_INSULIN_PUMP
Generic Insulin Pump.
-
BT_APPEARANCE_INSULIN_PUMP_DURABLE
Insulin Pump, durable pump.
-
BT_APPEARANCE_INSULIN_PUMP_PATCH
Insulin Pump, patch pump.
-
BT_APPEARANCE_INSULIN_PEN
Insulin Pen.
-
BT_APPEARANCE_GENERIC_MEDICATION_DELIVERY
Generic Medication Delivery.
-
BT_APPEARANCE_GENERIC_SPIROMETER
Generic Spirometer.
-
BT_APPEARANCE_SPIROMETER_HANDHELD
Handheld Spirometer.
-
BT_APPEARANCE_GENERIC_OUTDOOR_SPORTS
Generic Outdoor Sports Activity.
-
BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION
Location Display.
-
BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV
Location and Navigation Display.
-
BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD
Location Pod.
-
BT_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV
Location and Navigation Pod.
Defined GAP timers
-
BT_GAP_SCAN_FAST_INTERVAL_MIN
-
BT_GAP_SCAN_FAST_INTERVAL
-
BT_GAP_SCAN_FAST_WINDOW
-
BT_GAP_SCAN_SLOW_INTERVAL_1
-
BT_GAP_SCAN_SLOW_WINDOW_1
-
BT_GAP_SCAN_SLOW_INTERVAL_2
-
BT_GAP_SCAN_SLOW_WINDOW_2
-
BT_GAP_ADV_FAST_INT_MIN_1
-
BT_GAP_ADV_FAST_INT_MAX_1
-
BT_GAP_ADV_FAST_INT_MIN_2
-
BT_GAP_ADV_FAST_INT_MAX_2
-
BT_GAP_ADV_SLOW_INT_MIN
-
BT_GAP_ADV_SLOW_INT_MAX
-
BT_GAP_PER_ADV_FAST_INT_MIN_1
-
BT_GAP_PER_ADV_FAST_INT_MAX_1
-
BT_GAP_PER_ADV_FAST_INT_MIN_2
-
BT_GAP_PER_ADV_FAST_INT_MAX_2
-
BT_GAP_PER_ADV_SLOW_INT_MIN
-
BT_GAP_PER_ADV_SLOW_INT_MAX
-
BT_GAP_INIT_CONN_INT_MIN
-
BT_GAP_INIT_CONN_INT_MAX
Defines
-
BT_GAP_ADV_MAX_ADV_DATA_LEN
Maximum advertising data length.
-
BT_GAP_ADV_MAX_EXT_ADV_DATA_LEN
Maximum extended advertising data length.
Note
The maximum advertising data length that can be sent by an extended advertiser is defined by the controller.
-
BT_GAP_TX_POWER_INVALID
-
BT_GAP_RSSI_INVALID
-
BT_GAP_SID_INVALID
-
BT_GAP_NO_TIMEOUT
-
BT_GAP_ADV_HIGH_DUTY_CYCLE_MAX_TIMEOUT
-
BT_GAP_DATA_LEN_DEFAULT
Default data length.
-
BT_GAP_DATA_LEN_MAX
Maximum data length.
-
BT_GAP_DATA_TIME_DEFAULT
Default data time.
-
BT_GAP_DATA_TIME_MAX
Maximum data time.
-
BT_GAP_SID_MAX
Maximum advertising set number.
-
BT_GAP_PER_ADV_MAX_SKIP
Maximum number of consecutive periodic advertisement events that can be skipped after a successful receive.
-
BT_GAP_PER_ADV_MIN_TIMEOUT
Minimum Periodic Advertising Timeout (N * 10 ms)
-
BT_GAP_PER_ADV_MAX_TIMEOUT
Maximum Periodic Advertising Timeout (N * 10 ms)
-
BT_GAP_PER_ADV_MIN_INTERVAL
Minimum Periodic Advertising Interval (N * 1.25 ms)
-
BT_GAP_PER_ADV_MAX_INTERVAL
Maximum Periodic Advertising Interval (N * 1.25 ms)
-
BT_GAP_PER_ADV_INTERVAL_TO_MS(interval)
Convert periodic advertising interval (N * 1.25 ms) to milliseconds.
5 / 4 represents 1.25 ms unit.
-
BT_LE_SUPP_FEAT_40_ENCODE(w64)
Encode 40 least significant bits of 64-bit LE Supported Features into array values in little-endian format.
Helper macro to encode 40 least significant bits of 64-bit LE Supported Features value into advertising data. The number of bits that are encoded is a number of LE Supported Features defined by BT 5.3 Core specification.
Example of how to encode the
0x000000DFF00DF00D
into advertising data.BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_40_ENCODE(0x000000DFF00DF00D))
- Parameters:
w64 – LE Supported Features value (64-bits)
- Returns:
The comma separated values for LE Supported Features value that may be used directly as an argument for BT_DATA_BYTES.
-
BT_LE_SUPP_FEAT_32_ENCODE(w64)
Encode 4 least significant bytes of 64-bit LE Supported Features into 4 bytes long array of values in little-endian format.
Helper macro to encode 64-bit LE Supported Features value into advertising data. The macro encodes 4 least significant bytes into advertising data. Other 4 bytes are not encoded.
Example of how to encode the
0x000000DFF00DF00D
into advertising data.BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_32_ENCODE(0x000000DFF00DF00D))
- Parameters:
w64 – LE Supported Features value (64-bits)
- Returns:
The comma separated values for LE Supported Features value that may be used directly as an argument for BT_DATA_BYTES.
-
BT_LE_SUPP_FEAT_24_ENCODE(w64)
Encode 3 least significant bytes of 64-bit LE Supported Features into 3 bytes long array of values in little-endian format.
Helper macro to encode 64-bit LE Supported Features value into advertising data. The macro encodes 3 least significant bytes into advertising data. Other 5 bytes are not encoded.
Example of how to encode the
0x000000DFF00DF00D
into advertising data.BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_24_ENCODE(0x000000DFF00DF00D))
- Parameters:
w64 – LE Supported Features value (64-bits)
- Returns:
The comma separated values for LE Supported Features value that may be used directly as an argument for BT_DATA_BYTES.
-
BT_LE_SUPP_FEAT_16_ENCODE(w64)
Encode 2 least significant bytes of 64-bit LE Supported Features into 2 bytes long array of values in little-endian format.
Helper macro to encode 64-bit LE Supported Features value into advertising data. The macro encodes 3 least significant bytes into advertising data. Other 6 bytes are not encoded.
Example of how to encode the
0x000000DFF00DF00D
into advertising data.BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_16_ENCODE(0x000000DFF00DF00D))
- Parameters:
w64 – LE Supported Features value (64-bits)
- Returns:
The comma separated values for LE Supported Features value that may be used directly as an argument for BT_DATA_BYTES.
-
BT_LE_SUPP_FEAT_8_ENCODE(w64)
Encode the least significant byte of 64-bit LE Supported Features into single byte long array.
Helper macro to encode 64-bit LE Supported Features value into advertising data. The macro encodes the least significant byte into advertising data. Other 7 bytes are not encoded.
Example of how to encode the
0x000000DFF00DF00D
into advertising data.BT_DATA_BYTES(BT_DATA_LE_SUPPORTED_FEATURES, BT_LE_SUPP_FEAT_8_ENCODE(0x000000DFF00DF00D))
- Parameters:
w64 – LE Supported Features value (64-bits)
- Returns:
The value of least significant byte of LE Supported Features value that may be used directly as an argument for BT_DATA_BYTES.
-
BT_LE_SUPP_FEAT_VALIDATE(w64)
Validate whether LE Supported Features value does not use bits that are reserved for future use.
Helper macro to check if
w64
has zeros as bits 40-63. The macro is compliant with BT 5.3 Core Specification where bits 0-40 has assigned values. In case of invalid value, build time error is reported.
Enums
-
enum [anonymous]
LE PHY types.
Values:
-
enumerator BT_GAP_LE_PHY_NONE = 0
Convenience macro for when no PHY is set.
-
enumerator BT_GAP_LE_PHY_NONE = 0
-
enum [anonymous]
Advertising PDU types.
Values:
-
enumerator BT_GAP_ADV_TYPE_ADV_IND = 0x00
Scannable and connectable advertising.
-
enumerator BT_GAP_ADV_TYPE_ADV_DIRECT_IND = 0x01
Directed connectable advertising.
-
enumerator BT_GAP_ADV_TYPE_ADV_SCAN_IND = 0x02
Non-connectable and scannable advertising.
-
enumerator BT_GAP_ADV_TYPE_ADV_NONCONN_IND = 0x03
Non-connectable and non-scannable advertising.
-
enumerator BT_GAP_ADV_TYPE_SCAN_RSP = 0x04
Additional advertising data requested by an active scanner.
-
enumerator BT_GAP_ADV_TYPE_EXT_ADV = 0x05
Extended advertising, see advertising properties.
-
enumerator BT_GAP_ADV_TYPE_ADV_IND = 0x00
-
enum [anonymous]
Advertising PDU properties.
Values:
-
enum [anonymous]
Constant Tone Extension (CTE) types.
Values:
-
enumerator BT_GAP_CTE_AOA = 0x00
Angle of Arrival.
-
enumerator BT_GAP_CTE_AOD_1US = 0x01
Angle of Departure with 1 us slots.
-
enumerator BT_GAP_CTE_AOD_2US = 0x02
Angle of Departure with 2 us slots.
-
enumerator BT_GAP_CTE_NONE = 0xFF
No extensions.
-
enumerator BT_GAP_CTE_AOA = 0x00
-
enum [anonymous]
Peripheral sleep clock accuracy (SCA) in ppm (parts per million)
Values:
-
enumerator BT_GAP_SCA_UNKNOWN = 0
Unknown.
-
enumerator BT_GAP_SCA_251_500 = 0
251 ppm to 500 ppm
-
enumerator BT_GAP_SCA_151_250 = 1
151 ppm to 250 ppm
-
enumerator BT_GAP_SCA_101_150 = 2
101 ppm to 150 ppm
-
enumerator BT_GAP_SCA_76_100 = 3
76 ppm to 100 ppm
-
enumerator BT_GAP_SCA_51_75 = 4
51 ppm to 75 ppm
-
enumerator BT_GAP_SCA_31_50 = 5
31 ppm to 50 ppm
-
enumerator BT_GAP_SCA_21_30 = 6
21 ppm to 30 ppm
-
enumerator BT_GAP_SCA_0_20 = 7
0 ppm to 20 ppm
-
enumerator BT_GAP_SCA_UNKNOWN = 0
-
BT_COMP_ID_LF