mirror of
https://github.com/markqvist/Sideband.git
synced 2025-11-30 04:06:39 -05:00
Use local version of able
This commit is contained in:
parent
2e44d49d6b
commit
9b6a51a03e
67 changed files with 5305 additions and 0 deletions
27
libs/able/examples/service_scan/service.py
Normal file
27
libs/able/examples/service_scan/service.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"""Service to run BLE scan for 60 seconds,
|
||||
and log each `on_device` event.
|
||||
"""
|
||||
import time
|
||||
|
||||
from able import BluetoothDispatcher
|
||||
from kivy.logger import Logger
|
||||
|
||||
|
||||
class BLE(BluetoothDispatcher):
|
||||
def on_device(self, device, rssi, advertisement):
|
||||
title = device.getName() or device.getAddress()
|
||||
Logger.info("BLE Device found: %s", title)
|
||||
|
||||
def on_error(self, msg):
|
||||
Logger.error("BLE Error %s", msg)
|
||||
|
||||
|
||||
def main():
|
||||
ble = BLE()
|
||||
ble.start_scan()
|
||||
time.sleep(60)
|
||||
ble.stop_scan()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue