1.1.24 for #44

This commit is contained in:
Kevin Hester
2020-12-15 16:58:49 +08:00
parent 862f660600
commit 5952972334
3 changed files with 44 additions and 43 deletions

View File

@@ -548,16 +548,17 @@ class MeshInterface:
# byte array.
asDict["decoded"]["data"]["payload"] = meshPacket.decoded.data.payload
# UNKNOWN_APP is the default protobuf pornum value, and therefore if not set it will not be populated at all
# UNKNOWN_APP is the default protobuf portnum value, and therefore if not set it will not be populated at all
# to make API usage easier, set it to prevent confusion
if not "portnum" in asDict["decoded"]["data"]:
asDict["decoded"]["data"]["portnum"] = portnums_pb2.PortNum.UNKNOWN_APP
asDict["decoded"]["data"]["portnum"] = portnums_pb2.PortNum.Name(portnums_pb2.PortNum.UNKNOWN_APP)
portnum = asDict["decoded"]["data"]["portnum"]
topic = f"meshtastic.receive.data.{portnum}"
# For text messages, we go ahead and decode the text to ascii for our users
if asDict["decoded"]["data"]["portnum"] == portnums_pb2.PortNum.TEXT_MESSAGE_APP:
if portnum == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.TEXT_MESSAGE_APP):
topic = "meshtastic.receive.text"
# We don't throw if the utf8 is invalid in the text message. Instead we just don't populate
@@ -572,7 +573,7 @@ class MeshInterface:
logging.error(f"Malformatted utf8 in text message: {ex}")
# decode position protobufs and update nodedb, provide decoded version as "position" in the published msg
if asDict["decoded"]["data"]["portnum"] == portnums_pb2.PortNum.POSITION_APP:
if portnum == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.POSITION_APP):
topic = "meshtastic.receive.position"
pb = mesh_pb2.Position()
pb.ParseFromString(meshPacket.decoded.data.payload)
@@ -583,7 +584,7 @@ class MeshInterface:
self._getOrCreateByNum(asDict["from"])["position"] = p
# decode user protobufs and update nodedb, provide decoded version as "position" in the published msg
if asDict["decoded"]["data"]["portnum"] == portnums_pb2.PortNum.NODEINFO_APP:
if portnum == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.NODEINFO_APP):
topic = "meshtastic.receive.user"
pb = mesh_pb2.User()
pb.ParseFromString(meshPacket.decoded.data.payload)
@@ -1392,16 +1393,17 @@ noProto – If True, don't try to run our protocol on the link - just be a d
# byte array.
asDict["decoded"]["data"]["payload"] = meshPacket.decoded.data.payload
# UNKNOWN_APP is the default protobuf pornum value, and therefore if not set it will not be populated at all
# UNKNOWN_APP is the default protobuf portnum value, and therefore if not set it will not be populated at all
# to make API usage easier, set it to prevent confusion
if not "portnum" in asDict["decoded"]["data"]:
asDict["decoded"]["data"]["portnum"] = portnums_pb2.PortNum.UNKNOWN_APP
asDict["decoded"]["data"]["portnum"] = portnums_pb2.PortNum.Name(portnums_pb2.PortNum.UNKNOWN_APP)
portnum = asDict["decoded"]["data"]["portnum"]
topic = f"meshtastic.receive.data.{portnum}"
# For text messages, we go ahead and decode the text to ascii for our users
if asDict["decoded"]["data"]["portnum"] == portnums_pb2.PortNum.TEXT_MESSAGE_APP:
if portnum == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.TEXT_MESSAGE_APP):
topic = "meshtastic.receive.text"
# We don't throw if the utf8 is invalid in the text message. Instead we just don't populate
@@ -1416,7 +1418,7 @@ noProto – If True, don't try to run our protocol on the link - just be a d
logging.error(f"Malformatted utf8 in text message: {ex}")
# decode position protobufs and update nodedb, provide decoded version as "position" in the published msg
if asDict["decoded"]["data"]["portnum"] == portnums_pb2.PortNum.POSITION_APP:
if portnum == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.POSITION_APP):
topic = "meshtastic.receive.position"
pb = mesh_pb2.Position()
pb.ParseFromString(meshPacket.decoded.data.payload)
@@ -1427,7 +1429,7 @@ noProto – If True, don't try to run our protocol on the link - just be a d
self._getOrCreateByNum(asDict["from"])["position"] = p
# decode user protobufs and update nodedb, provide decoded version as "position" in the published msg
if asDict["decoded"]["data"]["portnum"] == portnums_pb2.PortNum.NODEINFO_APP:
if portnum == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.NODEINFO_APP):
topic = "meshtastic.receive.user"
pb = mesh_pb2.User()
pb.ParseFromString(meshPacket.decoded.data.payload)

View File

File diff suppressed because one or more lines are too long

View File

@@ -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.23",
version="1.1.24",
description="Python API & client shell for talking to Meshtastic devices",
long_description=long_description,
long_description_content_type="text/markdown",