Module meshtastic.connection.base_connection

Connection base class

Expand source code
"""Connection base class
"""

from typing import Union

from meshtastic.mesh_interface import MeshInterface
from meshtastic.protobuf import mesh_pb2

class BaseConnection:
    """Base Connection class for meshtastic devices"""

    def __init__(self):
        self.interface: Optional[MeshInterface] = None

    def _handleFromRadio(self, fromRadioBytes: Union[bytes, str]) -> None:
        "Send bytes to the interface using this connection"
        if self.interface is not None:
            self.interface._handleFromRadio(fromRadioBytes)

    def _sendToRadioImpl(self, toRadio: mesh_pb2.ToRadio) -> None:
        "Send bytes to the radio"

Classes

class BaseConnection

Base Connection class for meshtastic devices

Expand source code
class BaseConnection:
    """Base Connection class for meshtastic devices"""

    def __init__(self):
        self.interface: Optional[MeshInterface] = None

    def _handleFromRadio(self, fromRadioBytes: Union[bytes, str]) -> None:
        "Send bytes to the interface using this connection"
        if self.interface is not None:
            self.interface._handleFromRadio(fromRadioBytes)

    def _sendToRadioImpl(self, toRadio: mesh_pb2.ToRadio) -> None:
        "Send bytes to the radio"

Subclasses