@@ -70,6 +70,7 @@ STATIC int btstack_error_to_errno(int err) {
70
70
}
71
71
}
72
72
73
+ #if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
73
74
STATIC mp_obj_bluetooth_uuid_t create_mp_uuid (uint16_t uuid16 , const uint8_t * uuid128 ) {
74
75
mp_obj_bluetooth_uuid_t result ;
75
76
if (uuid16 != 0 ) {
@@ -82,6 +83,7 @@ STATIC mp_obj_bluetooth_uuid_t create_mp_uuid(uint16_t uuid16, const uint8_t *uu
82
83
}
83
84
return result ;
84
85
}
86
+ #endif
85
87
86
88
// Notes on supporting background ops (e.g. an attempt to gatts_notify while
87
89
// an existing notification is in progress):
@@ -286,16 +288,6 @@ STATIC void btstack_packet_handler(uint8_t packet_type, uint8_t *packet, uint8_t
286
288
DEBUG_EVENT_printf (" --> btstack # conns changed\n" );
287
289
} else if (event_type == HCI_EVENT_VENDOR_SPECIFIC ) {
288
290
DEBUG_EVENT_printf (" --> hci vendor specific\n" );
289
- } else if (event_type == GAP_EVENT_ADVERTISING_REPORT ) {
290
- DEBUG_EVENT_printf (" --> gap advertising report\n" );
291
- bd_addr_t address ;
292
- gap_event_advertising_report_get_address (packet , address );
293
- uint8_t adv_event_type = gap_event_advertising_report_get_advertising_event_type (packet );
294
- uint8_t address_type = gap_event_advertising_report_get_address_type (packet );
295
- int8_t rssi = gap_event_advertising_report_get_rssi (packet );
296
- uint8_t length = gap_event_advertising_report_get_data_length (packet );
297
- const uint8_t * data = gap_event_advertising_report_get_data (packet );
298
- mp_bluetooth_gap_on_scan_result (address_type , address , adv_event_type , rssi , data , length );
299
291
} else if (event_type == HCI_EVENT_DISCONNECTION_COMPLETE ) {
300
292
DEBUG_EVENT_printf (" --> hci disconnect complete\n" );
301
293
uint16_t conn_handle = hci_event_disconnection_complete_get_connection_handle (packet );
@@ -311,6 +303,16 @@ STATIC void btstack_packet_handler(uint8_t packet_type, uint8_t *packet, uint8_t
311
303
uint8_t addr [6 ] = {0 };
312
304
mp_bluetooth_gap_on_connected_disconnected (irq_event , conn_handle , 0xff , addr );
313
305
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
306
+ } else if (event_type == GAP_EVENT_ADVERTISING_REPORT ) {
307
+ DEBUG_EVENT_printf (" --> gap advertising report\n" );
308
+ bd_addr_t address ;
309
+ gap_event_advertising_report_get_address (packet , address );
310
+ uint8_t adv_event_type = gap_event_advertising_report_get_advertising_event_type (packet );
311
+ uint8_t address_type = gap_event_advertising_report_get_address_type (packet );
312
+ int8_t rssi = gap_event_advertising_report_get_rssi (packet );
313
+ uint8_t length = gap_event_advertising_report_get_data_length (packet );
314
+ const uint8_t * data = gap_event_advertising_report_get_data (packet );
315
+ mp_bluetooth_gap_on_scan_result (address_type , address , adv_event_type , rssi , data , length );
314
316
} else if (event_type == GATT_EVENT_QUERY_COMPLETE ) {
315
317
uint16_t conn_handle = gatt_event_query_complete_get_handle (packet );
316
318
uint16_t status = gatt_event_query_complete_get_att_status (packet );
0 commit comments