[WIP] Added monitor moc

This commit is contained in:
jpk 2023-05-16 23:07:58 +02:00
parent 20c26c193d
commit 21e838bee0
2 changed files with 28 additions and 4 deletions

View File

@ -2,17 +2,23 @@
import click
from ..tools.ble import scanner
from ..tools.ble import scanner, monitor
@click.command()
def scan():
@click.command(name="scan")
def scanner_cmd():
scanner.run()
@click.command(name="monitor")
def monitor_cmd():
monitor.run()
@click.group()
def main():
pass
main.add_command(scan)
main.add_command(scanner_cmd)
main.add_command(monitor_cmd)

View File

@ -0,0 +1,18 @@
import asyncio
import bleak.exc
from bleak import BleakClient, BleakGATTCharacteristic
from hexdump import hexdump
from icecream import ic
async def monitor_services(filter: list[str] = []):
await asyncio.sleep(.1)
def run(uuid_filter: list[str] = []):
print("monitor called")
try:
asyncio.run(monitor_services(uuid_filter))
except bleak.exc.BleakDBusError as exc:
print(f"ERROR: {exc}")