From 02ed17837bc3806b1f2c3ac2ab403ead3c66a323 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Fri, 10 May 2024 14:54:32 -0700 Subject: [PATCH] Improve FromRadio handling, publish messages for client proxy/xmodem stuff tentatively --- meshtastic/mesh_interface.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 9ffa983..e684850 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -875,14 +875,28 @@ class MeshInterface: elif fromRadio.HasField("queueStatus"): self._handleQueueStatusFromRadio(fromRadio.queueStatus) - elif fromRadio.rebooted: + elif fromRadio.HasField("mqttClientProxyMessage"): + publishingThread.queueWork( + lambda: pub.sendMessage( + "meshtastic.mqttclientproxymessage", proxymessage=fromRadio.mqttClientProxyMessage, interface=self + ) + ) + + elif fromRadio.HasField("xmodemPacket"): + publishingThread.queueWork( + lambda: pub.sendMessage( + "meshtastic.xmodempacket", packet=fromRadio.xmodemPacket, interface=self + ) + ) + + elif fromRadio.HasField("rebooted") and fromRadio.rebooted: # Tell clients the device went away. Careful not to call the overridden # subclass version that closes the serial port MeshInterface._disconnected(self) self._startConfig() # redownload the node db etc... - elif fromRadio.config or fromRadio.moduleConfig: + elif fromRadio.HasField("config") or fromRadio.HasField("moduleConfig"): if fromRadio.config.HasField("device"): self.localNode.localConfig.device.CopyFrom(fromRadio.config.device) elif fromRadio.config.HasField("position"):