mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
Change contract for commands to return full event
This commit is contained in:
parent
39ea3cb3f3
commit
6fbf15885d
17 changed files with 231 additions and 104 deletions
|
|
@ -5,6 +5,7 @@ import json
|
|||
|
||||
from meshcore import MeshCore
|
||||
from meshcore import SerialConnection
|
||||
from meshcore import EventType
|
||||
|
||||
PORT = "/dev/ttyUSB0"
|
||||
BAUDRATE = 115200
|
||||
|
|
@ -16,6 +17,10 @@ async def main () :
|
|||
mc = MeshCore(con)
|
||||
await mc.connect()
|
||||
|
||||
print(json.dumps(await mc.commands.get_contacts(),indent=4))
|
||||
result = await mc.commands.get_contacts()
|
||||
if result.type == EventType.ERROR:
|
||||
print(f"Error getting contacts: {result.payload}")
|
||||
else:
|
||||
print(json.dumps(result.payload, indent=4))
|
||||
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue