BLE HCI API

group group_ble_common_HCI_api_functions

API exposes BLE Stack’s Host HCI to user, if they want to do DTM testing or use BLE Controller alone.

Functions

cy_en_ble_api_result_t Cy_BLE_SoftHciSendAppPkt(cy_stc_ble_hci_tx_packet_info_t *HciPktParams)

This function sends a HCI packet to the BLE Stack’s Controller when the Soft Transport feature is enabled using the Cy_BLE_SoftHciTransportEnable() API.

Application should allocate memory for the buffer to hold the HCI packet passed as an input parameter. This API copies the HCI packet into the controller’s HCI buffer. Hence, the Application may deallocate the memory buffer created to hold the HCI packet, once the API returns.

Return value

Description

CY_BLE_SUCCESS

On successful operation.

CYBLE_ERROR_INVALID_PARAMETER

HciPktParams Parameter is NULL.

CY_BLE_ERROR_INVALID_OPERATION

Operation not permitted.

CYBLE_ERROR_MEMORY_ALLOCATION_FAILED

Memory allocation failed.

Parameters

HciPktParams – HCI packet which the application wants to push to the BLE Stack’s Controller.

Returns

cy_en_ble_api_result_t : Returns whether the controller is active or not.

cy_en_ble_api_result_t Cy_BLE_RegisterHciCb(cy_ble_hci_rx_cb_t param)

This function will initialize the HCI layer of the BLE Host and will register Rx callback for all HCI events and data.

This function must be called before calling Cy_BLE_HciTransmit(). This function should not be called during normal BLE Stack operation. If an application randomly uses HCI functions along with other functions, behavior will be unpredictable.

Errors codes

Description

CY_BLE_SUCCESS

On successful operation.

CY_BLE_ERROR_INVALID_PARAMETER

On specifying NULL as input parameter.

Parameters

param – parameter is of type ‘cy_ble_hci_rx_cb_t’, callback function for the packets received from the controller. Please refer to BLE Core 5.0 Specification, Vol 2, Part E Section 7 for details on HCI event/data packet format.

Returns

cy_en_ble_api_result_t : Return value indicates whether the function succeeded or failed. Following are the possible error codes.

void Cy_BLE_HciShutdown(void)

This function stops any ongoing operation on the BLE Stack and forces the BLE Host HCI and the BLE controller to shut down.

The only functions that can be called after calling this function is Cy_BLE_StackInit() or Cy_BLE_RegisterHciCb().

No event is generated on calling this function.

Returns

None

cy_en_ble_api_result_t Cy_BLE_HciTransmit(cy_stc_ble_hci_tx_packet_info_t *param)

The application must use this function for sending HCI command/data packet to the controller.

Refer to BLE Core 5.0 Specification, Vol 2, Part E Section 7 for details on HCI command/data packet format.

This function must be called after calling ‘Cy_BLE_RegisterHciCb()’.

Errors codes

Description

CY_BLE_SUCCESS

On successful operation.

CY_BLE_ERROR_INVALID_PARAMETER

On specifying NULL as input parameter.

Parameters

param – parameter is of type ‘cy_stc_ble_hci_tx_packet_info_t

Returns

cy_en_ble_api_result_t : Return value indicates whether the function succeeded or failed. Following are the possible error codes.