mirror of
https://github.com/meshtastic/python.git
synced 2026-01-06 14:57:58 -05:00
if --noproto is used, never send anything to the device
This commit is contained in:
@@ -108,8 +108,7 @@ class MeshInterface:
|
||||
self.nodes = None # FIXME
|
||||
self.isConnected = threading.Event()
|
||||
self.noProto = noProto
|
||||
if not noProto:
|
||||
self._startConfig()
|
||||
self._startConfig()
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
@@ -345,6 +344,13 @@ class MeshInterface:
|
||||
self._sendToRadio(startConfig)
|
||||
|
||||
def _sendToRadio(self, toRadio):
|
||||
"""Send a ToRadio protobuf to the device"""
|
||||
if self.noProto:
|
||||
logging.warn(f"Not sending packet because protocol use is disabled by noProto")
|
||||
else:
|
||||
self._sendToRadioImpl(toRadio)
|
||||
|
||||
def _sendToRadioImpl(self, toRadio):
|
||||
"""Send a ToRadio protobuf to the device"""
|
||||
logging.error(f"Subclass must provide toradio: {toRadio}")
|
||||
|
||||
@@ -540,7 +546,7 @@ class BLEInterface(MeshInterface):
|
||||
|
||||
self.device.subscribe(FROMNUM_UUID, callback=handle_data)
|
||||
|
||||
def _sendToRadio(self, toRadio):
|
||||
def _sendToRadioImpl(self, toRadio):
|
||||
"""Send a ToRadio protobuf to the device"""
|
||||
logging.debug(f"Sending: {toRadio}")
|
||||
b = toRadio.SerializeToString()
|
||||
@@ -620,7 +626,7 @@ class StreamInterface(MeshInterface):
|
||||
"""Read an array of bytes from our stream"""
|
||||
return self.stream.read(len)
|
||||
|
||||
def _sendToRadio(self, toRadio):
|
||||
def _sendToRadioImpl(self, toRadio):
|
||||
"""Send a ToRadio protobuf to the device"""
|
||||
logging.debug(f"Sending: {toRadio}")
|
||||
b = toRadio.SerializeToString()
|
||||
|
||||
Reference in New Issue
Block a user