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.

Parameters

p_cback[in] : Callback for hci traces

Returns

void

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

Parameters
  • bd_addr[in] : device address to use

  • addr_type[in]

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

Returns

wiced_result_t

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.

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

  • transport[in] : BT_TRANSPORT_BR_EDR or BT_TRANSPORT_LE

  • p_role[out] : Role of the local device

Returns

WICED_BT_UNKNOWN_ADDR if no active link with bd addr specified

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.

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

  • power[in] : power value in db

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

Returns

wiced_result_t

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

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

  • transport[in] : Transport type

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

Returns

void wiced_bt_set_pairable_mode(uint8_t allow_pairing, uint8_t connect_only_paired)

Enable or disable pairing.

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

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

Returns

void

wiced_result_t wiced_bt_dev_register_vse_callback(wiced_bt_dev_vse_callback_t cb)

Application can register Vendor-Specific HCI event callback.

Parameters

cb[in] : callback function to register

Returns

WICED_SUCCESS WICED_ERROR if out of usage

wiced_result_t wiced_bt_dev_deregister_vse_callback(wiced_bt_dev_vse_callback_t cb)

Application can deregister Vendor-Specific HCI event callback.

Parameters

cb[in] : callback function to deregister

Returns

WICED_SUCCESS WICED_ERROR if the input callback function was not registered yet

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

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

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

  • action[in] : 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

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

Returns