[WIP] Added monitor moc
This commit is contained in:
parent
20c26c193d
commit
21e838bee0
|
@ -2,17 +2,23 @@
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from ..tools.ble import scanner
|
from ..tools.ble import scanner, monitor
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command(name="scan")
|
||||||
def scan():
|
def scanner_cmd():
|
||||||
scanner.run()
|
scanner.run()
|
||||||
|
|
||||||
|
|
||||||
|
@click.command(name="monitor")
|
||||||
|
def monitor_cmd():
|
||||||
|
monitor.run()
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def main():
|
def main():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
main.add_command(scan)
|
main.add_command(scanner_cmd)
|
||||||
|
main.add_command(monitor_cmd)
|
||||||
|
|
|
@ -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}")
|
Loading…
Reference in New Issue