Mbed OS Reference
|
Base class of the HCI driver use by the BLE port of the Cordio stack. More...
#include <CordioHCIDriver.h>
Public Types | |
typedef mbed::Callback< void(bool, uint16_t)> | test_end_handler_t |
Callback to inform the caller of the result of the test, the parameters are success and the number of packets received. More... | |
Public Member Functions | |
CordioHCIDriver (CordioHCITransportDriver &transport_driver) | |
Construct a new instance of an HCI driver. More... | |
virtual | ~CordioHCIDriver ()=default |
Driver destructor. More... | |
virtual buf_pool_desc_t | get_buffer_pool_description ()=0 |
Return the set of memory pool which will be used by the Cordio stack. More... | |
void | initialize () |
Initialize the HCI driver. More... | |
void | terminate () |
Termination of the driver. More... | |
virtual void | start_reset_sequence () |
Start the reset sequence of the BLE module. More... | |
virtual void | handle_reset_sequence (uint8_t *msg) |
Handle HCI messages received during the reset sequence. More... | |
virtual bool | get_random_static_address (ble::address_t &address) |
Get the random static address of the controller. More... | |
void | signal_reset_sequence_done () |
Signal to the stack that the reset sequence has been done. More... | |
uint16_t | write (uint8_t type, uint16_t len, uint8_t *pData) |
Write data in the transport channel. More... | |
virtual void | on_host_stack_inactivity () |
React to host stack inactivity. More... | |
void | handle_test_end (bool success, uint16_t packets) |
This will be called by host part of the stack to indicate the end of the test. More... | |
ble_error_t | rf_test_start_le_receiver_test (test_end_handler_t test_end_handler, uint8_t channel) |
Start BLE receiver test. More... | |
ble_error_t | rf_test_start_le_transmitter_test (test_end_handler_t test_end_handler, uint8_t channel, uint8_t length, uint8_t type) |
Start BLE transmitter test. More... | |
ble_error_t | rf_test_end () |
Complete the test. More... | |
virtual ble_error_t | set_tx_power (int8_t level_db) |
Set desired transmit power. More... | |
Protected Member Functions | |
buf_pool_desc_t | get_default_buffer_pool_description () |
Return a default set of memory pool that the Cordio stack can use. More... | |
void | set_random_static_address (const ble::address_t &random_static_address) |
Allows the driver to set a random static address. More... | |
Base class of the HCI driver use by the BLE port of the Cordio stack.
This class provide to the stack:
Definition at line 64 of file CordioHCIDriver.h.
typedef mbed::Callback<void(bool, uint16_t)> test_end_handler_t |
Callback to inform the caller of the result of the test, the parameters are success and the number of packets received.
Definition at line 165 of file CordioHCIDriver.h.
CordioHCIDriver | ( | CordioHCITransportDriver & | transport_driver | ) |
Construct a new instance of an HCI driver.
transport_driver | The driver used to communicate with the chip. |
|
virtualdefault |
Driver destructor.
|
pure virtual |
Return the set of memory pool which will be used by the Cordio stack.
Implemented in AP3CordioHCIDriver, and NRFCordioHCIDriver.
void initialize | ( | ) |
Initialize the HCI driver.
This function start by initializing the transport driver then it delegates what's remain of the initialization to the function do_initialize.
void terminate | ( | ) |
Termination of the driver.
It call in sequence:
|
virtual |
Start the reset sequence of the BLE module.
Reimplemented in NRFCordioHCIDriver.
|
virtual |
Handle HCI messages received during the reset sequence.
msg | The HCI message received. |
|
virtual |
Get the random static address of the controller.
[out] | address | MAC address is written here. |
Reimplemented in NRFCordioHCIDriver.
void signal_reset_sequence_done | ( | ) |
Signal to the stack that the reset sequence has been done.
uint16_t write | ( | uint8_t | type, |
uint16_t | len, | ||
uint8_t * | pData | ||
) |
Write data in the transport channel.
type | The type of packet to transmit. It might be an HCI command packet, ACL packet or EVT packet. Depending on the type of transport it can prefix the packet itself. |
len | Number of bytes to transmit. |
pData | pointer to the data to transmit. |
|
virtual |
React to host stack inactivity.
The host stack invoke this function when it is inactive. It allows a driver to put its controller to sleep if all the conditions are met.
Any call to write signals to the driver that the host stack is active.
void handle_test_end | ( | bool | success, |
uint16_t | packets | ||
) |
This will be called by host part of the stack to indicate the end of the test.
success | True if the TEST END command was a success. |
packets | Number of packets received during the test. |
ble_error_t rf_test_start_le_receiver_test | ( | test_end_handler_t | test_end_handler, |
uint8_t | channel | ||
) |
Start BLE receiver test.
Call rf_test_end when you want to stop.
test_end_handler | Handler that will be called with the number of packets received. |
channel | Channel to use. |
ble_error_t rf_test_start_le_transmitter_test | ( | test_end_handler_t | test_end_handler, |
uint8_t | channel, | ||
uint8_t | length, | ||
uint8_t | type | ||
) |
Start BLE transmitter test.
Call rf_test_end when you want to stop.
test_end_handler | Handler that will be called with status and the number of packets set to 0. |
channel | Channel to use. |
length | Size of payload. |
type | Type of pattern to transmit |
ble_error_t rf_test_end | ( | ) |
Complete the test.
This will trigger the end test event which will call handle_test_end
|
virtual |
Set desired transmit power.
Value equal or bigger will be used from available levels. Consult chip documentation for available values. Actual TX power is not guaranteed and is down to the implementation.
level_db | Signal level in dBm. |
|
protected |
Return a default set of memory pool that the Cordio stack can use.
This function can be used to implement get_buffer_pool_description().
|
protected |
Allows the driver to set a random static address.
Unlike the HCI command this function reports the random static address to the whole BLE system.
random_static_address | The random static address to set. |