Skip to content

Commit 46a8db2

Browse files
committed
Add handling of clientNotification on FromRadio, sending a pubsub message
1 parent e2c9c13 commit 46a8db2

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

meshtastic/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- `meshtastic.receive.data.portnum(packet)` (where portnum is an integer or well known PortNum enum)
3636
- `meshtastic.node.updated(node = NodeInfo)` - published when a node in the DB changes (appears, location changed, username changed, etc...)
3737
- `meshtastic.log.line(line)` - a raw unparsed log line from the radio
38+
- `meshtastic.clientNotification(notification, interface) - a ClientNotification sent from the radio
3839
3940
We receive position, user, or data packets from the mesh. You probably only care about `meshtastic.receive.data`. The first argument for
4041
that publish will be the packet. Text or binary data packets (from `sendData` or `sendText`) will both arrive this way. If you print packet

meshtastic/mesh_interface.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Mesh Interface class
22
"""
3-
# pylint: disable=R0917
3+
# pylint: disable=R0917,C0302
44

55
import collections
66
import json
@@ -1311,6 +1311,14 @@ def _handleFromRadio(self, fromRadioBytes):
13111311
self._handleLogRecord(fromRadio.log_record)
13121312
elif fromRadio.HasField("queueStatus"):
13131313
self._handleQueueStatusFromRadio(fromRadio.queueStatus)
1314+
elif fromRadio.HasField("clientNotification"):
1315+
publishingThread.queueWork(
1316+
lambda: pub.sendMessage(
1317+
"meshtastic.clientNotification",
1318+
notification=fromRadio.clientNotification,
1319+
interface=self,
1320+
)
1321+
)
13141322

13151323
elif fromRadio.HasField("mqttClientProxyMessage"):
13161324
publishingThread.queueWork(

0 commit comments

Comments
 (0)