Utilities

group wicedbt_utility

This sections provides Bluetooth utilities functions related to trace, local bda, tx power etc.

Functions

void wiced_bt_dev_register_hci_trace(wiced_bt_hci_trace_cback_t *p_cback)

Register to get the hci traces.

Return

void

Parameters
  • [in] p_cback: : Callback for hci traces

wiced_result_t wiced_bt_set_local_bdaddr(wiced_bt_device_address_t bd_addr, wiced_bt_ble_address_type_t addr_type)

Set Local Bluetooth Device Address.

The application has to set a valid address (Static/Random) by calling this function.

If this function is not called, the default address is typically a controller assigned address(BT device part number), which is same for perticular device type.For example, all CYW43012 devcies will typically have the same default address.

The application can set a static random address by setting the addr_type to BLE_ADDR_RANDOM. For static random addresses the top two bits of the bd_addr are required to be set, the stack will override these bits if not set. The remaining 46 bits will be taken from the value provided for bd_addr,

which cannot be all 0’s.

WICED_BT_ILLEGAL_VALUE : if invalid device address specified

WICED_BT_NO_RESOURCES : if couldn’t allocate memory to issue command

WICED_BT_SUCCESS : if local bdaddr is set successfully

note

BD_Address must be in Big Endian format

Example:

For above example it will set AB:CD:EF:01:23:45 bd address
Return

wiced_result_t

Parameters
  • [in] bd_addr: : device address to use

  • [in] addr_type: : device address type , should be BLE_ADDR_RANDOM or BLE_ADDR_PUBLIC

    BLE_ADDR_RANDOM should be only for single BLE mode, not for BR-EDR or Dual Mode.

wiced_result_t wiced_bt_dev_get_role(wiced_bt_device_address_t remote_bd_addr, uint8_t *p_role, wiced_bt_transport_t transport)

This function is called to get the role of the local device for the ACL connection with the specified remote device.

Return

WICED_BT_UNKNOWN_ADDR if no active link with bd addr specified

Parameters
  • [in] remote_bd_addr: : BD address of remote device

  • [in] transport: : BT_TRANSPORT_BR_EDR or BT_TRANSPORT_LE

  • [out] p_role: : Role of the local device

wiced_result_t wiced_bt_set_tx_power(wiced_bt_device_address_t bd_addr, int8_t power, wiced_bt_dev_vendor_specific_command_complete_cback_t *p_cb)

Command to set the tx power on link This command will adjust the transmit power attenuation on a per connection basis.

Return

wiced_result_t

Parameters
  • [in] bd_addr: : peer address To set Adv Tx power keep bd_addr NULL

  • [in] power: : power value in db

  • [in] p_cb: : Result callback (wiced_bt_set_adv_tx_power_result_t will be passed to the callback)

wiced_result_t wiced_bt_dev_read_tx_power(wiced_bt_device_address_t remote_bda, wiced_bt_transport_t transport, wiced_bt_dev_cmpl_cback_t *p_cback)

Read the transmit power 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

Return

Parameters
  • [in] remote_bda: : BD address of connection to read tx power

  • [in] transport: : Transport type

  • [in] p_cback: : Result callback (wiced_bt_tx_power_result_t will be passed to the callback)

void wiced_bt_set_pairable_mode(uint8_t allow_pairing, uint8_t connect_only_paired)

Enable or disable pairing.

Return

void

Parameters
  • [in] allow_pairing: : (TRUE or FALSE) whether or not the device allows pairing.

  • [in] connect_only_paired: : (TRUE or FALSE) whether or not to only allow paired devices to connect. Applicable only for BR/EDR

wiced_result_t wiced_bt_dev_register_vse_callback(wiced_bt_dev_vse_callback_t cb)

Application can register Vendor-Specific HCI event callback.

Return

WICED_SUCCESS WICED_ERROR if out of usage

Parameters
  • [in] cb: : callback function to register

wiced_result_t wiced_bt_dev_deregister_vse_callback(wiced_bt_dev_vse_callback_t cb)

Application can deregister Vendor-Specific HCI event callback.

Return

WICED_SUCCESS WICED_ERROR if the input callback function was not registered yet

Parameters
  • [in] cb: : callback function to deregister

This API is called to get the statistics for an ACL link.

Limitation This API works when there is only one ACL connection

WICED_BT_SUCCESS : If successful WICED_BT_PENDING : If command succesfully sent down WICED_BT_BUSY : If already in progress WICED_BT_NO_RESORCES : If no memory/buffers available to sent down to controller WICED_BT_UNKNOWN_ADDR : If given BD_ADDRESS is invalid

note

Callback function argument is a pointer of type wiced_bt_lq_stats_result_t

Return

Parameters
  • [in] bda: : bluetooth device address of desired link quality statistics

  • [in] transport: : Tranport type LE/BR-EDR

  • [in] action: : WICED_CLEAR_LINK_QUALITY_STATS = reset the link quality statistics to 0, WICED_READ_LINK_QUALITY_STATS = read link quality statistics, WICED_READ_THEN_CLEAR_LINK_QUALITY_STATS = read link quality statistics, then clear it

  • [in] p_cback: : Result callback (wiced_bt_dev_cmpl_cback_t will be passed to the callback)