mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-06-11 03:56:16 +00:00
example to show how to get chan messages with path
This commit is contained in:
18
examples/chan_recv_with_path.py
Normal file
18
examples/chan_recv_with_path.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import asyncio
|
||||||
|
from meshcore import MeshCore
|
||||||
|
from meshcore import EventType
|
||||||
|
from meshcore import BLEConnection
|
||||||
|
|
||||||
|
async def main () :
|
||||||
|
mc = await MeshCore.create_ble("f1x")
|
||||||
|
# this will enable channel log decryption (needed to link path with message)
|
||||||
|
mc.set_decrypt_channel_logs = True
|
||||||
|
# get info for channel 0 (needed so the reader has info needed for decryption)
|
||||||
|
await mc.commands.get_channel(0)
|
||||||
|
await mc.start_auto_message_fetching()
|
||||||
|
while True:
|
||||||
|
result = await mc.wait_for_event(EventType.CHANNEL_MSG_RECV)
|
||||||
|
if result:
|
||||||
|
print(result)
|
||||||
|
|
||||||
|
asyncio.run(main())
|
||||||
Reference in New Issue
Block a user