Bluetooth Stack Initialize & Configuration¶
-
group
wiced_bt_cfg
This section describes API and Data structures required to initialize and configure the BT-Stack.
Bluetooth Configuration Default Values
Bluetooth Configuration Default Values
note
These are typical values for config parameters used for some common BLE, BR/EDR use cases.
-
WICED_BT_CFG_DEFAULT_INQUIRY_SCAN_INTERVAL
¶ Inquiry scan interval (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_INQUIRY_SCAN_WINDOW
¶ Inquiry scan window (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_PAGE_SCAN_INTERVAL
¶ Page scan interval (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_PAGE_SCAN_WINDOW
¶ Page scan window (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL
¶ High duty scan interval (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW
¶ High duty scan window (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL
¶ Low duty scan interval (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW
¶ Low duty scan window (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL
¶ High duty cycle connection scan interval (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW
¶ High duty cycle connection scan window (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL
¶ Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW
¶ Low duty cycle connection scan window (in slots (1 slot = 0.625 ms))
-
WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL
¶ Minimum connection event interval ( in 1.25 msec)
-
WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL
¶ Maximum connection event interval ( in 1.25 msec)
-
WICED_BT_CFG_DEFAULT_CONN_LATENCY
¶ Connection latency (in number of LL connection events)
-
WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT
¶ Connection link supervision timeout (in 10 msec)
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MIN_INTERVAL
¶ Tgap(adv_fast_interval1) = 48 *0.625 = 30ms.
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MAX_INTERVAL
¶ Tgap(adv_fast_interval1) = 48 *0.625 = 30ms.
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MIN_INTERVAL
¶ Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MAX_INTERVAL
¶ Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL
¶ Tgap(adv_fast_interval2) = 160 * 0.625 = 100 ms.
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL
¶ Tgap(adv_fast_interval2) = 160 * 0.625 = 100 ms.
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL
¶ Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL
¶ Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL
¶ Tgap(dir_conn_adv_int_max) = 400 * 0.625 = 250 ms.
-
WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL
¶ Tgap(dir_conn_adv_int_min) = 800 * 0.625 = 500 ms.
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL
¶ Tgap(adv_fast_interval1) = 48 * 0.625 = 30 ms.
-
WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL
¶ Tgap(adv_fast_interval1) = 48 * 0.625 = 30 ms.
-
WICED_BT_CFG_DEFAULT_RANDOM_ADDRESS_CHANGE_TIMEOUT
¶ default refreshment timing interval 900secs
-
WICED_BT_CFG_DEFAULT_RANDOM_ADDRESS_NEVER_CHANGE
¶ value for disabling random address refresh
-
WICED_BT_CFG_MAX_RANDOM_ADDRESS_CHANGE_TIMEOUT
¶ max refreshment timing interval 3600secs
Unnamed Group
-
wiced_result_t
wiced_bt_stack_init
(wiced_bt_management_cback_t *p_bt_management_cback, const wiced_bt_cfg_settings_t *p_bt_cfg_settings)¶ Initialize the Bluetooth controller and stack; register callback for Bluetooth event notification.
note
This API must be called before using any BT functionality.
If p_bt_cfg_settings is null, stack uses default parameters defined in wiced_bt_cfg.h
However, it is strongly recommended that applications define the configuration to appropriate values based on the application use case.- Parameters
p_bt_management_cback – [in] : Callback for receiving Bluetooth management events
p_bt_cfg_settings – [in] : Bluetooth stack configuration wiced_bt_cfg_settings_t
- Returns
WICED_BT_SUCCESS : on success; WICED_BT_FAILED : if an error occurred
-
wiced_result_t
wiced_bt_stack_deinit
(void)¶ This is a blocking call (returns after all de-initialisation procedures are complete) It is recommended that the application disconnect any outstanding connections prior to invoking this function.
- Returns
WICED_BT_SUCCESS : on success; WICED_BT_ERROR : if an error occurred
Typedefs
-
typedef uint8_t
wiced_bt_ble_scan_mode_t
¶ scan mode (see wiced_bt_ble_scan_mode_e)
-
typedef uint8_t
wiced_bt_ble_advert_chnl_map_t
¶ BLE advertisement channel map (see wiced_bt_ble_advert_chnl_map_e)
-
typedef uint16_t
wiced_bt_gatt_appearance_t
¶ GATT appearance (see gatt_appearance_e in gattdefs.h)
Enums
Functions
-
int32_t
wiced_bt_stack_get_dynamic_memory_size_for_config
(const wiced_bt_cfg_settings_t *p_bt_cfg_settings)¶ Returns the expected dynamic memory size required for the stack based on the p_bt_cfg_settings.
- Parameters
p_bt_cfg_settings – [in] : Bluetooth stack configuration
- Returns
dynamic memory size requirements of the stack
-
struct
wiced_bt_cfg_ble_scan_settings_t
¶ - #include <>
LE Scan settings.
Public Members
-
wiced_bt_ble_scan_mode_t
scan_mode
¶ BLE scan mode wiced_bt_ble_scan_mode_t.
-
uint16_t
high_duty_scan_interval
¶ High duty scan interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL)
-
uint16_t
high_duty_scan_window
¶ High duty scan window (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW)
-
uint16_t
high_duty_scan_duration
¶ High duty scan duration in seconds (0 for infinite)
-
uint16_t
low_duty_scan_interval
¶ Low duty scan interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL)
-
uint16_t
low_duty_scan_window
¶ Low duty scan window (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW)
-
uint16_t
low_duty_scan_duration
¶ Low duty scan duration in seconds (0 for infinite)
-
uint16_t
high_duty_conn_scan_interval
¶ High duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL)
-
uint16_t
high_duty_conn_scan_window
¶ High duty cycle connection scan window (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW)
-
uint16_t
high_duty_conn_duration
¶ High duty cycle connection duration in seconds (0 for infinite)
-
uint16_t
low_duty_conn_scan_interval
¶ Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL)
-
uint16_t
low_duty_conn_scan_window
¶ Low duty cycle connection scan window (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW)
-
uint16_t
low_duty_conn_duration
¶ Low duty cycle connection duration in seconds (0 for infinite)
-
uint16_t
conn_min_interval
¶ Minimum connection interval (in 1.25 msec) (default: WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL)
-
uint16_t
conn_max_interval
¶ Maximum connection interval (in 1.25 msec) (default: WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL)
-
uint16_t
conn_latency
¶ Connection latency.
-
uint16_t
conn_supervision_timeout
¶ Connection link supervision timeout (in 10 msec) (default: WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT)
-
wiced_bt_ble_scan_mode_t
-
struct
wiced_bt_cfg_ble_advert_settings_t
¶ - #include <>
Advertising settings.
note
: Refer to valid ranges for the min and max intervals in the Core Specification 5.2, 7.8.5 LE Set Advertising Parameters command of the Host Controller Interface Functional Specification
Public Members
-
wiced_bt_ble_advert_chnl_map_t
channel_map
¶ Advertising channel map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38, BTM_BLE_ADVERT_CHNL_39)
-
uint16_t
high_duty_min_interval
¶ High duty undirected connectable advert minimum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MIN_INTERVAL)
-
uint16_t
high_duty_max_interval
¶ High duty undirected connectable advert maximum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MAX_INTERVAL)
-
uint16_t
high_duty_duration
¶ High duty advertising duration in seconds (0 for infinite)
-
uint16_t
low_duty_min_interval
¶ Low duty undirected connectable advert minimum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MIN_INTERVAL)
-
uint16_t
low_duty_max_interval
¶ Low duty undirected connectable advert maximum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MAX_INTERVAL)
-
uint16_t
low_duty_duration
¶ Low duty advertising duration in seconds (0 for infinite)
-
uint16_t
high_duty_directed_min_interval
¶ high duty directed adv minimum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL)
-
uint16_t
high_duty_directed_max_interval
¶ high duty directed adv maximum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL)
-
uint16_t
low_duty_directed_min_interval
¶ Low duty directed adv minimum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL)
-
uint16_t
low_duty_directed_max_interval
¶ Low duty directed adv maximum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL)
-
uint16_t
low_duty_directed_duration
¶ Low duty directed advertising duration in seconds (0 for infinite)
-
uint16_t
high_duty_nonconn_min_interval
¶ High duty non-connectable adv minimum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL)
-
uint16_t
high_duty_nonconn_max_interval
¶ High duty non-connectable adv maximum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL)
-
uint16_t
high_duty_nonconn_duration
¶ High duty non-connectable advertising duration in seconds (0 for infinite)
-
uint16_t
low_duty_nonconn_min_interval
¶ Low duty non-connectable adv minimum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL)
-
uint16_t
low_duty_nonconn_max_interval
¶ Low duty non-connectable adv maximum advertising interval (in slots (1 slot = 0.625 ms)) (default: WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL)
-
uint16_t
low_duty_nonconn_duration
¶ Low duty non-connectable advertising duration in seconds (0 for infinite)
-
wiced_bt_ble_advert_chnl_map_t
-
struct
wiced_bt_cfg_gatt_t
¶ - #include <>
GATT settings.
Public Members
-
uint8_t
max_db_service_modules
¶ Maximum number of GATT database segments to be added into the GATT DB.
note
: Should be set to 0 for most applications which do not update the GATT DB after invocation of wiced_bt_gatt_db_init
-
uint8_t
max_eatt_bearers
¶ Maximum number of allowed EATT bearers.
note
: Should be set to 0, for applications which support only legacy bearers.
-
uint8_t
-
struct
wiced_bt_cfg_avdt_t
¶ - #include <>
Audio/Video Distribution configuration.
Public Members
-
uint8_t
max_links
¶ Maximum simultaneous audio/video links over AVDT.
note
: This shall be <= wiced_bt_cfg_br_t::br_max_simultaneous_links;
-
uint8_t
max_seps
¶ Maximum number of stream end points.
-
uint8_t
-
struct
wiced_bt_cfg_avrc_t
¶ - #include <>
Audio/Video Remote Control configuration.
Public Members
-
uint8_t
max_links
¶ Maximum simultaneous remote control links over AVRC.
note
: This shall be <= wiced_bt_cfg_br_t::br_max_simultaneous_links;
-
uint8_t
-
struct
wiced_bt_cfg_rfcomm_t
¶ - #include <>
RFCOMM configuration.
Public Members
-
uint8_t
max_links
¶ Maximum number of simultaneous connected remote devices over RFCOMM.
note
: This shall be <= wiced_bt_cfg_br_t::br_max_simultaneous_links;
-
uint8_t
max_ports
¶ Maximum number of simultaneous RFCOMM ports.
-
uint8_t
-
struct
wiced_bt_cfg_isoc_t
¶ - #include <>
Ischoronous Connection configuration settings.
-
struct
wiced_bt_cfg_br_t
¶ - #include <>
BR/EDR configuration settings.
Public Members
-
uint8_t
br_max_simultaneous_links
¶ Max number for simultaneous connections for a layer, profile, protocol.
-
uint16_t
br_max_rx_pdu_size
¶ Maximum size allowed for any received L2CAP PDU Minimum value - 48 Maximum GATT MTU over legacy bearers shall be set to <= this value Maximum MPS for EATT channels shall be set to <= this value.
-
wiced_bt_dev_class_t
device_class
¶ Local device class.
-
uint8_t
security_requirement_mask
¶ Security requirements mask BTM_SEC_BEST_EFFORT is recommended choice for most applications, to connect to the widest range of devices.
Allows stack to choose the highest level of security possible between the two devices
-
wiced_bt_cfg_rfcomm_t
rfcomm_cfg
¶ RFCOMM settings.
-
wiced_bt_cfg_avdt_t
avdt_cfg
¶ Audio/Video Distribution configuration.
-
wiced_bt_cfg_avrc_t
avrc_cfg
¶ Audio/Video Remote Control configuration.
-
uint8_t
-
struct
wiced_bt_cfg_ble_t
¶ - #include <>
BLE configuration settings.
Public Members
-
uint8_t
ble_max_simultaneous_links
¶ Max number for simultaneous connections for a layer, profile, protocol.
-
uint16_t
ble_max_rx_pdu_size
¶ Maximum size allowed for any received L2CAP PDU Minimum value - 65 (to support SM) Maximum GATT MTU over legacy bearers shall be set to <= this value Maximum MPS for EATT channels shall be set to <= this value.
-
wiced_bt_gatt_appearance_t
appearance
¶ Device appearance to be sent out during advertising.
-
uint16_t
rpa_refresh_timeout
¶ Interval of random address refreshing - secs.
The timeout value cannot be more than 1 hr = 3600s
note
BLE Privacy is disabled if the value is 0.
-
uint16_t
host_addr_resolution_db_size
¶ addr resolution db size
-
const wiced_bt_cfg_ble_scan_settings_t *
p_ble_scan_cfg
¶ BLE scan settings.
-
const wiced_bt_cfg_ble_advert_settings_t *
p_ble_advert_cfg
¶ BLE advertisement settings.
-
int8_t
default_ble_power_level
¶ Default LE power level, Refer lm_TxPwrTable table for the power range.
-
uint8_t
-
struct
wiced_bt_cfg_l2cap_application_t
¶ - #include <>
Settings for application managed L2CAP protocols (optional)
Public Members
-
uint8_t
max_app_l2cap_psms
¶ Maximum number of application-managed PSMs.
-
uint8_t
max_app_l2cap_channels
¶ Maximum number of application-managed channels.
-
uint8_t
max_app_l2cap_le_fixed_channels
¶ Maximum number of application managed fixed channels supported.
>
-
uint8_t
max_app_l2cap_br_edr_ertm_chnls
¶ Maximum application ERTM channels, BR/EDR only.
-
uint8_t
max_app_l2cap_br_edr_ertm_tx_win
¶ Maximum application ERTM TX Window, BR/EDR only.
-
uint8_t
-
struct
wiced_bt_cfg_settings_t
¶ - #include <>
Bluetooth stack configuration.
Public Members
-
uint8_t *
device_name
¶ Local device name (NULL terminated)
-
const wiced_bt_cfg_br_t *
p_br_cfg
¶ BR/EDR related configuration.
-
const wiced_bt_cfg_ble_t *
p_ble_cfg
¶ BLE related configuration.
-
const wiced_bt_cfg_gatt_t *
p_gatt_cfg
¶ GATT settings.
-
const wiced_bt_cfg_isoc_t *
p_isoc_cfg
¶ Ischoronous Connection configuration.
-
const wiced_bt_cfg_l2cap_application_t *
p_l2cap_app_cfg
¶ l2cap configuration fgitor application defined profiles/protocols
-
uint8_t *
-