Files
mesh-network-project/desktop_app/api/node.py

18 lines
523 B
Python

from enum import Enum
from bleak import BLEDevice, BleakScanner
NODE_BLUETOOTH_SERVICE_UUID = "E1898FF7-5063-4441-a6eb-526073B00001"
class MeshNode:
def __init__(self, ble_device: BLEDevice):
self.ble_device = ble_device
async def discover():
"""Find a mesh node via Bluetooth
"""
devices = await BleakScanner(service_uuids=[NODE_BLUETOOTH_SERVICE_UUID], scanning_mode="pasive")
# no device was found
if len(devices) == 0:
return None