Skip to content

Instantly share code, notes, and snippets.

@int2001
Created November 22, 2025 07:25
Show Gist options
  • Select an option

  • Save int2001/699c3c66c2382f8fd6d280a3c87f8f32 to your computer and use it in GitHub Desktop.

Select an option

Save int2001/699c3c66c2382f8fd6d280a3c87f8f32 to your computer and use it in GitHub Desktop.

WaveLogGate Architecture Documentation

This document describes the technical architecture of WaveLogGate and how it interfaces with various amateur radio software and hardware components.

Overview

WaveLogGate acts as a central hub that connects amateur radio logging software, radio control applications, and WaveLog. It facilitates bidirectional communication for QSO logging, radio status monitoring, and frequency/mode control.

System Architecture

┌──────────────────────────────────────────────────────────────────────────────┐
│                           WAVELOGGATE CENTRAL HUB                            │
│                                                                              │
│  ┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐           │
│  │   Main Process  │    │  UDP Server     │    │  HTTP Server    │           │
│  │   (Electron)    │    │   Port 2333     │    │   Port 54321    │           │
│  │                 │    │                 │    │                 │           │
│  │ • ADIF Parser   │    │ • Log Messages  │    │ • QSY Requests  │           │
│  │ • Config Mgmt   │    │ • XML/ADIF      │    │ • CORS Support  │           │
│  │ • IPC Handlers  │    │ • Common Format │    │ • REST API      │           │
│  └─────────────────┘    └─────────────────┘    └─────────────────┘           │
│                                                                              │
│  ┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐           │
│  │   CAT Control   │    │ WebSocket Srv   │    │   WaveLog API   │           │
│  │                 │    │   Port 54322    │    │   Integration   │           │
│  │                 │    │                 │    │                 │           │
│  │ • FLRig Client  │    │ • Radio Status  │    │ • QSO Upload    │           │
│  │ • Hamlib Client │    │ • Real-time     │    │ • Status Update │           │
│  │ • XML-RPC/TCP   │    │ • JSON Format   │    │ • Auth Headers  │           │
│  └─────────────────┘    └─────────────────┘    └─────────────────┘           │
└──────────────────────────────────────────────────────────────────────────────┘

Data Flow Diagrams

1. FLRig → WaveLogGate → WaveLog (Radio Status Monitoring)

┌─────────────┐      ┌─────────────────────────────────────┐      ┌─────────────┐
│    FLRig    │      │         WaveLogGate                 │      │   WaveLog   │
│             │      │                                     │      │             │
│ XML-RPC     │      │  ┌─────────────────────────────┐    │      │             │
│ Server      ├─────►│  │      Main Process           │    │      │             │
│ Port 12345  │      │  │                             │    │      │             │
│             │      │  │ ┌─────────────────────────┐ │    │      │ ┌─────────┐ │
│ ┌─────────┐ │      │  │ │   CAT Control Module    │ │    │      │ │ /api/   │ │
│ │ Radio   │ │      │  │ │                         │ │    │      │ │ radio   │ │
│ │ Status  │◄├─────►│  │ │ • FLRig XML-RPC Client  │◄├──────────►│ │ Update  │ │
│ │ (VFO,   │ │      │  │ │ • Frequency Polling     │ │    │      │ │ POST    │ │
│ │ Mode,   │ │      │  │ │ • Mode Detection        │ │    │      │ │         │ │
│ │ Power)  │ │      │  │ └─────────────────────────┘ │    │      │ └─────────┘ │
│ └─────────┘ │      │  │                             │    │      │             │
│             │      │  │ • Polling every 1000ms      │    │      │             │
│             │      │  │ • Change detection          │    │      │             │
│             │      │  │ • Status normalization      │    │      │             │
│             │      │  └─────────────────────────────┘    │      │             │
└─────────────┘      │                                     │      └─────────────┘
                     │         HTTP POST                   │
                     ├────────────────────────────────────►│
                     │   JSON: {freq, mode, power, name}   │
                     └─────────────────────────────────────┘

Real-time WebSocket Broadcasting:
                     ┌─────────────────────────────────────┐
                     │                                     │
                     │ ┌─────────────────────────────────┐ │
                     │ │      WebSocket Server           │ │
                     │ │                                 │ │
                     │ │ • JSON Broadcast to clients     │ │
                     │ │ • Port 54322                    │ │
                     │ │ • Connected client management   │ │
                     │ └─────────────────────────────────┘ │
                     │                                     │
                     └─────────────────────────────────────┘
                              ▲
                              │ Radio Status JSON
                              │ {type, freq, mode, power, timestamp}
                              │
                    ┌─────────────────┐
                    │  External Apps  │
                    │ (Displays,      │
                    │  Monitors, etc) │
                    └─────────────────┘

2. Hamlib → WaveLogGate → WaveLog (Radio Status Monitoring)

┌─────────────┐      ┌─────────────────────────────────────┐      ┌─────────────┐
│   Hamlib    │      │         WaveLogGate                 │      │   WaveLog   │
│             │      │                                     │      │             │
│ rigctld     │      │  ┌─────────────────────────────┐    │      │             │
│ Daemon      ├─────►│  │      Main Process           │    │      │             │
│ Port 4532   │      │  │                             │    │      │             │
│             │      │  │ ┌─────────────────────────┐ │    │      │ ┌─────────┐ │
│ ┌─────────┐ │      │  │ │   CAT Control Module    │ │    │      │ │ /api/   │ │
│ │ Radio   │ │      │  │ │                         │ │    │      │ │ radio   │ │
│ │ Status  │◄├─────►│  │ │ • Hamlib TCP Client     │◄├───►│      │ Update    │ │
│ │ (VFO,   │ │      │  │ │ • rigctld Commands      │ │    │      │ │ POST    │ │
│ │ Mode,   │ │      │  │ │ • Response Parsing      │ │    │      │ │         │ │
│ │ Power)  │ │      │  │ └─────────────────────────┘ │    │      │ └─────────┘ │
│ └─────────┘ │      │  │                             │    │      │             │
│             │      │  │ • Commands: f, m, 0         │    │      │             │
│             │      │  │ • TCP Socket Communication  │    │      │             │
│             │      │  │ • Error Handling            │    │      │             │
│             │      │  └─────────────────────────────┘    │      │             │
└─────────────┘      │                                     │      └─────────────┘
                     │         HTTP POST                   │
                     ├────────────────────────────────────►│
                     │   JSON: {freq, mode, power, name}   │
                     └─────────────────────────────────────┘

Hamlib Command Flow:
rigctld commands:
  f → Get frequency
  m → Get mode
  0 → Get PTT/Power/Split status

Responses parsed and filtered:
  - Remove RPRT error responses
  - Extract first line before newline
  - Normalize frequency/mode data

3. Logger → WaveLogGate → WaveLog (QSO Logging)

┌─────────────┐      ┌─────────────────────────────────────┐      ┌─────────────┐
│   Logger    │      │         WaveLogGate                 │      │   WaveLog   │
│ (FLDigi,    │      │                                     │      │             │
│ CQRLOG,     │      │  ┌─────────────────────────────┐    │      │             │
│ N1MM+, etc) │      │  │      Main Process           │    │      │             │
│             │      │  │                             │    │      │             │
│ UDP Client  ├─────►│  │ ┌─────────────────────────┐ │    │      │ ┌─────────┐ │
│ Port 2333   │      │  │ │    UDP Server Module    │ │    │      │ │ /api/   │ │
│             │      │  │ │                         │ │    │      │ │ qso     │ │
│ ┌─────────┐ │      │  │ │ • UDP Listener          │◄├──────────►│ │ Upload  │ │
│ │ QSO     │ │      │  │ │ • ADIF Parser           │ │    │      │ │ POST    │ │
│ │ Data    │◄├─────►│  │ │ • XML Parser            │ │    │      │ │         │ │
│ │ (ADIF/  │ │      │  │ │ • Format Detection      │ │    │      │ └─────────┘ │
│ │ XML)    │ │      │  │ └─────────────────────────┘ │    │      │             │
│ └─────────┘ │      │  │                             │    │      │             │
│             │      │  │ • Port 2333                 │    │      │             │
│             │      │  │ • ADIF Normalization        │    │      │             │
│             │      │  │ • Band Detection            │    │      │             │
│             │      │  │ • Power Conversion (kW↔W)   │    │      │             │
│             │      │  └─────────────────────────────┘    │      │             │
└─────────────┘      │                                     │      └─────────────┘
                     │         HTTP POST                   │
                     ├────────────────────────────────────►│
                     │   JSON: {adif_string}               │
                     └─────────────────────────────────────┘

Supported Message Formats:
┌─────────────────────────────────────────────────────────────┐
│ ADIF Format:                                                │
│ <CALL:6>KM4FT<MODE:3>FT8<GRIDSQUARE:6>EM74ts<FREQ:7>14.074  │
│                                                             │
│ XML Format (N1MM+ compatible):                              │
│ <contactinfo>                                               │
│   <call>KM4FT</call>                                        │
│   <mode>FT8</mode>                                          │
│   <gridsquare>EM74ts</gridsquare>                           │
│   <txfreq>14074000</txfreq>                                 │
│   <rxfreq>14074000</rxfreq>                                 │
│   <timestamp>2024-01-15 12:30:45</timestamp>                │
│   <operator>MYCALL</operator>                               │
│   <mycall>MYCALL</mycall>                                   │
│   <snt>59</snt>                                             │
│   <rcv>59</rcv>                                             │
│   <power>100</power>                                        │
│ </contactinfo>                                              │
└─────────────────────────────────────────────────────────────┘

4. WaveLog → WaveLogGate → FLRig/Hamlib (QSY - Frequency/Mode Change)

┌─────────────┐      ┌─────────────────────────────────────┐      ┌─────────────┐
│   WaveLog   │      │         WaveLogGate                 │      │   FLRig/    │
│             │      │                                     │      │   Hamlib    │
│ Web UI/API  ├─────►│  ┌─────────────────────────────┐    │      │             │
│ User clicks │      │  │    HTTP Server Module       │    │      │             │
│ QSY button  │      │  │                             │    │      │ ┌─────────┐ │
│             │      │  │ ┌─────────────────────────┐ │    │      │ │  Radio  │ │
│ ┌─────────┐ │      │  │ │   URL Router            │ │    │      │ │ Control │ │
│ │ New     │ │      │  │ │                         │ │    │      │ │ Module  │ │
│ │ Freq/   │◄├─────►│  │ │ • GET /{freq}/{mode}    │◄├──────────►│ │         │ │
│ │ Mode    │ │      │  │ │ • Path parsing          │ │    │      │ │ • XML-  │ │
│ │ Request │ │      │  │ │ • CORS headers          │ │    │      │ │ RPC     │ │
│ └─────────┘ │      │  │ └─────────────────────────┘ │    │      │ │ • TCP   │ │
│             │      │  │                             │    │      │ │ • Set   │ │
│             │      │  │ • Port 54321                │    │      │ │ Commands│ │
│             │      │  │ • REST endpoint             │    │      │ └─────────┘ │
│             │      │  └─────────────────────────────┘    │      │             │
│             │      │                                     │      │             │
│             │      │  ┌─────────────────────────────┐    │      │ ┌─────────┐ │
│             │      │  │     CAT Control Module      │    │      │ │  FLRig  │ │
│             │      │  │                             │    │      │ │ rig.set_│ │
│             │      │  │ ┌─────────────────────────┐ │    │      │ │frequency│ │
│             │      │  │ │  Command Execution      │ │    │      │ │ rig.set_│ │
│             │      │  │ │                         │ │    │      │ │ modeA   │ │
│             │      │  │ │ • settrx() function     │ │    │      │ └─────────┘ │
│             │      │  │ │ • Radio type detection  │ │    │      │             │
│             │      │  │ │ • Error handling        │ │    │      │ ┌─────────┐ │
│             │      │  │ │ • Success response      │ │    │      │ │ Hamlib  │ │
│             │      │  │ └─────────────────────────┘ │    │      │ │ rigctld │ │
│             │      │  │                             │    │      │ │ F cmd   │ │
│             │      │  │ FLRig: XML-RPC calls        │    │      │ │ M cmd   │ │
│             │      │  │   rig.set_frequency()       │    │      │ └─────────┘ │
│             │      │  │   rig.set_modeA()           │    │      │             │
│             │      │  │                             │    │      │             │
│             │      │  │ Hamlib: TCP commands        │    │      │             │
│             │      │  │   F {frequency}             │    │      │             │
│             │      │  │   M {mode}                  │    │      │             │
│             │      │  └─────────────────────────────┘    │      │             │
└─────────────┘      │                                     │      └─────────────┘

QSY Request Flow:
HTTP GET Request: http://localhost:54321/14.230/USB
      │
      ▼
WaveLogGate HTTP Server
      │
      ▼
Path Parsing: frequency=14.230, mode=USB
      │
      ▼
CAT Control Module
      │
      ▼
Radio Type Detection (FLRig or Hamlib)
      │
      ├─ FLRig: XML-RPC call to rig.set_frequency(14230000)
      │             rig.set_modeA("USB")
      │
      └─ Hamlib: TCP command "F 14230000"
                TCP command "M USB"
      │
      ▼
Success Response to WaveLog

Data Processing Pipeline

ADIF/XML Processing Flow

┌────────────────────────────────────────────────────────────────┐
│                    ADIF/XML PROCESSING PIPELINE                │
│                                                                │
│  UDP Packet Received                                           │
│       │                                                        │
│       ▼                                                        │
│  ┌─────────────────┐                                           │
│  │ Format Detection│                                           │
│  │                 │                                           │
│  │ • XML vs ADIF   │                                           │
│  │ • Header check  │                                           │
│  └─────────────────┘                                           │
│       │                                                        │
│       ▼                                                        │
│  ┌─────────────────┐     ┌─────────────────┐                   │
│  │   XML Parser    │────►│  ADIF Normalizer│                   │
│  │                 │     │                 │                   │
│  │ • XML2JS        │     │ • TCADIF lib    │                   │
│  │ • Common format │     │ • Power conv.   │                   │
│  │ • Field mapping │     │ • Band detect   │                   │
│  └─────────────────┘     └─────────────────┘                   │
│       │                        │                               │
│       └────────────────────────┼───────────────────────────┘   │
│                                ▼                               │
│  ┌─────────────────────────────────────────────────────────┐   │
│  │                WAVELOG API POST                         │   │
│  │                                                         │   │
│  │ POST /api/qso                                           │   │
│  │ Headers: {Authorization: "Bearer <key>"}                │   │
│  │ Body: {adif_string: "<CALL:6>..."}                      │   │
│  └─────────────────────────────────────────────────────────┘   │
│                                                                │
│  ┌─────────────────────────────────────────────────────────┐   │
│  │                    RESPONSE HANDLING                    │   │
│  │                                                         │   │
│  │ • Success: Update UI with QSO count                     │   │
│  │ • Error: Display error message                          │   │
│  │ • Retry: Exponential backoff for network errors         │   │
│  └─────────────────────────────────────────────────────────┘   │
└────────────────────────────────────────────────────────────────┘

Communication Protocols

Protocol Summary

┌────────────────────────────────────────────────────────────────┐
│                      COMMUNICATION MATRIX                      │
│                                                                │
│  ┌─────────────┬─────────────┬─────────────┬─────────────────┐ │
│  │   SOURCE    │  DESTINATION│  PROTOCOL   │     DATA        │ │
│  ├─────────────┼─────────────┼─────────────┼─────────────────┤ │
│  │ FLRig       │ WaveLogGate │ XML-RPC     │ Radio status    │ │
│  │ Hamlib      │ WaveLogGate │ TCP         │ Radio status    │ │
│  │ Logger      │ WaveLogGate │ UDP 2333    │ QSO data        │ │
│  │ WaveLog     │ WaveLogGate │ HTTP 54321  │ QSY commands    │ │
│  │ WaveLogGate │ WaveLog     │ HTTP        │ QSO upload      │ │
│  │ WaveLogGate │ WaveLog     │ HTTP        │ Radio status    │ │
│  │ WaveLogGate │ FLRig/Hamlib│ XML-RPC/TCP │ Set freq/mode   │ │
│  │ WaveLogGate │ External    │ WebSocket   │ Radio broadcast │ │
│  │             │ clients     │ 54322       │                 │ │
│  └─────────────┴─────────────┴─────────────┴─────────────────┘ │
└────────────────────────────────────────────────────────────────┘

Message Formats

┌─────────────────────────────────────────────────────────────────┐
│                      MESSAGE FORMATS                            │
│                                                                 │
│  HTTP QSY Request:                                              │
│  GET http://localhost:54321/14.230/USB                          │
│                                                                 │
│  Radio Status JSON (WebSocket Broadcast):                       │
│  {                                                              │
│    "type": "status",                                            │
│    "frequency": 14230000,                                       │
│    "mode": "USB",                                               │
│    "power": 100,                                                │
│    "radio_name": "IC-7300",                                     │
│    "timestamp": "2024-01-15T12:30:45Z"                          │
│  }                                                              │
│                                                                 │
│  WaveLog API Radio Update:                                      │
│  POST /api/radio                                                │
│  {                                                              │
│    "frequency": "14.230",                                       │
│    "mode": "USB",                                               │
│    "power": "100",                                              │
│    "radio_name": "IC-7300"                                      │
│  }                                                              │
│                                                                 │
│  WaveLog API QSO Upload:                                        │
│  POST /api/qso                                                  │
│  {                                                              │
│    "adif_string": "<CALL:6>KM4FT<MODE:3>FT8..."                 │
│  }                                                              │
└─────────────────────────────────────────────────────────────────┘

This architecture documentation provides a comprehensive overview of how WaveLogGate interfaces with various amateur radio components and facilitates seamless integration between logging software, radio control applications, and the WaveLog platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment