Bluetooth BR/EDR API¶
-
group
wiced_bredr_api
This module provided various Bluetooth security functionality such as authorisation, authentication and encryption.
Functions
-
wiced_result_t
wiced_bt_start_inquiry
(wiced_bt_dev_inq_parms_t *p_inqparms, wiced_bt_inquiry_result_cback_t *p_inquiry_result_cback)¶ Begin BR/EDR inquiry for peer devices.
WICED_BT_PENDING : if successfully initiated WICED_BT_BUSY : if already in progress WICED_BT_ILLEGAL_VALUE : if parameter(s) are out of range WICED_BT_NO_RESOURCES : if could not allocate resources to start the command WICED_BT_WRONG_MODE : if the device is not up
- Parameters
p_inqparms – [in] : inquiry parameters
p_inquiry_result_cback – [in] : inquiry results callback
- Returns
wiced_result_t
-
wiced_result_t
wiced_bt_cancel_inquiry
(void)¶ Cancel inquiry.
WICED_BT_SUCCESS : if successful WICED_BT_NO_RESOURCES : if could not allocate a message buffer WICED_BT_WRONG_MODE : if the device is not up.
- Returns
-
void
wiced_bt_dev_read_local_addr
(wiced_bt_device_address_t bd_addr)¶ Read the local device address.
- Parameters
bd_addr – [out] : Local bd address
- Returns
void
-
void
wiced_bt_dev_read_local_addr_ext
(wiced_bt_dev_local_addr_ext_t *data)¶ Read the extended local device address information.
- Parameters
data – [out] : data pointer in which stack will populate the address information.(refer wiced_bt_dev_local_addr_ext_t )
- Returns
void
-
wiced_result_t
wiced_bt_dev_set_advanced_connection_params
(wiced_bt_dev_inquiry_scan_result_t *p_inquiry_scan_result)¶ Set advanced connection parameters for subsequent BR/EDR connections (remote clock offset, page scan mode, and other information obtained during inquiry)
If not called, then default connection parameters will be used.
WICED_BT_SUCCESS : on success; WICED_BT_FAILED : if an error occurred
- Parameters
p_inquiry_scan_result – [in] : Inquiry scan result (from wiced_bt_dev_inquiry_scan_result_t)
- Returns
wiced_result_t
-
wiced_result_t
wiced_bt_dev_vendor_specific_command
(uint16_t opcode, uint8_t param_len, uint8_t *p_param_buf, wiced_bt_dev_vendor_specific_command_complete_cback_t *p_cback)¶ Send a vendor specific HCI command to the controller.
WICED_BT_SUCCESS : Command sent. Does not expect command complete event. (command complete callback param is NULL) WICED_BT_PENDING : Command sent. Waiting for command complete event. WICED_BT_BUSY : Command not sent. Waiting for command complete event for prior command.
- Parameters
opcode – [in] : Opcode of vendor specific command
param_len – [in] : Length of parameter buffer
p_param_buf – [in] : Parameters
p_cback – [in] : Callback for command complete
- Returns
-
wiced_result_t
wiced_bt_dev_set_discoverability
(uint8_t inq_mode, uint16_t duration, uint16_t interval)¶ Set discoverability.
WICED_BT_SUCCESS : If successful WICED_BT_BUSY : If a setting of the filter is already in progress WICED_BT_NO_RESOURCES : If couldn’t get a memory pool buffer WICED_BT_ILLEGAL_VALUE : If a bad parameter was detected WICED_BT_WRONG_MODE : If the device is not upnote
The duration must be less than or equal to the interval.
- Parameters
inq_mode – [in] : Discoverability mode (see wiced_bt_discoverability_mode_e )
duration – [in] : Duration (in 0.625 msec intervals). BTM_DEFAULT_DISC_WINDOW, or range: 0x0012 ~ 0x1000 (11.25 ~ 2560 msecs)
interval – [in] : Interval (in 0.625 msec intervals). BTM_DEFAULT_DISC_INTERVAL, or range: 0x0012 ~ 0x1000 (11.25 ~ 2560 msecs)
- Returns
-
wiced_result_t
wiced_bt_dev_set_connectability
(uint8_t page_mode, uint16_t window, uint16_t interval)¶ Set connectablilty.
WICED_BT_SUCCESS : If successful WICED_BT_ILLEGAL_VALUE : If a bad parameter is detected WICED_BT_NO_RESOURCES : If could not allocate a message buffer WICED_BT_WRONG_MODE : If the device is not upnote
The duration (window parameter) must be less than or equal to the interval.
- Parameters
page_mode – [in] : Connectability mode (see wiced_bt_connectability_mode_e )
window – [in] : Duration (in 0.625 msec intervals). BTM_DEFAULT_CONN_WINDOW, or range: 0x0012 ~ 0x1000 (11.25 ~ 2560 msecs)
interval – [in] : Interval (in 0.625 msec intervals). BTM_DEFAULT_CONN_INTERVAL, or range: 0x0012 ~ 0x1000 (11.25 ~ 2560 msecs)
- Returns
-
wiced_result_t
wiced_bt_dev_register_connection_status_change
(wiced_bt_connection_status_change_cback_t *p_wiced_bt_connection_status_change_cback)¶ Register callback for connection status change.
WICED_BT_SUCCESS : on success; WICED_BT_FAILED : if an error occurred
- Parameters
p_wiced_bt_connection_status_change_cback – [in] - Callback for connection status change
- Returns
wiced_result_t
-
wiced_result_t
wiced_bt_dev_set_sniff_mode
(wiced_bt_device_address_t remote_bda, uint16_t min_period, uint16_t max_period, uint16_t attempt, uint16_t timeout)¶ Set a connection into sniff mode.
- Parameters
remote_bda – [in] : Link for which to put into sniff mode
min_period – [in] : Minimum sniff period (range 0x0006 to 0x0540) (in 0.625 msec)
max_period – [in] : Maximum sniff period (range 0x0006 to 0x0540) (in 0.625 msec)
attempt – [in] : Number of attempts for switching to sniff mode (range 0x0001 – 0x7FFF) (in 0.625 msec)
timeout – [in] : Timeout for attempting to switch to sniff mode (range 0x0000 – 0x7FFF) (in 0.625 msec)
- Returns
WICED_BT_PENDING if successfully initiated, otherwise error
-
wiced_result_t
wiced_bt_dev_cancel_sniff_mode
(wiced_bt_device_address_t remote_bda)¶ Take a connection out of sniff mode.
A check is made if the connection is already in sniff mode, and if not, the cancel sniff mode is ignored.
- Returns
WICED_BT_PENDING if successfully initiated, otherwise error
-
wiced_result_t
wiced_bt_dev_set_sniff_subrating
(wiced_bt_device_address_t remote_bda, uint16_t max_latency, uint16_t min_remote_timeout, uint16_t min_local_timeout)¶ Set sniff subrating parameters for an active connection.
WICED_BT_SUCCESS : on success; WICED_BT_ILLEGAL_ACTION : if an error occurred
- Parameters
remote_bda – [in] : device address of desired ACL connection
max_latency – [in] : maximum latency (in 0.625ms units) (range: 0x0002-0xFFFE)
min_remote_timeout – [in] : minimum remote timeout (in 0.625ms units) (range: 0x0000 – 0xFFFE)
min_local_timeout – [in] : minimum local timeout (in 0.625ms units) (range: 0x0000 – 0xFFFE)
- Returns
-
wiced_result_t
wiced_bt_dev_read_rssi
(wiced_bt_device_address_t remote_bda, wiced_bt_transport_t transport, wiced_bt_dev_cmpl_cback_t *p_cback)¶ Get Receive Signal Strenth Index (RSSI) for the requested link.
WICED_BT_PENDING : if command issued to controller. WICED_BT_NO_RESOURCES : if couldn’t allocate memory to issue command WICED_BT_UNKNOWN_ADDR : if no active link with bd addr specified WICED_BT_BUSY : if command is already in progress
- Parameters
remote_bda – [in] : BD address of connection to read rssi
transport – [in] : Transport type
p_cback – [in] : Result callback (wiced_bt_dev_rssi_result_t will be passed to the callback)
- Returns
-
wiced_result_t
wiced_bt_dev_write_eir
(uint8_t *p_buff, uint16_t len)¶ Write EIR data to controller.
- Parameters
p_buff – [in] : EIR data as per the spec (Spec 5.0 Vol 3 Part C, Section 8 )
len – [in] : Total Length of EIR data being passed
- Returns
WICED_BT_SUCCESS : if successful WICED_BT_NO_RESOURCES : if couldn’t allocate memory to issue command WICED_BT_UNSUPPORTED : if local device cannot support request
-
wiced_result_t
wiced_bt_dev_switch_role
(wiced_bt_device_address_t remote_bd_addr, uint8_t new_role, wiced_bt_dev_cmpl_cback_t *p_cback)¶ This function is called to switch the role between Central and Peripheral.
If role is already set it will do nothing. If the command was initiated, the callback function is called upon completion.
- Parameters
remote_bd_addr – [in] : BD address of remote device
new_role – [in] : New role (BTM_ROLE_CENTRAL or BTM_ROLE_PERIPHERAL)
p_cback – [in] : Result callback (wiced_bt_dev_switch_role_result_t will be passed to the callback)
- Returns
wiced_result_t
-
wiced_bt_dev_status_t
wiced_bt_dev_set_afh_channel_classification
(const wiced_bt_br_chnl_map_t afh_channel_map)¶ This function is called to send HCI_SET_AFH_CHANNELS command to BR/EDR controller.
Channel n is bad = 0. Channel n is unknown = 1. The most significant bit is reserved and shall be set to 0. At least 20 channels shall be marked as unknown.
- Parameters
afh_channel_map – : AFH Host Channel Classification array
- Returns
WICED_BT_UNSUPPORTED : if feature does not supported WICED_BT_WRONG_MODE : if device is in wrong mode WICED_BT_NO_RESOURCES : if device does not have buffers to process the request
-
wiced_result_t
wiced_bt_dev_get_remote_name
(wiced_bt_device_address_t bd_addr, wiced_bt_remote_name_cback_t *p_remote_name_result_cback)¶ Get BT Friendly name from remote device.
WICED_BT_PENDING : if successfully initiated WICED_BT_BUSY : if already in progress WICED_BT_ILLEGAL_VALUE : if parameter(s) are out of range WICED_BT_NO_RESOURCES : if could not allocate resources to start the command WICED_BT_WRONG_MODE : if the device is not up.
- Parameters
bd_addr – [in] : Peer bd address
p_remote_name_result_cback – [in] : remote name result callback
- Returns
wiced_result_t
-
wiced_result_t
wiced_bt_dev_set_link_policy
(wiced_bt_device_address_t remote_bda, wiced_bt_link_policy_settings_t settings)¶ This function is called to set the Link Policy for remote device.
- Parameters
remote_bda – [in] : remote device’s address
settings – [in] : the policy setting value(from wiced_bt_link_policy_settings_values_e)
- Returns
wiced_result_t
-
wiced_result_t
wiced_bt_coex_enable
(uint32_t seci_baud_rate)¶ Application can invoke this function to enable the coex functionality.
- Parameters
seci_baud_rate – [in] : SECI baud rate. Ensure to set a valid baud rate which will be used for the SECI communication between BT and WLAN chip. Maximum supported value is up to 4M
- Returns
wiced_result_t
-
void
wiced_bt_coex_disable
(void)¶ Application can invoke this function to disable the coex functionality.
- Returns
void
-
wiced_result_t
wiced_bt_dev_set_afh_channel_assessment
(wiced_bool_t enable_or_disable)¶ This function is called to set the channel assessment mode on or off.
- Parameters
enable_or_disable – [in] : Enable or disable AFH channel assessment
- Returns
wiced_result_t
-
wiced_bt_dev_status_t
wiced_bt_sco_setPacketTypes
(int16_t sco_inx, uint16_t pkt_types)¶ This function is called to set the packet types used for a specific SCO connection and for all connections.
- Parameters
sco_inx – [in] Specific connection and -1 for all connections.
pkt_types – [in] One or more of the following BTM_SCO_PKT_TYPES_MASK_HV1 BTM_SCO_PKT_TYPES_MASK_HV2 BTM_SCO_PKT_TYPES_MASK_HV3 BTM_SCO_PKT_TYPES_MASK_EV3 BTM_SCO_PKT_TYPES_MASK_EV4 BTM_SCO_PKT_TYPES_MASK_EV5 BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 BTM_SCO_PKT_TYPES_MASK_NO_3_EV5 BTM_SCO_LINK_ALL_MASK - enables all supported types
- Returns
wiced_bt_dev_status_t
-
wiced_result_t
wiced_bt_dev_setAclPacketTypes
(wiced_bt_device_address_t remote_bda, uint16_t pkt_types)¶ This function is set the ACL packet types that the device supports for specific connection and all connections if bd address with all zeros.
- Parameters
remote_bda – [in] BD Address for specific conection and for all connections it should be all 0’s.
pkt_types – [in] Packet types supported by the device. One or more of the following (bitmask): BTM_ACL_PKT_TYPES_MASK_DM1 BTM_ACL_PKT_TYPES_MASK_DH1 BTM_ACL_PKT_TYPES_MASK_DM3 BTM_ACL_PKT_TYPES_MASK_DH3 BTM_ACL_PKT_TYPES_MASK_DM5 BTM_ACL_PKT_TYPES_MASK_DH5 BTM_ACL_PKT_TYPES_MASK_NO_2_DH1 BTM_ACL_PKT_TYPES_MASK_NO_3_DH1 BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 BTM_ACL_PKT_TYPES_MASK_NO_3_DH3 BTM_ACL_PKT_TYPES_MASK_NO_2_DH5
- Returns
wiced_result_t
-
wiced_result_t