8000 Merge remote-tracking branch 'origin/main' into main · urish/circuitpython@e7fd35b · GitHub
[go: up one dir, main page]

Skip to content

Commit e7fd35b

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents 20d1ef2 + 8cef3d2 commit e
8000
7fd35b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ports/nrf/common-hal/_bleio/Adapter.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,16 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
507507
}
508508
self->scan_results = NULL;
509509
}
510+
// Check to see if advertising is going already.
511+
if (self->current_advertising_data != NULL && self->current_advertising_data == self->advertising_data) {
512+
check_nrf_error(NRF_ERROR_BUSY);
513+
}
514+
515+
// If the current advertising data isn't owned by the adapter then it must be an internal
516+
// advertisement that we should stop.
517+
if (self->current_advertising_data != NULL) {
518+
common_hal_bleio_adapter_stop_advertising(self);
519+
}
510520
self->scan_results = shared_module_bleio_new_scanresults(buffer_size, prefixes, prefix_length, minimum_rssi);
511521
size_t max_packet_size = extended ? BLE_GAP_SCAN_BUFFER_EXTENDED_MAX_SUPPORTED : BLE_GAP_SCAN_BUFFER_MAX;
512522
uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size, false);

0 commit comments

Comments
 (0)
0