Bluetooth Host Stack Library
Bluetooth Stack Initialize & Configuration

General Description

This section describes API and Data structures required to initialize and configure the Bluetooth-Stack.

Data Structures

struct  wiced_bt_cfg_ble_scan_settings_t
 LE Scan settings. More...
 
struct  wiced_bt_cfg_ble_advert_settings_t
 Advertising settings. More...
 
struct  wiced_bt_cfg_gatt_t
 GATT settings. More...
 
struct  wiced_bt_cfg_avdt_t
 Audio/Video Distribution configuration. More...
 
struct  wiced_bt_cfg_avrc_t
 Audio/Video Remote Control configuration. More...
 
struct  wiced_bt_cfg_rfcomm_t
 RFCOMM configuration. More...
 
struct  wiced_bt_cfg_isoc_t
 Isochronous Connection configuration settings. More...
 
struct  wiced_bt_cfg_br_t
 BR/EDR configuration settings. More...
 
struct  wiced_bt_cfg_ble_t
 LE configuration settings. More...
 
struct  wiced_bt_cfg_l2cap_application_t
 Settings for application managed L2CAP protocols (optional) More...
 
struct  wiced_bt_cfg_settings_t
 Bluetooth stack configuration. More...
 

Typedefs

typedef uint8_t wiced_bt_ble_scan_mode_t
 scan mode (see wiced_bt_ble_scan_mode_e)
 
typedef uint8_t wiced_bt_sec_level_t
 Required security level.
 
typedef uint8_t wiced_bt_ble_advert_chnl_map_t
 LE 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)
 

Enumerations

enum  wiced_bt_ble_scan_mode_e {
  BTM_BLE_SCAN_MODE_PASSIVE = 0,
  BTM_BLE_SCAN_MODE_ACTIVE = 1,
  BTM_BLE_SCAN_MODE_NONE = 0xff
}
 Scan modes. More...
 
enum  wiced_bt_sec_level_e {
  BTM_SEC_BEST_EFFORT = 1,
  BTM_SEC_SC_REQUIRED = 2,
  BTM_SEC_AUTH_REQUIRED = 4,
  BTM_SEC_SC_AUTH_REQUIRED = (BTM_SEC_SC_REQUIRED | 4)
}
 Security Service Levels (bit fields) More...
 
enum  wiced_bt_ble_advert_chnl_map_e {
  BTM_BLE_ADVERT_CHNL_37 = (0x01 << 0),
  BTM_BLE_ADVERT_CHNL_38 = (0x01 << 1),
  BTM_BLE_ADVERT_CHNL_39 = (0x01 << 2)
}
 advertising channel map More...
 

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. More...
 

Bluetooth Configuration Default Values

Bluetooth Configuration Default Values

Note
These are typical values for config parameters used for some common LE, BR/EDR use cases.
#define WICED_BT_CFG_DEFAULT_INQUIRY_SCAN_INTERVAL   0x0800
 Inquiry scan interval (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_INQUIRY_SCAN_WINDOW   0x0012
 Inquiry scan window (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_PAGE_SCAN_INTERVAL   0x0800
 Page scan interval (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_PAGE_SCAN_WINDOW   0x0012
 Page scan window (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL   96
 High duty scan interval (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW   48
 High duty scan window (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL   2048
 Low duty scan interval (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW   18
 Low duty scan window (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL   96
 High duty cycle connection scan interval (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW   48
 High duty cycle connection scan window (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL   2048
 Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW   18
 Low duty cycle connection scan window (in slots (1 slot = 0.625 ms))
 
#define WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL   80
 Minimum connection event interval ( in 1.25 msec)
 
#define WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL   80
 Maximum connection event interval ( in 1.25 msec)
 
#define WICED_BT_CFG_DEFAULT_CONN_LATENCY   0
 Connection latency (in number of LL connection events)
 
#define WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT   700
 Connection link supervision timeout (in 10 msec)
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MIN_INTERVAL   48
 Tgap(adv_fast_interval1) = 48 *0.625 = 30ms.
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_ADV_MAX_INTERVAL   48
 Tgap(adv_fast_interval1) = 48 *0.625 = 30ms.
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MIN_INTERVAL   2048
 Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_ADV_MAX_INTERVAL   2048
 Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL   160
 Tgap(adv_fast_interval2) = 160 * 0.625 = 100 ms.
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL   160
 Tgap(adv_fast_interval2) = 160 * 0.625 = 100 ms.
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL   2048
 Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL   2048
 Tgap(adv_slow_interval) = 2048 * 0.625 = 1.28s.
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL   400
 Tgap(dir_conn_adv_int_max) = 400 * 0.625 = 250 ms.
 
#define WICED_BT_CFG_DEFAULT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL   800
 Tgap(dir_conn_adv_int_min) = 800 * 0.625 = 500 ms.
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL   48
 Tgap(adv_fast_interval1) = 48 * 0.625 = 30 ms.
 
#define WICED_BT_CFG_DEFAULT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL   48
 Tgap(adv_fast_interval1) = 48 * 0.625 = 30 ms.
 
#define WICED_BT_CFG_DEFAULT_RANDOM_ADDRESS_CHANGE_TIMEOUT   900
 default refreshment timing interval 900secs
 
#define WICED_BT_CFG_DEFAULT_RANDOM_ADDRESS_NEVER_CHANGE   0
 value for disabling random address refresh
 
#define WICED_BT_CFG_MAX_RANDOM_ADDRESS_CHANGE_TIMEOUT   3600
 max refreshment timing interval 3600secs
 
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. More...
 
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. More...
 
wiced_result_t wiced_bt_l2c_module_init (void)
 Initialize l2cap. More...
 
wiced_result_t wiced_bt_smp_module_init (void)
 Initialize SMP. More...
 
wiced_result_t wiced_bt_init_resolution (void)
 Enable host based resolution This should be invoked in the BTM_ENABLED_EVT event.
 

Enumeration Type Documentation

◆ wiced_bt_ble_scan_mode_e

Scan modes.

Enumerator
BTM_BLE_SCAN_MODE_PASSIVE 

Passive scan mode.

BTM_BLE_SCAN_MODE_ACTIVE 

Active scan mode.

BTM_BLE_SCAN_MODE_NONE 

None.

◆ wiced_bt_sec_level_e

Security Service Levels (bit fields)

Enumerator
BTM_SEC_BEST_EFFORT 

BTM_SEC_BEST_EFFORT : 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

BTM_SEC_SC_REQUIRED 

BTM_SEC_SC_REQUIRED : Can be set by applications which need to enforce secure connections.

Note: If this bit is set, the stack will only allow connections to devices paired using Secure Connections

BTM_SEC_AUTH_REQUIRED 

BTM_SEC_AUTH_REQUIRED - Can be set by applications which need to enforce Authentication Note: If this bit is set, the stack will only allow connections to devices paired using authentication.

BTM_SEC_SC_AUTH_REQUIRED 

BTM_SEC_SC_AUTH_REQUIRED : Can be set by applications which need to enforce secure connections with MITM protection.

Note: If this bit is set, the stack will only allow connections to devices paired using Secure Connections with Man In The Middle (MITM) protection

◆ wiced_bt_ble_advert_chnl_map_e

advertising channel map

Enumerator
BTM_BLE_ADVERT_CHNL_37 

ADV channel.

BTM_BLE_ADVERT_CHNL_38 

ADV channel.

BTM_BLE_ADVERT_CHNL_39 

ADV channel.

Function Documentation

◆ wiced_bt_stack_get_dynamic_memory_size_for_config()

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
[in]p_bt_cfg_settings: Bluetooth stack configuration
Returns
dynamic memory size requirements of the stack

◆ wiced_bt_stack_init()

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.

Parameters
[in]p_bt_management_cback: Callback for receiving Bluetooth management events
[in]p_bt_cfg_settings: Bluetooth stack configuration wiced_bt_cfg_settings_t
Returns
WICED_BT_SUCCESS : on success;
WICED_BT_FAILED : if an error occurred
Note
This API must be called before using any Bluetooth 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.

◆ wiced_bt_stack_deinit()

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

◆ wiced_bt_l2c_module_init()

wiced_result_t wiced_bt_l2c_module_init ( void  )

Initialize l2cap.

Returns
wiced_result_t

◆ wiced_bt_smp_module_init()

wiced_result_t wiced_bt_smp_module_init ( void  )

Initialize SMP.

Called by application to accept incoming pairing requests

Returns
wiced_result_t