| jupyter |
| jupytext |
kernelspec |
| formats |
text_representation |
| ipynb,md |
| extension |
format_name |
format_version |
jupytext_version |
| .md |
markdown |
1.3 |
1.11.2 |
|
|
| display_name |
language |
name |
| Python 3 |
python |
python3 |
|
|
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]
)