Skip to content

[feat/multicast]: Add multi-instance multicast module with active trigger system#154

Open
KoenigMjr wants to merge 5 commits intoBOSWatch:developfrom
KoenigMjr:feat/multicast
Open

[feat/multicast]: Add multi-instance multicast module with active trigger system#154
KoenigMjr wants to merge 5 commits intoBOSWatch:developfrom
KoenigMjr:feat/multicast

Conversation

@KoenigMjr
Copy link
Copy Markdown
Contributor

🇩🇪 DE

Ich habe die Idee von thierry3000 aufgeschnappt und in den letzten Monaten ein Multicast-Modul geschrieben.
Sollte somit das Issue #87 und auch den PR #88 schließen.

Kurz und bündig
Dieses PR implementiert ein vollständiges Multicast-Modul für BOSWatch 3, das es ermöglicht, Alarmnachrichten automatisch an mehrere Empfänger (RICs) zu verteilen. Das Modul integriert sich nahtlos in das bestehende System und erweitert die Kernmodule um die Fähigkeit, Paketlisten zu verarbeiten.

Detaillierte Änderungen

1. Kernmodul module/multicast.py

  • Vollständige Multicast-Alarmverarbeitung mit automatischer Verteilung
  • Active Trigger System: Garantiert verlustfreie Paketauslieferung via Loopback-Socket
  • Multi-Instanz-Betrieb: Mehrere Modulinstanzen mit gemeinsamer Thread-Safe-State
  • Frequenz-Trennung: Verhindert Vermischung von Alarmen verschiedener Sender
  • Automatische Filterung: Delimiter- und Netzident-RICs werden intelligent herausgefiltert
  • Konfigurierbare Parameter:
    • autoClearTimeout: Auto-Clear nach X Sekunden (Default: 10s)
    • delimiterRics: Startmarker für neue Multicast-Blöcke
    • textRics: RICs mit eigentlicher Alarmnachricht
    • netIdentRics: Netzwerk-ID-RICs (Filterung)
    • triggerRic/Host/Port: Wakeup-Trigger-Konfiguration -> (Standardmäßig wird das RIC vom hängengebliebenen Alarm verwendet)

2. Ergänzungen am bestehenden Programmcode

module/moduleBase.py

  • List-Support für Module: Neue Logik zur Verarbeitung von Paketlisten
  • Rekursive Verarbeitung einzelner Pakete mit intelligenter Resultat-Kombination
  • Unterstützt: False (gefiltert), None (unverändert), Liste, einzelnes Paket
  • Ermöglicht Multicast-Verteilung durch Module ohne Bruch der bestehenden Architektur

plugin/pluginBase.py

  • ist-Support für Plugins: Vollständige Lifecycle-Unterstützung für Paketlisten
  • Jedes Paket durchläuft vollständig: Setup → Alarm → Teardown
  • Garantiert konsistente Plugin-Verarbeitung für Multi-Pakete-Szenarien

3. Dokumentation

  • Ausführliche Deutsche Dokumentation mit Beispielen
  • Funktionsweise in 3 Phasen erklärt (Delimiter, Tone-RICs, Text-RIC)
  • 4 praktische Konfigurationsbeispiele
  • Detaillierte Erklärung aller neuen Paketfelder (multicastMode, multicastRole, etc.)
  • 7 neue Wildcards für Plugin-Verarbeitung
  • Technische Details: Trigger-System, Frequenz-Trennung, SubRIC-Erhaltung
  • Konfigurationsfelder in Config-Editor integriert & UI-Unterstützung für alle Parameter mit Defaults

Wichtige Punkte

  • Abwärtskompatibel: Existierende Module/Plugins funktionieren ohne Änderungen
  • Thread-Safe: Alle Operationen mit Locks geschützt

🇬🇧 EN

I picked up the idea from thierry3000 and developed a multicast module over the past few months.
This should resolve Issue #87 as well as PR #88.

In a nutshell
This PR implements a complete multicast module for BOSWatch 3, enabling alarm messages to be automatically distributed to multiple recipients (RICs). The module integrates seamlessly into the existing system and extends the core modules with the ability to process packet lists.

Detailed Changes

1. Core Module module/multicast.py

  • Full multicast alarm processing with automatic distribution

  • Active Trigger System: Ensures lossless packet delivery via loopback socket

  • Multi-instance operation: Multiple module instances with shared thread-safe state

  • Frequency separation: Prevents mixing of alarms from different transmitters

  • Automatic filtering: Delimiter and network identifier RICs are intelligently filtered out

  • Configurable parameters:

    • autoClearTimeout: Auto-clear after X seconds (default: 10s)
    • delimiterRics: Start markers for new multicast blocks
    • textRics: RICs containing the actual alarm message
    • netIdentRics: Network ID RICs (filtered)
    • triggerRic/Host/Port: Wakeup trigger configuration → (by default, the RIC of the stuck alarm is used)

2. Enhancements to Existing Codebase

module/moduleBase.py

  • List support for modules: New logic for processing packet lists
  • Recursive processing of individual packets with intelligent result combination
  • Supports: False (filtered), None (unchanged), list, single packet
  • Enables multicast distribution through modules without breaking existing architecture

plugin/pluginBase.py

  • List support for plugins: Full lifecycle support for packet lists
  • Each packet goes through the full cycle: Setup → Alarm → Teardown
  • Ensures consistent plugin processing for multi-packet scenarios

3. Documentation

  • Comprehensive English documentation with examples
  • Functionality explained in 3 phases (Delimiter, Tone RICs, Text RIC)
  • 4 practical configuration examples
  • Detailed explanation of all new packet fields (multicastMode, multicastRole, etc.)
  • 7 new wildcards for plugin processing
  • Technical details: Trigger system, frequency separation, SubRIC preservation
  • Configuration fields integrated into the config editor & UI support for all parameters with defaults

Key Points

  • Backward compatible: Existing modules/plugins work without changes
  • Thread-safe: All operations are protected with locks

…gger system

Introduce a robust multicast processing module for POCSAG that correlates
empty tone-RICs (recipients) with subsequent text-RICs (content).

Key Features:
- Four Output Modes: Internally supports 'complete', 'incomplete', 'single',
  and 'control'. Functional alarms are delivered as the first three, while
  technical 'control' packets (Delimiters/NetIdent) are filtered by default.
- Active Trigger System: Implements a loss-free deferred delivery mechanism
  using a loopback socket (TCP) to re-inject wakeup packets, flushing the
  internal queue during auto-clear timeouts.
- Shared State & Multi-Instance: State is shared across instances but
  separated by frequency to prevent crosstalk in multi-frequency setups.
- Data Aggregation: Automatically generates '{FIELD}_list' wildcards (e.g.,
  RIC_LIST, DESCRIPTION_LIST) for all collected recipients, enabling
  consolidated notifications in downstream plugins.
- Dynamic Filtering: Automatically blocks Delimiter and NetIdent RICs from
  reaching subsequent plugins if they are defined in the configuration.

Infrastructural Changes:
- ModuleBase: Expanded return semantics to support:
  * False: Explicitly blocks/drops a packet.
  * List: Allows a module to expand one input into multiple output packets.
- PluginBase: Updated to handle lists of packets, ensuring a full
  setup->alarm->teardown lifecycle for every individual element.
- Remove redundant list-handling block in doWork() - already handled by moduleBase._run()
- Fix bare except to except (ValueError, TypeError) in _copy_packet_dict_to_packet()
- Replace f-string logging with lazy %-style in _enrich_normal_alarm() and _set_mcast_metadata()
- Remove unused _trigger_ric_mode variable
- Simplify instance name from dynamic MCAST_{id} to static "Multicast" (no debug value)
- Update doWork() docstring to reflect single-packet-only parameter
- Add extension hook comment to _perform_instance_tick()
@KoenigMjr KoenigMjr marked this pull request as draft March 28, 2026 14:23
…tream

Remove internal filtering of delimiter and netident packets from the
multicast module. All packets are now passed through with multicastRole
metadata set, allowing downstream filters (e.g. filter.regexFilter) to
handle filtering as needed.

Tone-RICs remain internally consumed as they carry no alarm-relevant
information outside the module.

Update documentation to reflect new behavior and add regexFilter
example for filtering by multicastRole.
@KoenigMjr
Copy link
Copy Markdown
Contributor Author

KoenigMjr commented Mar 28, 2026

🇩🇪 DE
Ich habe mich noch entschieden, (fast) alle Filterungen aus dem Modul herauszunehmen und das Modul nur den Job machen zu lassen, welcher im Name steht (Schuster bleib bei deinen Leisten). Einzig die Text-RIC wird verarbeitet und nicht weitergegeben, wenn korrekterweise ein Multicast-Alarm daraus entstanden ist.
Alle anderen werden nun nur gekennzeichnet und weitergeleitet.


🇬🇧 EN
I decided to remove (almost) all filtering from the module and let it only do the job its name implies (Cobbler, stick to your last). The only exception is the text-RIC: it is consumed and not forwarded when a multicast alarm has been successfully generated from it.
All other packets are now only tagged and passed through.

@KoenigMjr KoenigMjr marked this pull request as ready for review April 5, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant