mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 11:56:18 +00:00
updated tcp_msg with ack mgmt ...
This commit is contained in:
@@ -4,10 +4,11 @@ import asyncio
|
|||||||
import json
|
import json
|
||||||
from meshcore import MeshCore
|
from meshcore import MeshCore
|
||||||
from meshcore import TCPConnection
|
from meshcore import TCPConnection
|
||||||
|
from meshcore import EventType
|
||||||
|
|
||||||
HOSTNAME = "mchome"
|
HOSTNAME = "mchome"
|
||||||
PORT = 5000
|
PORT = 5000
|
||||||
DEST = "t1000"
|
DEST = "t114_fdl"
|
||||||
MSG = "Hello World"
|
MSG = "Hello World"
|
||||||
|
|
||||||
async def main () :
|
async def main () :
|
||||||
@@ -21,6 +22,9 @@ async def main () :
|
|||||||
if contact is None:
|
if contact is None:
|
||||||
print(f"Contact '{DEST}' not found in contacts.")
|
print(f"Contact '{DEST}' not found in contacts.")
|
||||||
return
|
return
|
||||||
await mc.commands.send_msg(contact ,MSG)
|
ret = await mc.commands.send_msg(contact ,MSG)
|
||||||
|
print (ret)
|
||||||
|
exp_ack = ret["expected_ack"].hex()
|
||||||
|
print(await mc.wait_for_event(EventType.ACK, attribute_filters={"code": exp_ack}, timeout=5))
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|||||||
Reference in New Issue
Block a user