Skip to content

Digipeater

The digipeater service provides digipeating functionality to pax25. It is enabled by default.

Currently, the digipeater only listens for repeat requests for the station's main name on SSID zero, which is the most common convention. Other repeat requests are ignored.

Note

Repeats are currently only performed on the interface that received them, and do not allow other stations to contact stations across interfaces. This may change in the future if we are satisfied that it will not have significant side-effects.

pax25.services.digipeater

Digipeater system. Will determine whether a digipeating frame is one we need to relay, and if so, will queue up the digipeated frame with the correct flags marked.

Digipeater

Digipeater class. Manages digipeating functions. Only ever digipeats on the interface it hears from.

This may need to be expanded later to allow for multiple digipeater conditions, but for now we assume a single digipeater per station, which responds on the main station name with SSID 0.

Source code in pax25/services/digipeater.py
class Digipeater:
    """
    Digipeater class. Manages digipeating functions. Only ever digipeats on the
    interface it hears from.

    This may need to be expanded later to allow for multiple digipeater conditions,
    but for now we assume a single digipeater per station, which responds on the main
    station name with SSID 0.
    """

    def __init__(
        self,
        station: "Station",
        settings: DigipeaterSettings | None,
    ) -> None:
        """Initializes the digipeater."""
        self.station = station
        self._settings = settings or DigipeaterSettings(enabled=True)
        matcher = needs_repeat_from(self.address)
        self.station.frame_router.register_matcher(
            "digipeater", MatchCall(matcher=matcher, notify=self.repeat)
        )

    @property
    def address(self) -> Address:
        """
        Gets the repeater address of the station.
        """
        return Address(name=self.station.name, ssid=0)

    async def reload_settings(self, settings: DigipeaterSettings) -> None:
        """
        Reloads the service with new settings.
        """
        # We don't have to restart anything, since this is used on-demand.
        self._settings = settings

    @property
    def enabled(self) -> bool:
        """
        Whether the Digipeater is enabled.
        """
        return self._settings.get("enabled", True)

    @property
    def settings(self) -> DigipeaterSettings:
        """
        Returns the current digipeater settings.
        """
        return smart_clone(self._settings)

    def repeat(self, frame: Frame, interface: Interface) -> None:
        """
        Performs digipeating for a matched frame.
        """
        if not self.enabled:
            return
        self.station.frame_router.send_frame(
            interface, repeated_for(self.address, frame)
        )

    def unregister(self) -> None:
        """
        Remove the digipeater from the matchers, effectively disabling it.
        """
        self.station.frame_router.remove_matcher("digipeater")

address: Address property

Gets the repeater address of the station.

enabled: bool property

Whether the Digipeater is enabled.

settings: DigipeaterSettings property

Returns the current digipeater settings.

__init__(station: Station, settings: DigipeaterSettings | None) -> None

Initializes the digipeater.

Source code in pax25/services/digipeater.py
def __init__(
    self,
    station: "Station",
    settings: DigipeaterSettings | None,
) -> None:
    """Initializes the digipeater."""
    self.station = station
    self._settings = settings or DigipeaterSettings(enabled=True)
    matcher = needs_repeat_from(self.address)
    self.station.frame_router.register_matcher(
        "digipeater", MatchCall(matcher=matcher, notify=self.repeat)
    )

reload_settings(settings: DigipeaterSettings) -> None async

Reloads the service with new settings.

Source code in pax25/services/digipeater.py
async def reload_settings(self, settings: DigipeaterSettings) -> None:
    """
    Reloads the service with new settings.
    """
    # We don't have to restart anything, since this is used on-demand.
    self._settings = settings

repeat(frame: Frame, interface: Interface) -> None

Performs digipeating for a matched frame.

Source code in pax25/services/digipeater.py
def repeat(self, frame: Frame, interface: Interface) -> None:
    """
    Performs digipeating for a matched frame.
    """
    if not self.enabled:
        return
    self.station.frame_router.send_frame(
        interface, repeated_for(self.address, frame)
    )

unregister() -> None

Remove the digipeater from the matchers, effectively disabling it.

Source code in pax25/services/digipeater.py
def unregister(self) -> None:
    """
    Remove the digipeater from the matchers, effectively disabling it.
    """
    self.station.frame_router.remove_matcher("digipeater")