Need to enable ble before scanning

This commit is contained in:
Dan Halbert 2019-05-23 22:05:16 -04:00
parent 1639354e5f
commit 6cec81bcb5
3 changed files with 2 additions and 2 deletions

View File

@ -288,7 +288,7 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self) {
common_hal_bleio_adapter_set_enabled(true); // TODO -- Do this somewhere else maybe bleio __init__
common_hal_bleio_adapter_set_enabled(true);
self->gatt_role = GATT_ROLE_SERVER;
self->conn_handle = BLE_CONN_HANDLE_INVALID;

View File

@ -70,6 +70,7 @@ STATIC void on_ble_evt(ble_evt_t *ble_evt, void *scanner_in) {
}
void common_hal_bleio_scanner_scan(bleio_scanner_obj_t *self, mp_float_t timeout, mp_float_t interval, mp_float_t window) {
common_hal_bleio_adapter_set_enabled(true);
ble_drv_add_event_handler(on_ble_evt, self);
ble_gap_scan_params_t scan_params = {

View File

@ -85,7 +85,6 @@ STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_CharacteristicBuffer), MP_ROM_PTR(&bleio_characteristic_buffer_type) },
// { MP_ROM_QSTR(MP_QSTR_Descriptor), MP_ROM_PTR(&bleio_descriptor_type) },
{ MP_ROM_QSTR(MP_QSTR_Peripheral), MP_ROM_PTR(&bleio_peripheral_type) },
// Hide work-in-progress.
{ MP_ROM_QSTR(MP_QSTR_ScanEntry), MP_ROM_PTR(&bleio_scanentry_type) },
{ MP_ROM_QSTR(MP_QSTR_Scanner), MP_ROM_PTR(&bleio_scanner_type) },
{ MP_ROM_QSTR(MP_QSTR_Service), MP_ROM_PTR(&bleio_service_type) },