mirror of
https://github.com/markqvist/Sideband.git
synced 2025-11-09 10:45:04 -05:00
1.1 KiB
1.1 KiB
| jupyter | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Setup
%run init.ipynb
%%there
class BLE(BluetoothDispatcher):
def on_scan_started(self, success):
results.started = success
def on_scan_completed(self):
results.completed = 1
def on_device(self, device, rssi, advertisement):
results.devices.append(device)
ble = BLE()
Run BLE devices scan
%%there
results = Results()
print(f"Started: {results.started} Completed: {results.completed}")
ble.start_scan()
sleep(10)
%%there
ble.stop_scan()
sleep(2)
Check that scan started and completed
%%there
print(f"Started: {results.started} Completed: {results.completed}")
Check that testing device was discovered
%%there
print(
"KivyBLETest" in [dev.getName() for dev in results.devices]
)