hci: provided error code in hardware error callback

This commit is contained in:
Matthias Ringwald 2016-07-17 20:58:49 +02:00
parent e63eef5d93
commit c2e1fa6005
3 changed files with 6 additions and 6 deletions

View File

@ -721,8 +721,8 @@ void BTstackManager::setPublicBdAddr(bd_addr_t addr){
memcpy(public_bd_addr, addr ,6);
}
void bluetooth_hardware_error(){
printf("Bluetooth Hardware Error event. Restarting...\n\n\n");
void bluetooth_hardware_error(uint8_t error){
printf("Bluetooth Hardware Error event 0x%02x. Restarting...\n\n\n", error);
#ifdef __AVR__
wdt_enable(WDTO_15MS);
// wait for watchdog to trigger

View File

@ -1729,7 +1729,7 @@ static void event_handler(uint8_t *packet, int size){
case HCI_EVENT_HARDWARE_ERROR:
log_error("Hardware Error: 0x%02x", packet[2]);
if (hci_stack->hardware_error_callback){
(*hci_stack->hardware_error_callback)();
(*hci_stack->hardware_error_callback)(packet[2]);
} else {
// if no special requests, just reboot stack
hci_power_control_off();
@ -3617,7 +3617,7 @@ int hci_get_sco_packet_length(void){
/**
* @brief Set callback for Bluetooth Hardware Error
*/
void hci_set_hardware_error_callback(void (*fn)(void)){
void hci_set_hardware_error_callback(void (*fn)(uint8_t error)){
hci_stack->hardware_error_callback = fn;
}

View File

@ -570,7 +570,7 @@ typedef struct {
void (*local_version_information_callback)(uint8_t * local_version_information);
// hardware error callback
void (*hardware_error_callback)(void);
void (*hardware_error_callback)(uint8_t error);
// basic configuration
const char * local_name;
@ -713,7 +713,7 @@ void hci_set_link_key_db(btstack_link_key_db_t const * link_key_db);
/**
* @brief Set callback for Bluetooth Hardware Error
*/
void hci_set_hardware_error_callback(void (*fn)(void));
void hci_set_hardware_error_callback(void (*fn)(uint8_t error));
/**
* @brief Set callback for local information from Bluetooth controller right after HCI Reset