mirror of
https://github.com/meshtastic/python.git
synced 2025-12-31 20:08:02 -05:00
Implement meshtastic.receive.text topic
This commit is contained in:
@@ -41,9 +41,10 @@ topics:</p>
|
||||
<ul>
|
||||
<li>meshtastic.connection.established - published once we've successfully connected to the radio and downloaded the node DB</li>
|
||||
<li>meshtastic.connection.lost - published once we've lost our link to the radio</li>
|
||||
<li>meshtastic.receive.position(packet) - delivers a received packet as a dictionary, if you only care about a particular
|
||||
<li>meshtastic.receive.text(packet) - delivers a received packet as a dictionary, if you only care about a particular
|
||||
type of packet, you should subscribe to the full topic name.
|
||||
If you want to see all packets, simply subscribe to "meshtastic.receive".</li>
|
||||
<li>meshtastic.receive.position(packet)</li>
|
||||
<li>meshtastic.receive.user(packet)</li>
|
||||
<li>meshtastic.receive.data(packet)</li>
|
||||
<li>meshtastic.node.updated(node = NodeInfo) - published when a node in the DB changes (appears, location changed, username changed, etc…)</li>
|
||||
@@ -103,8 +104,9 @@ topics:
|
||||
|
||||
- meshtastic.connection.established - published once we've successfully connected to the radio and downloaded the node DB
|
||||
- meshtastic.connection.lost - published once we've lost our link to the radio
|
||||
- meshtastic.receive.position(packet) - delivers a received packet as a dictionary, if you only care about a particular
|
||||
- meshtastic.receive.text(packet) - delivers a received packet as a dictionary, if you only care about a particular
|
||||
type of packet, you should subscribe to the full topic name. If you want to see all packets, simply subscribe to "meshtastic.receive".
|
||||
- meshtastic.receive.position(packet)
|
||||
- meshtastic.receive.user(packet)
|
||||
- meshtastic.receive.data(packet)
|
||||
- meshtastic.node.updated(node = NodeInfo) - published when a node in the DB changes (appears, location changed, username changed, etc...)
|
||||
@@ -411,6 +413,7 @@ class MeshInterface:
|
||||
"""Handle a MeshPacket that just arrived from the radio
|
||||
|
||||
Will publish one of the following events:
|
||||
- meshtastic.receive.text(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.position(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.user(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.data(packet = MeshPacket dictionary)
|
||||
@@ -450,6 +453,7 @@ class MeshInterface:
|
||||
|
||||
# For text messages, we go ahead and decode the text to ascii for our users
|
||||
if asDict["decoded"]["data"]["typ"] == "CLEAR_TEXT":
|
||||
topic = "meshtastic.receive.text"
|
||||
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode(
|
||||
"utf-8")
|
||||
|
||||
@@ -1094,6 +1098,7 @@ debugOut</p>
|
||||
"""Handle a MeshPacket that just arrived from the radio
|
||||
|
||||
Will publish one of the following events:
|
||||
- meshtastic.receive.text(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.position(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.user(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.data(packet = MeshPacket dictionary)
|
||||
@@ -1133,6 +1138,7 @@ debugOut</p>
|
||||
|
||||
# For text messages, we go ahead and decode the text to ascii for our users
|
||||
if asDict["decoded"]["data"]["typ"] == "CLEAR_TEXT":
|
||||
topic = "meshtastic.receive.text"
|
||||
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode(
|
||||
"utf-8")
|
||||
|
||||
|
||||
@@ -20,8 +20,9 @@ topics:
|
||||
|
||||
- meshtastic.connection.established - published once we've successfully connected to the radio and downloaded the node DB
|
||||
- meshtastic.connection.lost - published once we've lost our link to the radio
|
||||
- meshtastic.receive.position(packet) - delivers a received packet as a dictionary, if you only care about a particular
|
||||
- meshtastic.receive.text(packet) - delivers a received packet as a dictionary, if you only care about a particular
|
||||
type of packet, you should subscribe to the full topic name. If you want to see all packets, simply subscribe to "meshtastic.receive".
|
||||
- meshtastic.receive.position(packet)
|
||||
- meshtastic.receive.user(packet)
|
||||
- meshtastic.receive.data(packet)
|
||||
- meshtastic.node.updated(node = NodeInfo) - published when a node in the DB changes (appears, location changed, username changed, etc...)
|
||||
@@ -328,6 +329,7 @@ class MeshInterface:
|
||||
"""Handle a MeshPacket that just arrived from the radio
|
||||
|
||||
Will publish one of the following events:
|
||||
- meshtastic.receive.text(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.position(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.user(packet = MeshPacket dictionary)
|
||||
- meshtastic.receive.data(packet = MeshPacket dictionary)
|
||||
@@ -367,6 +369,7 @@ class MeshInterface:
|
||||
|
||||
# For text messages, we go ahead and decode the text to ascii for our users
|
||||
if asDict["decoded"]["data"]["typ"] == "CLEAR_TEXT":
|
||||
topic = "meshtastic.receive.text"
|
||||
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode(
|
||||
"utf-8")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user