mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-07 09:55:45 +00:00
added callback for Bluetooth hardware error
This commit is contained in:
parent
57fe2af8bc
commit
d23838ec66
12
src/hci.c
12
src/hci.c
@ -1504,7 +1504,9 @@ static void event_handler(uint8_t *packet, int size){
|
||||
break;
|
||||
|
||||
case HCI_EVENT_HARDWARE_ERROR:
|
||||
if(hci_stack->control && hci_stack->control->hw_error){
|
||||
if (hci_stack->hardware_error_callback){
|
||||
(*hci_stack->hardware_error_callback)();
|
||||
} else if(hci_stack->control && hci_stack->control->hw_error){
|
||||
(*hci_stack->control->hw_error)();
|
||||
} else {
|
||||
// if no special requests, just reboot stack
|
||||
@ -2915,6 +2917,14 @@ le_command_status_t gap_disconnect(hci_con_handle_t handle){
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set callback for Bluetooth Hardware Error
|
||||
*/
|
||||
void hci_set_hardware_error_callback(void (*fn)(void)){
|
||||
hci_stack->hardware_error_callback = fn;
|
||||
}
|
||||
|
||||
|
||||
void hci_disconnect_all(void){
|
||||
linked_list_iterator_t it;
|
||||
linked_list_iterator_init(&it, &hci_stack->connections);
|
||||
|
@ -679,6 +679,9 @@ typedef struct {
|
||||
bd_addr_t custom_bd_addr;
|
||||
uint8_t custom_bd_addr_set;
|
||||
|
||||
// hardware error handler
|
||||
void (*hardware_error_callback)(void);
|
||||
|
||||
} hci_stack_t;
|
||||
|
||||
/**
|
||||
@ -854,6 +857,12 @@ void hci_ssp_set_auto_accept(int auto_accept);
|
||||
* @brief Get addr type and address used in advertisement packets.
|
||||
*/
|
||||
void hci_le_advertisement_address(uint8_t * addr_type, bd_addr_t addr);
|
||||
|
||||
/**
|
||||
* @brief Set callback for Bluetooth Hardware Error
|
||||
*/
|
||||
void hci_set_hardware_error_callback(void (*fn)(void));
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user