auto decode text payloads

This commit is contained in:
geeksville
2020-05-19 15:23:52 -07:00
parent 6d3c34878b
commit 7307a3c716
3 changed files with 12 additions and 4 deletions

8
.vscode/launch.json vendored
View File

@@ -27,6 +27,14 @@
"module": "meshtastic",
"justMyCode": true,
"args": ["--debug", "--seriallog", "stdout"]
},
{
"name": "meshtastic test",
"type": "python",
"request": "launch",
"module": "meshtastic",
"justMyCode": true,
"args": ["--test"]
}
]
}

View File

@@ -249,9 +249,9 @@ class MeshInterface:
if meshPacket.decoded.HasField("data"):
topic = "meshtastic.receive.data"
# For text messages, we go ahead and decode the text to ascii for our users
# if asObj.decoded.data.typ == "CLEAR_TEXT":
# asObj.decoded.data.text = asObj.decoded.data.decoded.decode(
# "utf-8")
if asDict["decoded"]["data"]["typ"] == "CLEAR_TEXT":
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode(
"utf-8")
pub.sendMessage(topic, packet=asDict, interface=self)

View File

@@ -56,7 +56,7 @@ def testSend(fromInterface, toInterface):
toNode = toInterface.myInfo.my_node_num
# FIXME, hack to test broadcast
toNode = 255
# toNode = 255
logging.info(f"Sending test packet from {fromNode} to {toNode}")
fromInterface.sendText(f"Test {testNumber}", toNode)