Skip to content

Add handling of clientNotification on FromRadio #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions meshtastic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- `meshtastic.receive.data.portnum(packet)` (where portnum is an integer or well known PortNum enum)
- `meshtastic.node.updated(node = NodeInfo)` - published when a node in the DB changes (appears, location changed, username changed, etc...)
- `meshtastic.log.line(line)` - a raw unparsed log line from the radio
- `meshtastic.clientNotification(notification, interface) - a ClientNotification sent from the radio

We receive position, user, or data packets from the mesh. You probably only care about `meshtastic.receive.data`. The first argument for
that publish will be the packet. Text or binary data packets (from `sendData` or `sendText`) will both arrive this way. If you print packet
Expand Down
5 changes: 1 addition & 4 deletions meshtastic/__main__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
""" Main Meshtastic
"""

# We just hit the 1600 line limit for main.py, but I currently have a huge set of powermon/structured logging changes
# later we can have a separate changelist to refactor main.py into smaller files
# pylint: disable=too-many-lines
# pylint: disable=C0302

from typing import List, Optional, Union
from types import ModuleType
Expand Down
10 changes: 9 additions & 1 deletion meshtastic/mesh_interface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Mesh Interface class
"""
# pylint: disable=R0917
# pylint: disable=R0917,C0302

import collections
import json
Expand Down Expand Up @@ -1311,6 +1311,14 @@
self._handleLogRecord(fromRadio.log_record)
elif fromRadio.HasField("queueStatus"):
self._handleQueueStatusFromRadio(fromRadio.queueStatus)
elif fromRadio.HasField("clientNotification"):
publishingThread.queueWork(

Check warning on line 1315 in meshtastic/mesh_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/mesh_interface.py#L1314-L1315

Added lines #L1314 - L1315 were not covered by tests
lambda: pub.sendMessage(
"meshtastic.clientNotification",
notification=fromRadio.clientNotification,
interface=self,
)
)

elif fromRadio.HasField("mqttClientProxyMessage"):
publishingThread.queueWork(
Expand Down
Loading