mirror of
https://github.com/meshtastic/python.git
synced 2026-01-05 06:17:55 -05:00
1.1.6
This commit is contained in:
@@ -456,8 +456,17 @@ 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")
|
||||
|
||||
# We don't throw if the utf8 is invalid in the text message. Instead we just don't populate
|
||||
# the decoded.data.text and we log an error message. This at least allows some delivery to
|
||||
# the app and the app can deal with the missing decoded representation.
|
||||
#
|
||||
# Usually btw this problem is caused by apps sending binary data but setting the payload type to
|
||||
# text.
|
||||
try:
|
||||
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode("utf-8")
|
||||
except Exception as ex:
|
||||
logging.error(f"Malformatted utf8 in text message: {ex}")
|
||||
|
||||
pub.sendMessage(topic, packet=asDict, interface=self)
|
||||
|
||||
@@ -1141,8 +1150,17 @@ 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")
|
||||
|
||||
# We don't throw if the utf8 is invalid in the text message. Instead we just don't populate
|
||||
# the decoded.data.text and we log an error message. This at least allows some delivery to
|
||||
# the app and the app can deal with the missing decoded representation.
|
||||
#
|
||||
# Usually btw this problem is caused by apps sending binary data but setting the payload type to
|
||||
# text.
|
||||
try:
|
||||
asDict["decoded"]["data"]["text"] = meshPacket.decoded.data.payload.decode("utf-8")
|
||||
except Exception as ex:
|
||||
logging.error(f"Malformatted utf8 in text message: {ex}")
|
||||
|
||||
pub.sendMessage(topic, packet=asDict, interface=self)</code></pre>
|
||||
</details>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2
setup.py
2
setup.py
@@ -12,7 +12,7 @@ with open("README.md", "r") as fh:
|
||||
# This call to setup() does all the work
|
||||
setup(
|
||||
name="meshtastic",
|
||||
version="1.1.1",
|
||||
version="1.1.6",
|
||||
description="Python API & client shell for talking to Meshtastic devices",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
|
||||
Reference in New Issue
Block a user