Merge branch 'pr-poetry' into powermon

This commit is contained in:
Kevin Hester
2024-06-22 10:34:16 -07:00
parent 4203553a44
commit b41cb7d8df
11 changed files with 575 additions and 13 deletions

View File

@@ -29,7 +29,7 @@ from meshtastic import (
NODELESS_WANT_CONFIG_ID,
ResponseHandler,
protocols,
publishingThread,
publishingThread
)
from meshtastic.util import (
Acknowledgment,
@@ -40,7 +40,7 @@ from meshtastic.util import (
stripnl,
message_to_json,
)
from meshtastic.observable import Observable
class MeshInterface: # pylint: disable=R0902
"""Interface class for meshtastic devices
@@ -71,6 +71,7 @@ class MeshInterface: # pylint: disable=R0902
self.nodes: Optional[Dict[str,Dict]] = None # FIXME
self.isConnected: threading.Event = threading.Event()
self.noProto: bool = noProto
self.onLogMessage = Observable()
self.localNode: meshtastic.node.Node = meshtastic.node.Node(self, -1) # We fixup nodenum later
self.myInfo: Optional[mesh_pb2.MyNodeInfo] = None # We don't have device info yet
self.metadata: Optional[mesh_pb2.DeviceMetadata] = None # We don't have device metadata yet
@@ -111,6 +112,10 @@ class MeshInterface: # pylint: disable=R0902
logging.error(f"Traceback: {traceback}")
self.close()
def _handleLogLine(self, line):
"""Handle a line of log output from the device."""
self.onLogMessage.fire(message=line)
def showInfo(self, file=sys.stdout) -> str: # pylint: disable=W0613
"""Show human readable summary about this object"""
owner = f"Owner: {self.getLongName()} ({self.getShortName()})"