Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9f8380ece | ||
|
|
10e1504531 | ||
|
|
2e3464104d | ||
|
|
dc8f9c5099 | ||
|
|
08905a1680 | ||
|
|
fd939797dd | ||
|
|
a621a3ee62 | ||
|
|
ae4a56dac1 | ||
|
|
fdc2378191 | ||
|
|
5388f76733 | ||
|
|
ceb88d2e29 | ||
|
|
ec3e60e47b | ||
|
|
5c6df90526 | ||
|
|
deeb654482 | ||
|
|
8e0865a71f | ||
|
|
d4d22eb4b2 | ||
|
|
592dd08835 | ||
|
|
c6294d9eb3 | ||
|
|
848ce68ec5 | ||
|
|
95e57fb812 | ||
|
|
4441b16699 | ||
|
|
f50bbc005c | ||
|
|
6a6b7ad6c2 | ||
|
|
01a23ccb77 | ||
|
|
9b8168370f | ||
|
|
efa711af78 |
@@ -1,322 +1,77 @@
|
||||
# OpsLog
|
||||
# Transceiver Control Interface
|
||||
|
||||
<a href="https://discord.gg/FYM8yw5pT" target="_blank">
|
||||
<img src="https://img.shields.io/badge/Discord-Join%20the%20server-5865F2?logo=discord&logoColor=white" alt="Join our Discord" />
|
||||
</a>
|
||||
## Introduction
|
||||
|
||||
A modern, fast ham-radio logger for Windows — single-strip entry, real-time CAT
|
||||
for **OmniRig**, native **FlexRadio/SmartSDR**, native **Icom CI-V** (USB **and**
|
||||
remote-over-internet, replacing RS-BA1) and **TCI** (SunSDR / Expert Electronics),
|
||||
DX cluster with spot alerts, awards tracking, maps, contest logging, QSL
|
||||
management and a QSL-card designer. Built with **Wails v2** (Go backend +
|
||||
React/TypeScript frontend), **pure Go** (no CGO): SQLite for configuration,
|
||||
optional **shared MySQL** for the logbook so several operators can run one log.
|
||||
Fully themeable and bilingual (English / French).
|
||||
TCI (Transceiver Control Interface) is a network interface for control, data transfer and
|
||||
synchronization between transceiver/receiver, contest loggers, digital mode software, skimmers
|
||||
and other software, as well as external power amplifiers, bandpass filter units, antenna switches,
|
||||
radio controllers and other devices.
|
||||
|
||||
Developed by **F4BPO**.
|
||||
TCI was created as a modern alternative to the outdated COM port and audio cable
|
||||
interfaces, it uses a full duplex web socket protocol that runs on top of a TCP connection and
|
||||
serves for server-client communications, providing cross-platform connectivity. Transceiver works
|
||||
as a server, all other software and devices as clients. The server and clients can be inside the
|
||||
same computer (program-server, hardware log, etc.-clients) and/or in separate physical devices
|
||||
connected through the local network (classical transceiver, power amplifier, antenna switch, FFT
|
||||
unit, etc.).
|
||||
|
||||
---
|
||||
The TCI interface contains basic transceiver control commands (analog of CAT system),
|
||||
receives CW macros from clients and broadcasts them, outputs transceiver IQ stream to clients,
|
||||
receives spots from skimmers and Internet clusters, receives/outputs audio signal to work in
|
||||
digital modes.
|
||||
|
||||
## Building / developing
|
||||
The TCI uses an extensible architecture and can be supplemented with new functions and
|
||||
commands, while keeping the old ones operational. Thus, the TCI interface can be extended and
|
||||
supplemented to meet the specific needs of any software manufacturer and/or device
|
||||
manufacturer (receivers, transceivers, power amplifiers, switches, etc.). The presence of a device
|
||||
identifier allows the manufacturers of transceivers and receivers to switch to the TCI interface
|
||||
while maintaining the device model designation. The extensibility of the TCI interface allows you
|
||||
to create an individual set of commands and functions for each device model, while maintaining
|
||||
the basic command set inherent to all transceivers.
|
||||
|
||||
- **Dev:** `wails dev` (Vite hot-reload; Go methods reachable at http://localhost:34115).
|
||||
- **Build:** `wails build` (use the project's wails v2.11 — `~/go/bin/wails.exe`).
|
||||
- **Regenerate Go↔TS bindings** after changing exported `App` methods:
|
||||
`wails generate module`.
|
||||
- **Release:** `.vscode/release.ps1` (Ctrl+Shift+P → *Tasks: Run Task* →
|
||||
*Release OpsLog*) — bumps the version, pushes source to Gitea, builds the exe
|
||||
and publishes it to Gitea + GitHub releases.
|
||||
Our company advocates universal unification of data exchange between devices and
|
||||
software by creating the TCI interface for this purpose. Modern transceivers and software must
|
||||
communicate using one protocol - the TCI protocol.
|
||||
|
||||
---
|
||||
## Interface description
|
||||
|
||||
## Logging
|
||||
Any command represents an ASCII string that contains a command name and a list of
|
||||
arguments corresponding to this command. There are reserved characters that cannot be
|
||||
included in the command name and command arguments.
|
||||
|
||||
- **Single-strip entry:** callsign, RST tx/rx, name/QTH/grid, band/mode,
|
||||
TX/RX frequency (split), start/end time, comment/note. The contacted entity's
|
||||
**flag** is shown large next to the RST fields.
|
||||
- **Callsign lookup** (QRZ.com / HamQTH) with photo, auto-fill of name/QTH/grid
|
||||
and the QRZ.com tab.
|
||||
- **Offline DXCC** resolution from `cty.dat` (country, CQ/ITU zones, continent),
|
||||
with `/MM` `/AM` `/B` (beacon) and call-area (`/8`, `/W6`) handling, plus
|
||||
ClubLog DXpedition date overrides.
|
||||
- **Recent QSOs**, **Worked-before** matrix (per band/mode slot), bulk re-resolve
|
||||
from cty/QRZ/ClubLog, bulk send to QSL services. A live **selection count**, a
|
||||
**Select all / Unselect all** toggle, and a row limit that keeps the full log
|
||||
fast **but is lifted while a filter is active** (every match is shown, not just
|
||||
the first page).
|
||||
- **Advanced QSO filter builder** (field / operator / value, AND / OR, saved
|
||||
presets) with filtered- and selected-row **ADIF export**.
|
||||
- **Find duplicates** (Tools) — groups QSOs by same call + band + mode (optionally
|
||||
same day / minute) and lets you pick which to delete.
|
||||
- **ADIF 3.1.7 compliant** import/export: a full field dictionary, 30 promoted
|
||||
columns, a generic "extra fields" editor and standard/all export modes.
|
||||
- **Profiles:** every setting is per-profile; each profile can point its logbook
|
||||
at the local SQLite file or a **shared MySQL** database (multi-operator).
|
||||
List of reserved characters: «:», «,», «;».
|
||||
|
||||
## Maps & antenna
|
||||
Command structure:
|
||||
1. Name of the command;
|
||||
2. Separating character between command name and arguments «:»;
|
||||
3. Separating character between arguments «,»;
|
||||
4. End of the command character «;».
|
||||
|
||||
- **Main view = two configurable panes** (per profile, Settings → General →
|
||||
*Main view*): great-circle map, locator (street) map, the cluster grid, the
|
||||
worked-before grid, recent QSOs, the **FlexRadio controls**, the **Icom
|
||||
console** or the **Net control** panel.
|
||||
- **Great-circle map** with short/long-path distance & azimuth, selectable
|
||||
basemaps (Light / Voyager / Street / Satellite, all key-free and labelled) and
|
||||
the **antenna beam lobe(s)** drawn from the rotor azimuth.
|
||||
- **Rotor compass** (azimuthal-equidistant, click-to-turn) driven by
|
||||
**PstRotator** (UDP), a **4O3A Rotator Genius** (native TCP) or a **microHAM
|
||||
ARCO** controlled natively — no PstRotator needed — over the **LAN** or **USB**
|
||||
using its Yaesu GS-232A protocol.
|
||||
- **Ultrabeam** support (Normal / 180° reverse / Bidirectional): the radiating
|
||||
direction is shown in green and the **mechanical boom** in grey, on both the
|
||||
compass and the map, so you never lose track of where the antenna points.
|
||||
If a command has no arguments, an end of command symbol is placed after the command
|
||||
name. If the command is invalid, it is ignored. The case of letters does not matter.
|
||||
|
||||
## DX Cluster
|
||||
The ExpertSDR3 program acts as a server, which can have several client connections at
|
||||
the same time, they will be synchronized with each other by the server. When connecting to the
|
||||
ExpertSDR3, the client receives the current status of the ExpertSDR3, first sending initialization
|
||||
commands, then parameters to set the status, such as frequency, modulation, etc.
|
||||
|
||||
- Multiple cluster servers with auto-reconnect, a master for commands.
|
||||
- **Filter sidebar** (callsign search, hide-worked, group duplicates, band /
|
||||
mode / status / source) shared by the Cluster tab and the Main-view cluster
|
||||
pane, with a show/hide toggle.
|
||||
- Per-spot **status** (new / new-band / new-slot / worked), click-to-tune the
|
||||
rig, and a multi-band **Band Map** (panadapter-style strips). Optionally, all
|
||||
**digital modes count as one** (DXCC-style) for the new/new-slot colouring and
|
||||
the worked-before matrix badges (Settings → General).
|
||||
- **POTA** spots are tagged with their park reference (via `api.pota.app`).
|
||||
- **Spot alerts:** rules on call / country / band / mode /
|
||||
spotter, with sound, visual and e-mail notification (Tools → *Alert
|
||||
management*).
|
||||
When a parameter change occurs in the ExpertSDR3 (server) program, the server notifies
|
||||
all connected clients, i.e., clients do not need to poll the server constantly, any change of state
|
||||
will be sent in time to all clients. If the client sends a new state, the server will set it to itself, as
|
||||
well as send it to all clients, that is, the server acts as a synchronizer. All clients connected to the
|
||||
server will be automatically synchronized. This way of work allows to minimize network load,
|
||||
reducing traffic.
|
||||
|
||||
## CAT control
|
||||
The TCI protocol implements the transmission of receiver IQ stream to clients, which is
|
||||
necessary for the work of special skimmer software, they automatically find the station and
|
||||
decode it throughout the band, and it also allows you to record radio signals in the file.
|
||||
|
||||
Four native backends (Settings → CAT), each with auto-reconnect and a fast,
|
||||
non-blocking connect so a powered-off radio never freezes the app:
|
||||
TCI is also used to transmit audio signals of the receiver to clients and to receive audio
|
||||
signals from clients, i.e., the client can transmit audio signals to ExpertSDR3 for radio
|
||||
transmission. The audio stream exchange is designed to work with digital modes, where encoding
|
||||
and decoding is performed by third-party software, as well as in voice modes, where audio macros
|
||||
can be broadcasted, which is very much in demand in contest loggers.
|
||||
|
||||
- **OmniRig** (Rig 1/2, hot-swap) — works with any OmniRig-supported rig.
|
||||
- **FlexRadio (SmartSDR)** over the radio's TCP API — real-time slice freq /
|
||||
mode / split, UDP discovery, and **panadapter spots** (cluster spots pushed to
|
||||
the Flex display; a click fills the call and **tunes the rig to the right
|
||||
frequency AND mode**).
|
||||
- **Icom CI-V** — native, over the radio's **USB** port *or* over the internet
|
||||
via the radio's **built-in LAN server** (see *Remote Icom* below). No RS-BA1 or
|
||||
Remote Utility needed.
|
||||
- **TCI** (WebSocket) — SunSDR / ExpertSDR2 and any TCI-compatible server:
|
||||
freq / mode / PTT / split, plus optional panorama spots.
|
||||
|
||||
Mode is taken from the radio; the digital sub-mode (FT4 vs FT8) is inferred from
|
||||
the frequency. **Per-band Flex RX/TX antennas** can be configured and are applied
|
||||
automatically on band change.
|
||||
|
||||
### FlexRadio control tab (SmartSDR-style)
|
||||
|
||||
Shown only when the CAT backend is a FlexRadio:
|
||||
|
||||
- **Transmit:** RF power, tune power, TUNE, MOX, speech processor (NOR/DX/DX+),
|
||||
VOX (+ level + delay), monitor (+ level), mic gain.
|
||||
- **Receive (active slice):** RX/TX **antenna** selectors and a **DAX** toggle
|
||||
(TX audio through DAX, for WSJT-X & co), AGC mode/threshold, audio level,
|
||||
NB / WNB / NR / ANF, and — on **SmartSDR v4** radios (8000 / Aurora series) —
|
||||
the extra DSP tools **NRL, NRS, NRF** (with level) plus **RNN** (AI noise
|
||||
reduction) and **ANFT** (FFT auto-notch), shown automatically when the radio
|
||||
supports them. **RIT / XIT** with wheel / ± tuning.
|
||||
- **Antenna tuner (ATU):** tune / bypass / memories.
|
||||
- **Amplifier:** the amp card follows whichever amplifier is configured, with a
|
||||
dropdown to pick it when **several amplifiers** are set up (e.g. two SPEs run
|
||||
in parallel). See *Amplifiers & switches* below.
|
||||
- **Live meters** over the UDP VITA-49 stream: S-meter (S-units), forward power
|
||||
(W), SWR, ALC, PA temperature, voltage, plus the amplifier's meters.
|
||||
|
||||
### Icom control tab
|
||||
|
||||
Shown when the CAT backend is Icom (USB or network). A full RS-BA1-style console:
|
||||
|
||||
- **Twin VFO readout** (MAIN / SUB) with the big tabular frequency, mode badge,
|
||||
band and RIT/ΔTX offset, and a **mode-button row** (SSB / CW / RTTY / PSK /
|
||||
AM / FM).
|
||||
- **Spectrum scope + waterfall** (panadapter): ON/OFF, CTR/FIX, double-click to
|
||||
tune, and **◀ ⊙ ▶** buttons to centre the scope on the current frequency
|
||||
(±50 kHz) and pan left/right.
|
||||
- **Live meters** always visible: S-meter (click → fill RST), power in watts, SWR.
|
||||
- **Receive DSP:** AF / RF gain, squelch, AGC, preamp, attenuator, filter
|
||||
(FIL1/2/3), NB, NR, ANF and — **on CW only** — the **APF** (audio peak filter).
|
||||
- **Passband / notch:** Twin PBT (inner / outer), manual notch + position.
|
||||
- **Transmit:** RF power, MOX, TUNE, **split with an automatic offset**
|
||||
(+5 kHz on SSB, +1 kHz on CW), and monitor. On **voice modes only**: mic gain,
|
||||
speech compressor, VOX (+ gain + anti-VOX). Controls that don't apply to the
|
||||
current mode are hidden automatically.
|
||||
- **Bands & antenna:** one-touch band buttons and ANT1/ANT2 selection.
|
||||
- **Clarifiers:** RIT and ΔTX with wheel / ± tuning (Ctrl+←/→ nudges RIT).
|
||||
- **Power ON / OFF** buttons (manual by design — the app never wakes the rig on
|
||||
connect).
|
||||
- **CW keying** can run through the radio's own keyer (see *Keyers* below).
|
||||
|
||||
### Remote Icom (over the internet, no RS-BA1)
|
||||
|
||||
OpsLog speaks the IC-7610's built-in network protocol directly — it **replaces
|
||||
both the Icom Remote Utility and RS-BA1**. Enter the radio's IP, the Network
|
||||
User1 name/password and the CI-V address, and the whole Icom console works over
|
||||
the LAN/internet: login + token (auto-renewed), CI-V tunnel, receive-side
|
||||
retransmit for a rock-solid link even with the panadapter streaming, and manual
|
||||
power ON/OFF. (Audio is out of scope — use the radio in USB + a voice link such
|
||||
as Mumble.)
|
||||
|
||||
## Keyers & audio
|
||||
|
||||
- **CW keyer** with macros and F-key macros. The keyer engine is selectable:
|
||||
**WinKeyer** (K1EL WK1/2/3 over a COM port), **FlexRadio CWX** (the radio's
|
||||
built-in keyer over the SmartSDR API — type-ahead and backspace, no WinKeyer or
|
||||
SmartCAT needed), **Icom** (the radio's own keyer over CI-V — no extra hardware,
|
||||
works over the remote link too) or **TCI**.
|
||||
- **Digital Voice Keyer** (DVK): record F1–F6 voice messages and transmit them.
|
||||
- **QSO audio recording:** continuous rolling capture; on *Log QSO* the contact
|
||||
is saved to a per-QSO WAV (`CALL_YYYYMMDD_HHMMSS.wav`); mixes RX + mic.
|
||||
|
||||
## Amplifiers & switches
|
||||
|
||||
- **Amplifiers** — configure **one or several** amps (Settings → Amplifier is a
|
||||
list; e.g. two SPEs run in parallel for more power). Each amp's control card
|
||||
appears on the FlexRadio tab and in **Station Control**, with a dropdown to
|
||||
choose which one it shows; the bottom status bar carries **one clickable chip
|
||||
per amp** (green = OPERATE, orange = STANDBY, red = offline). Supported:
|
||||
- **PowerGenius XL** (4O3A) over direct TCP — operate/standby, fan-mode
|
||||
selector and fault display.
|
||||
- **SPE Expert** (1.3K-FA / 1.5K-FA / 2K-FA) over **USB** (virtual COM) or the
|
||||
**network** (RS232-to-Ethernet bridge) — operate/standby, ON/OFF,
|
||||
Low / Mid / High output level, an output-power bar and live status (band,
|
||||
SWR, PA current, temperature, warnings/alarms).
|
||||
- **ACOM** (500S / 600S / 700S / 1200S / 2020S) over **USB** or the **network**
|
||||
(RS232-to-Ethernet bridge) — operate/standby/off and live telemetry (forward
|
||||
& reflected power, SWR, PA temperature, band, fan, faults). Power-ON works
|
||||
over a serial cable that wires the DTR/RTS lines.
|
||||
- **Antenna Genius** (4O3A) antenna switch over TCP/GSCP — a docked A/B
|
||||
antenna-switch widget.
|
||||
- **Station Control** panel (dockable, drag-to-reorder widgets): the **rotator**,
|
||||
**Ultrabeam** element control and **relay boards** — WebSwitch 1216H, KMTronic,
|
||||
**Denkovi** USB (FT245 D2XX bit-bang, 4 or 8 relays) and generic USB-serial
|
||||
(CH340 / LCUS, A0 protocol) — for station power, antennas and accessories.
|
||||
- **Relay auto-control** (Settings): switch Station-Control relays automatically
|
||||
from the rig frequency / band (like PstRotator) — per relay, a frequency window
|
||||
or a set of bands.
|
||||
|
||||
## QSL & awards
|
||||
|
||||
- **Awards engine:** built-in + custom award definitions (shared **globally**
|
||||
across profiles) — DXCC, WAS / WAZ / WAC, WPX, IOTA / POTA / SOTA / WWFF,
|
||||
**DDFM**, worked/confirmed/validated by band & mode, OR rules and manual
|
||||
reference assignment, live reference detection on call entry, **reference-list
|
||||
import** for totals/names, and a **Rescan** that re-pulls the logbook (picks up
|
||||
fresh LoTW/QRZ confirmations).
|
||||
- **QSL services:** ClubLog (batched ADIF upload), LoTW, QRZ.com, eQSL — upload
|
||||
and **confirmation download** (which auto-refreshes the award stats).
|
||||
- **QSL Card Designer** (see below).
|
||||
- **E-mail eQSL:** right-click a QSO → *Send eQSL by e-mail* via the configured
|
||||
SMTP account. (Outlook/Hotmail disable basic-auth SMTP — use Gmail with an app
|
||||
password, or a Microsoft app password.)
|
||||
|
||||
## Contest logging
|
||||
|
||||
- **Contest tab:** pick a contest (built-in ADIF `CONTEST_ID` list) and an
|
||||
exchange (running serial or a fixed exchange). OpsLog auto-fills `CONTEST_ID`
|
||||
and the sent/received serials (`STX` / `SRX`), enforces a window start/end,
|
||||
flags dupes and keeps a live scoreboard.
|
||||
|
||||
## Statistics
|
||||
|
||||
- **Logbook statistics dashboard:** headline tiles (QSOs, unique callsigns, DXCC
|
||||
entities, continents, % confirmed) plus charts — QSOs **by mode**, a per-band
|
||||
**CW / phone / data** split, **activity over time** (rolling day / 7-day /
|
||||
30-day / 12-month views), by operator and by continent. Date-range, per-operator
|
||||
and per-contest filters, and a **Table** view that mirrors every chart.
|
||||
|
||||
## Multi-operator live status (special events)
|
||||
|
||||
For a multi-op special-event call on a shared MySQL logbook (e.g. **TM74TFR**),
|
||||
publishing is **automatic** — no setting to turn on. Each OpsLog instance
|
||||
heartbeats its current activity (operator call, band, frequency, mode) into a
|
||||
`live_status` table every ~15 s, and drops back to *off air* automatically 5 min
|
||||
after the last logged QSO. A small PHP renderer
|
||||
([`docs/livestatus/tm74-status.php`](docs/livestatus/tm74-status.php)) on your
|
||||
own web server reads that table and produces a live page/image you can embed on
|
||||
the station's **QRZ.com** bio (`<img src="…/tm74-status.php?img=1">`). OpsLog
|
||||
only writes to the DB — it is not a web server.
|
||||
|
||||
## Net control
|
||||
|
||||
- **Directed-net logging** (Tools → Net): a global roster (`nets.json`) plus an
|
||||
in-memory active session — check stations in, then log them individually or the
|
||||
whole net at once (**Log everyone**) using the CAT frequency. **Drag & drop**
|
||||
between the two lists (roster → on-air starts a QSO, on-air → roster logs it),
|
||||
and after each log the next on-air station is selected automatically so you can
|
||||
chain contacts.
|
||||
|
||||
## Appearance & language
|
||||
|
||||
- **Themes:** four complete themes (Warm light, Warm dark, Graphite dark, High
|
||||
contrast) plus **Auto** (follows the OS light/dark preference), selectable in
|
||||
Settings → General. Every panel and every AG-Grid table follows the theme.
|
||||
- **Bilingual:** full **English / French** UI, with a first-run flag chooser and
|
||||
a switcher in Settings → General.
|
||||
|
||||
## Security
|
||||
|
||||
- **Secret vault:** opt-in passphrase encryption of the stored passwords
|
||||
(AES-GCM + PBKDF2). Encrypted values are portable; a single unlock prompt at
|
||||
launch decrypts them for the session.
|
||||
|
||||
## Integrations (outbound)
|
||||
|
||||
- **UDP emitters:** push the current frequency to **PstRotator**, radio info in
|
||||
**N1MM `RadioInfo`** format, or an **ADIF record on each logged QSO** — so
|
||||
external tools (rotator control, digital apps, other loggers) stay in sync.
|
||||
|
||||
## Other
|
||||
|
||||
- **Autostart:** launch external programs (WSJT-X, JTAlert, rotator control…) at
|
||||
OpsLog startup, skipping any already running.
|
||||
- **Backup:** optional database + ADIF backup at shutdown.
|
||||
- **Update check** at startup and every 5 minutes (and on opening Help → About),
|
||||
with a toast (toggleable), plus a **What's new** dialog that shows the changelog
|
||||
(English / French) on the first launch after an update — reopenable any time
|
||||
from the Help menu.
|
||||
- **Anonymous usage telemetry** (a once-a-day heartbeat: random install ID +
|
||||
version + OS — no callsign or QSO data; opt-out in Preferences).
|
||||
|
||||
---
|
||||
|
||||
## QSL Card Designer
|
||||
|
||||
Tools → *QSL Card Designer…* turns a few photos into a polished eQSL card:
|
||||
|
||||
1. Pick 1–6 photos (jpeg/png). OpsLog analyzes them offline (detail/luminance
|
||||
grid) and proposes **3 designs** — callsign in the calmest zone of the best
|
||||
photo, operator name, CQ/ITU zones + locator line, country flag, the other
|
||||
photos as bordered inserts, and a per-QSO confirmation box.
|
||||
2. Pick a proposal and fine-tune it: click an element to select, drag to move,
|
||||
change font / style preset (gel gold, gel silver, classic white outline,
|
||||
script, flat) and per-preset knobs in the right panel.
|
||||
3. Save the template (photos are copied into `data/qsl/templates/<id>/`, so the
|
||||
originals can move). One template can be the default per profile.
|
||||
|
||||
Sending: right-click a QSO → *Send eQSL by e-mail*. The card is rendered with
|
||||
that QSO's data, rasterized to a ≤ 800 KB JPEG, archived in `data/qsl/outbox/`
|
||||
and sent through the configured SMTP account to the address found by the
|
||||
QRZ/HamQTH lookup. On success the QSO is stamped `EQSL_SENT=Y` (ADIF). The
|
||||
e-mail subject/body templates live in the designer
|
||||
(`{CALL} {DATE} {BAND} {MODE} {MYCALL}` variables).
|
||||
|
||||
Fonts: Archivo Black, Lilita One, Baloo 2, Oswald, Great Vibes, Allura (all
|
||||
OFL, embedded — licenses in `internal/qslcard/assets/fonts/`); Cooper Black is
|
||||
offered when MS Office installed it. Flags: flag-icons (MIT), embedded for the
|
||||
commonly-worked DXCC entities.
|
||||
|
||||
---
|
||||
|
||||
## Data & storage
|
||||
|
||||
- **Config** (settings, profiles, rigs/antennas, cluster nodes, lookup cache,
|
||||
award lists, QSL templates) always lives in the local SQLite file under
|
||||
`data/` — instant even when the logbook is on a far-away MySQL.
|
||||
- **Logbook** (QSOs) lives where the active profile points it: the local SQLite
|
||||
file or a per-profile shared **MySQL** database.
|
||||
|
||||
---
|
||||
|
||||
*A French version of this document is available in [README.fr.md](README.fr.md).*
|
||||
When working in contests, it is important to record all on the air operation, for this purpose
|
||||
the audio stream from the line-output is sent to all clients. The resulting audio stream can be
|
||||
recorded to a file or played back with a PC sound card.
|
||||
|
||||
@@ -8350,8 +8350,49 @@ type AudioSettings struct {
|
||||
|
||||
// ListAudioInputDevices / ListAudioOutputDevices enumerate WASAPI endpoints
|
||||
// for the device dropdowns.
|
||||
func (a *App) ListAudioInputDevices() ([]audio.Device, error) { return audio.ListInputDevices() }
|
||||
func (a *App) ListAudioOutputDevices() ([]audio.Device, error) { return audio.ListOutputDevices() }
|
||||
// ListAudioInputDevices lists the microphones and line inputs, plus THE RADIO
|
||||
// when the CAT link carries its receive audio.
|
||||
//
|
||||
// Same reasoning as the output list: over TCI there is no sound device for
|
||||
// Windows to show, so without this the one correct answer to "where does the
|
||||
// received audio come from" could not be chosen at all.
|
||||
func (a *App) ListAudioInputDevices() ([]audio.Device, error) {
|
||||
devs, err := audio.ListInputDevices()
|
||||
if err != nil {
|
||||
return devs, err
|
||||
}
|
||||
if a.tciAudioAvailable() {
|
||||
devs = append([]audio.Device{{ID: audio.NetworkDeviceID, Name: "Radio (TCI network audio)"}}, devs...)
|
||||
}
|
||||
return devs, nil
|
||||
}
|
||||
|
||||
// tciAudioAvailable says whether the active CAT backend is a radio that streams
|
||||
// its audio over the CAT link.
|
||||
func (a *App) tciAudioAvailable() bool {
|
||||
if a.cat == nil {
|
||||
return false
|
||||
}
|
||||
_, ok := a.cat.TCIAudioState()
|
||||
return ok
|
||||
}
|
||||
|
||||
// ListAudioOutputDevices lists the sound cards, plus THE RADIO ITSELF when the
|
||||
// CAT link can carry transmit audio.
|
||||
//
|
||||
// Offered only while it is actually available, and named as a radio rather than
|
||||
// as a protocol: an operator choosing where their voice goes is picking between
|
||||
// "my sound card" and "the radio", not between WASAPI and TCI.
|
||||
func (a *App) ListAudioOutputDevices() ([]audio.Device, error) {
|
||||
devs, err := audio.ListOutputDevices()
|
||||
if err != nil {
|
||||
return devs, err
|
||||
}
|
||||
if audio.NetworkPlayerReady() {
|
||||
devs = append([]audio.Device{{ID: audio.NetworkDeviceID, Name: "Radio (TCI network audio)"}}, devs...)
|
||||
}
|
||||
return devs, nil
|
||||
}
|
||||
|
||||
// GetAudioSettings returns the stored audio config (preroll defaults to 8s).
|
||||
func (a *App) GetAudioSettings() (AudioSettings, error) {
|
||||
@@ -8453,6 +8494,20 @@ func (a *App) SaveAudioSettings(s AudioSettings) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Choosing the radio as the receive device opens its stream, and choosing
|
||||
// anything else closes it. Done HERE rather than left to the next restart:
|
||||
// a device chosen in a dropdown that only takes effect after a relaunch
|
||||
// reads as a device that does not work.
|
||||
// The transmit source follows the "To radio" device, and is applied now:
|
||||
// the radio is told which input to use at the moment it is keyed, so the
|
||||
// setting has to be right before the next message rather than after the
|
||||
// next restart.
|
||||
a.applyTCITXSource()
|
||||
if s.FromRadio == audio.NetworkDeviceID {
|
||||
a.startTCIRecording()
|
||||
} else if a.tciAudioAvailable() {
|
||||
_ = a.cat.TCIAudioDo(func(t cat.TCIAudioController) error { return t.StopTCIAudio() })
|
||||
}
|
||||
// Apply device/preroll/enable changes to the running recorder.
|
||||
a.startQSORecorderIfEnabled()
|
||||
// And to a monitor ALREADY RUNNING: the operator is listening while they
|
||||
@@ -8497,7 +8552,7 @@ func (a *App) startQSORecorderIfEnabled() {
|
||||
// nothing right to point at. The stream is pushed into the recorder instead
|
||||
// — same samples, no sound card in the middle, and no virtual cable to set up.
|
||||
from := cfg.FromRadio
|
||||
a.qsoRecPushed = a.icomNetAudioActive()
|
||||
a.qsoRecPushed = a.icomNetAudioActive() || cfg.FromRadio == audio.NetworkDeviceID
|
||||
if a.qsoRecPushed {
|
||||
from = audio.PushedSource
|
||||
}
|
||||
@@ -15178,6 +15233,12 @@ func (a *App) reloadCAT() {
|
||||
} else {
|
||||
a.catSig = sig
|
||||
}
|
||||
// Withdraw the radio as an audio output before deciding anything else. The
|
||||
// TCI case below puts it back; every other backend, and a CAT link turned
|
||||
// off entirely, leaves it withdrawn — a voice keyer that still lists a radio
|
||||
// it can no longer reach would play a message to nowhere, and the operator
|
||||
// hears their own PTT click and assumes it went out.
|
||||
a.installTCITXPlayer(false)
|
||||
if !s.Enabled {
|
||||
a.cat.Stop()
|
||||
return
|
||||
@@ -15300,7 +15361,14 @@ func (a *App) reloadCAT() {
|
||||
a.cat.Start(cat.NewIcomNet(s.IcomNetHost, s.IcomNetUser, s.IcomNetPass, s.IcomAddr, s.DigitalDefault, audioSink))
|
||||
case "tci":
|
||||
// Expert Electronics TCI (WebSocket) — SunSDR / ExpertSDR2, or any
|
||||
// TCI-compatible server.
|
||||
// TCI-compatible server. The receive audio rides the same socket, so
|
||||
// the QSO recorder can take it without a virtual cable — see
|
||||
// app_tci_rec.go. Armed after the backend is up, since it is the
|
||||
// backend that carries the stream.
|
||||
defer a.startTCIRecording()
|
||||
// And the other direction: the voice keyer can send its messages over
|
||||
// the same link — see app_tci_dvk.go.
|
||||
defer a.installTCITXPlayer(true)
|
||||
tb := cat.NewTCI(s.TCIHost, s.TCIPort, s.DigitalDefault, s.TCISpots)
|
||||
// Clicking one of our spots on the ExpertSDR panorama fills the entry form.
|
||||
tb.OnSpotClick = func(call string, hz int64) {
|
||||
@@ -20007,7 +20075,27 @@ func (a *App) IsNewUSCounty(state, cnty string) bool {
|
||||
// native ones: an operator on OmniRig or Flex gets the same server.
|
||||
type catShareRig struct{ a *App }
|
||||
|
||||
func (r catShareRig) Freq() int64 { return r.a.cat.State().FreqHz }
|
||||
// Freq is what a rigctl client gets for "f": the frequency of the VFO in use,
|
||||
// which is where we LISTEN.
|
||||
//
|
||||
// This returned FreqHz, and RigState follows ADIF where FreqHz is the TRANSMIT
|
||||
// frequency — so with split on, every client asking "what frequency is the
|
||||
// radio on" was told VFO B. Reported from a station running an IC-7850: turning
|
||||
// VFO B moved VFO A. Nothing in OpsLog was writing to the radio; a client was
|
||||
// reading the dial, being handed the wrong VFO, and writing it back.
|
||||
//
|
||||
// The split TX frequency is a separate question, and Hamlib has a separate
|
||||
// command for it ("i" / get_split_freq) which Split() below answers.
|
||||
func (r catShareRig) Freq() int64 { return shareRXFreq(r.a.cat.State()) }
|
||||
|
||||
// shareRXFreq is that rule on its own, so it can be pinned by a test: it is one
|
||||
// line, it was wrong, and being wrong cost a station its VFO A.
|
||||
func shareRXFreq(st cat.RigState) int64 {
|
||||
if st.Split && st.RxFreqHz > 0 {
|
||||
return st.RxFreqHz
|
||||
}
|
||||
return st.FreqHz
|
||||
}
|
||||
func (r catShareRig) Mode() string { return r.a.cat.State().Mode }
|
||||
|
||||
// Split reports the flag and the OTHER VFO's frequency. RigState follows ADIF —
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package main
|
||||
|
||||
// The voice keyer, through the radio's own link.
|
||||
//
|
||||
// Selecting the radio as the "To radio" output makes the voice keyer hand its
|
||||
// messages to the CAT backend instead of a sound card. Everything around it is
|
||||
// unchanged — the same PTT before and after, the same gain, the same files —
|
||||
// which is the point: the audio takes a different road, not a different route.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"hamlog/internal/applog"
|
||||
"hamlog/internal/audio"
|
||||
"hamlog/internal/cat"
|
||||
)
|
||||
|
||||
// tciTXPlayer hands one message to the radio.
|
||||
//
|
||||
// The controller is fetched on the CAT goroutine and the message is then played
|
||||
// OFF it. Playing on it would hold that goroutine for the length of the
|
||||
// message, and everything else about the rig — frequency, mode, PTT state —
|
||||
// goes through the same place: a ten-second call would freeze the display and
|
||||
// the antenna following for ten seconds. The TCI backend serialises its own
|
||||
// writes, so this is safe to call from here.
|
||||
func (a *App) tciTXPlayer(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error {
|
||||
if a.cat == nil {
|
||||
return fmt.Errorf("CAT not initialized")
|
||||
}
|
||||
type txPlayer interface {
|
||||
PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error
|
||||
}
|
||||
var player txPlayer
|
||||
err := a.cat.TCIAudioDo(func(t cat.TCIAudioController) error {
|
||||
p, ok := t.(txPlayer)
|
||||
if !ok {
|
||||
return fmt.Errorf("this radio cannot take transmit audio over its CAT link")
|
||||
}
|
||||
player = p
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return player.PlayTXAudio(pcm, rate, ch, bits, stop)
|
||||
}
|
||||
|
||||
// applyTCITXSource tells the radio where to take its transmit audio from,
|
||||
// following the "To radio" device.
|
||||
//
|
||||
// This is the setting an operator would otherwise have to find in ExpertSDR3
|
||||
// and set again for every mode, because it is remembered per mode there. It is
|
||||
// the third argument of TRX, so OpsLog can simply say it each time it keys —
|
||||
// and a radio told nothing keeps the operator's microphone, which is what
|
||||
// every PTT that is not a voice message should do.
|
||||
func (a *App) applyTCITXSource() {
|
||||
if a.cat == nil {
|
||||
return
|
||||
}
|
||||
cfg, _ := a.GetAudioSettings()
|
||||
src := ""
|
||||
if cfg.ToRadio == audio.NetworkDeviceID {
|
||||
src = "tci"
|
||||
}
|
||||
_ = a.cat.TCIAudioDo(func(t cat.TCIAudioController) error {
|
||||
if s, ok := t.(interface{ SetTXAudioSource(string) }); ok {
|
||||
s.SetTXAudioSource(src)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// installTCITXPlayer offers the radio as an audio output, or withdraws it.
|
||||
//
|
||||
// Withdrawing matters as much as offering: a radio that has gone away must stop
|
||||
// being a device the voice keyer will happily "play" to, or a message goes
|
||||
// nowhere and the operator hears their own PTT click and assumes it worked.
|
||||
func (a *App) installTCITXPlayer(on bool) {
|
||||
if !on {
|
||||
audio.SetNetworkPlayer(nil)
|
||||
return
|
||||
}
|
||||
audio.SetNetworkPlayer(a.tciTXPlayer)
|
||||
a.applyTCITXSource()
|
||||
applog.Printf("tci: the radio is available as an audio output — no virtual cable needed for the voice keyer")
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package main
|
||||
|
||||
// Feeding the QSO recorder from the TCI stream.
|
||||
//
|
||||
// The recorder works in 16 kHz mono, which is what its files and its mixing are
|
||||
// built around; TCI delivers 48 kHz stereo float32. The conversion is the whole
|
||||
// of this file, and it happens here rather than in internal/cat because the
|
||||
// radio's job is to hand over what it sent, not to know what the recorder wants.
|
||||
//
|
||||
// Confirmed on a SunSDR (ExpertSDR3 1.5): 2048 samples a frame, 8192 bytes,
|
||||
// four bytes per sample — and a test recording that plays back clean.
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"hamlog/internal/applog"
|
||||
"hamlog/internal/audio"
|
||||
"hamlog/internal/cat"
|
||||
)
|
||||
|
||||
// tciRecordSink pushes the receive stream into the QSO recorder.
|
||||
//
|
||||
// Installed whenever the TCI backend starts, and harmless when nothing is
|
||||
// recording: PushRX drops what arrives unless a QSO is being captured, so the
|
||||
// cost while idle is a decimation and a function call.
|
||||
func (a *App) tciRecordSink(rate int, samples []float32) {
|
||||
if a.qsoRec == nil || len(samples) == 0 {
|
||||
return
|
||||
}
|
||||
a.qsoRec.PushRX(tciToRecorderPCM(rate, samples))
|
||||
}
|
||||
|
||||
// tciToRecorderPCM converts the stream's mono float samples to the recorder's
|
||||
// 16-bit PCM at its own rate.
|
||||
//
|
||||
// Averaging rather than picking every third sample: dropping samples aliases
|
||||
// everything above 8 kHz back down into the voice band, and on a receiver that
|
||||
// is hiss — the one thing a QSO recording has plenty of. A three-tap mean is a
|
||||
// crude low-pass, but it is a low-pass, and it costs two additions.
|
||||
func tciToRecorderPCM(rate int, samples []float32) []byte {
|
||||
if rate <= 0 {
|
||||
rate = 48000
|
||||
}
|
||||
step := rate / audio.RecorderSampleRate
|
||||
if step < 1 {
|
||||
step = 1
|
||||
}
|
||||
out := make([]byte, 0, (len(samples)/step)*2)
|
||||
for i := 0; i+step <= len(samples); i += step {
|
||||
var sum float32
|
||||
for j := 0; j < step; j++ {
|
||||
sum += samples[i+j]
|
||||
}
|
||||
v := sum / float32(step)
|
||||
if v > 1 {
|
||||
v = 1
|
||||
}
|
||||
if v < -1 {
|
||||
v = -1
|
||||
}
|
||||
var b [2]byte
|
||||
binary.LittleEndian.PutUint16(b[:], uint16(int16(v*32767)))
|
||||
out = append(out, b[0], b[1])
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// startTCIRecording opens the receive stream and routes it to the recorder.
|
||||
//
|
||||
// Called when the TCI backend comes up, and only when the operator has asked
|
||||
// for it by choosing the radio as their receive device: opening a 384 kB/s
|
||||
// stream on a station that records nothing is work the radio does for nobody.
|
||||
func (a *App) startTCIRecording() {
|
||||
if a.cat == nil {
|
||||
return
|
||||
}
|
||||
// One switch, and it is the one an operator is already looking at: the
|
||||
// "From radio" device. There used to be a tick box here as well, from when
|
||||
// this was an experiment with no device to choose — two controls for one
|
||||
// question, and the second was where nobody would look.
|
||||
cfg, _ := a.GetAudioSettings()
|
||||
if cfg.FromRadio != audio.NetworkDeviceID {
|
||||
return
|
||||
}
|
||||
err := a.cat.TCIAudioDo(func(t cat.TCIAudioController) error {
|
||||
if s, ok := t.(interface {
|
||||
SetTCIAudioSink(func(int, []float32))
|
||||
}); ok {
|
||||
s.SetTCIAudioSink(a.tciRecordSink)
|
||||
}
|
||||
return t.StartTCIAudio(0, 48000)
|
||||
})
|
||||
if err != nil {
|
||||
applog.Printf("tci: could not open the receive stream for recording: %v", err)
|
||||
return
|
||||
}
|
||||
applog.Printf("tci: recording the receive audio over TCI — no virtual cable needed")
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"testing"
|
||||
|
||||
"hamlog/internal/audio"
|
||||
)
|
||||
|
||||
// The stream is 48 kHz and the recorder works at 16 — three to one. A
|
||||
// recording that keeps every sample plays back three times too fast, which is
|
||||
// the fault that gets blamed on the decoding rather than on the rate.
|
||||
func TestTheStreamIsResampledToTheRecorderRate(t *testing.T) {
|
||||
const in = 48000
|
||||
samples := make([]float32, in/10) // a tenth of a second
|
||||
pcm := tciToRecorderPCM(in, samples)
|
||||
want := (audio.RecorderSampleRate / 10) * 2 // 16-bit
|
||||
if len(pcm) != want {
|
||||
t.Fatalf("a tenth of a second produced %d bytes, want %d", len(pcm), want)
|
||||
}
|
||||
}
|
||||
|
||||
// Full scale must arrive as full scale: a conversion that quietly halves the
|
||||
// level turns a recording into evidence of a fault that is not there.
|
||||
func TestFullScaleSurvivesTheConversion(t *testing.T) {
|
||||
samples := make([]float32, 12)
|
||||
for i := range samples {
|
||||
samples[i] = 1
|
||||
}
|
||||
pcm := tciToRecorderPCM(48000, samples)
|
||||
if len(pcm) < 2 {
|
||||
t.Fatal("no samples came out")
|
||||
}
|
||||
v := int16(binary.LittleEndian.Uint16(pcm[:2]))
|
||||
if v < 32000 {
|
||||
t.Fatalf("full scale came out at %d", v)
|
||||
}
|
||||
}
|
||||
|
||||
// A rate the recorder already works in is passed through rather than mangled by
|
||||
// a division that would round to nothing.
|
||||
func TestAStreamAtTheRecorderRateIsNotDecimated(t *testing.T) {
|
||||
samples := make([]float32, 160)
|
||||
if got, want := len(tciToRecorderPCM(audio.RecorderSampleRate, samples)), 160*2; got != want {
|
||||
t.Fatalf("%d bytes, want %d", got, want)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"hamlog/internal/cat"
|
||||
)
|
||||
|
||||
// What a rigctl client is told when it asks "what frequency is the radio on".
|
||||
//
|
||||
// Hamlib's "f" means the VFO IN USE — where the operator is listening. RigState
|
||||
// follows ADIF, where FreqHz is where we TRANSMIT, and the two are the same
|
||||
// number until split is engaged. They were handed over unchanged, so with split
|
||||
// on every client asking for the dial was given VFO B.
|
||||
//
|
||||
// Reported from a station running an IC-7850 over USB: turning VFO B moved
|
||||
// VFO A. OpsLog was writing nothing to that radio — a client read the dial, was
|
||||
// handed the transmit VFO, and wrote it back as the dial.
|
||||
func TestShareRXFreqAnswersTheListeningVFO(t *testing.T) {
|
||||
const rx, tx = 14195000, 14200500
|
||||
cases := []struct {
|
||||
name string
|
||||
st cat.RigState
|
||||
want int64
|
||||
}{
|
||||
{
|
||||
name: "simplex — the one frequency there is",
|
||||
st: cat.RigState{FreqHz: rx},
|
||||
want: rx,
|
||||
},
|
||||
{
|
||||
name: "split — the RX VFO, not the TX one",
|
||||
st: cat.RigState{Split: true, FreqHz: tx, RxFreqHz: rx},
|
||||
want: rx,
|
||||
},
|
||||
{
|
||||
// A backend that reports split without ever filling RxFreqHz would
|
||||
// otherwise be answered with 0, and a client told the radio is on
|
||||
// 0 Hz does something worse than nothing with it.
|
||||
name: "split claimed but no RX frequency known",
|
||||
st: cat.RigState{Split: true, FreqHz: tx},
|
||||
want: tx,
|
||||
},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
if got := shareRXFreq(c.st); got != c.want {
|
||||
t.Errorf("shareRXFreq(%+v) = %d, want %d", c.st, got, c.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// And the pair, stated together: the two questions must not return the same
|
||||
// answer while split is on, or the distinction has been lost somewhere.
|
||||
func TestShareSplitReportsTheOtherVFO(t *testing.T) {
|
||||
st := cat.RigState{Split: true, FreqHz: 14200500, RxFreqHz: 14195000}
|
||||
rxAnswer := shareRXFreq(st)
|
||||
txAnswer := st.FreqHz // what Split() hands back for "i" / get_split_freq
|
||||
if rxAnswer == txAnswer {
|
||||
t.Fatalf("get_freq and get_split_freq both answered %d — a client cannot tell the VFOs apart", rxAnswer)
|
||||
}
|
||||
if rxAnswer != st.RxFreqHz || txAnswer != st.FreqHz {
|
||||
t.Errorf("got rx=%d tx=%d, want rx=%d tx=%d", rxAnswer, txAnswer, st.RxFreqHz, st.FreqHz)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,44 @@
|
||||
[
|
||||
{
|
||||
"version": "0.26.17",
|
||||
"date": "",
|
||||
"en": [
|
||||
"Awards, RDA district comparison: each disagreement can now be settled on its own row. Click the district you keep — the log's or the database's — and apply. It is written into the contact's CNTY and its award reference, and the settled rows leave the list.",
|
||||
"The band/mode matrix: a confirmed slot now shows as confirmed. A callsign worked and not confirmed was outranking an entity CONFIRMED on the same band and mode, so a slot that needs nothing was painted as if it still did.",
|
||||
"CAT sharing: a program connected to OpsLog's rigctl server is told the frequency it is LISTENING on. With split engaged it was given the transmit VFO instead, so a client that reads the dial and writes it back — WSJT-X and its like — could move VFO A when VFO B was turned."
|
||||
],
|
||||
"fr": [
|
||||
"Diplômes, comparaison des districts RDA : chaque divergence se règle désormais sur sa propre ligne. Cliquer le district qu'on garde — celui du log ou celui de la base — puis appliquer. Il est écrit dans le CNTY du contact et dans sa référence de diplôme, et les lignes réglées quittent la liste.",
|
||||
"Matrice bandes/modes : une case confirmée s'affiche enfin comme confirmée. Un indicatif travaillé et non confirmé l'emportait sur une entité CONFIRMÉE sur la même bande et le même mode, si bien qu'une case qui ne demandait plus rien était peinte comme s'il manquait encore quelque chose.",
|
||||
"Partage CAT : un programme connecté au serveur rigctl d'OpsLog reçoit la fréquence sur laquelle on ÉCOUTE. En split, c'était le VFO d'émission qui lui était donné, si bien qu'un client qui lit le VFO et le réécrit — WSJT-X et consorts — pouvait déplacer le VFO A quand on tournait le VFO B."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.16",
|
||||
"date": "",
|
||||
"en": [
|
||||
"TCI transmit needs no setting up in ExpertSDR3 any more. The protocol lets the audio source be named when keying, so OpsLog does it — the voice keyer works in SSB as well as in the digital modes, nothing has to be set per mode in the radio's own window, and the microphone stays the source for every transmission that is not a voice message."
|
||||
],
|
||||
"fr": [
|
||||
"L'émission TCI ne demande plus aucun réglage dans ExpertSDR3. Le protocole permet de nommer la source audio au moment de passer en émission, et OpsLog le fait — le manipulateur vocal fonctionne en SSB comme en numérique, il n'y a plus rien à régler mode par mode dans la fenêtre de la radio, et le micro reste la source pour toute émission qui n'est pas un message vocal."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.15",
|
||||
"date": "",
|
||||
"en": [
|
||||
"SunSDR / ExpertSDR3: the radio's audio now travels over the TCI link itself. Pick 'Radio (TCI network audio)' as the From Radio or To Radio device and the QSO recorder and the voice keyer work with no virtual cable, no second sound card and nothing to set up in the Windows mixer.",
|
||||
"For transmit, ExpertSDR3's own transmit audio source must be set to TCI rather than the microphone — it is remembered per mode, so setting it in SSB does not set it in DIGU. OpsLog says so within a fifth of a second rather than transmitting silence.",
|
||||
"Awards, RDA district comparison: the list stays where it was put. It was thrown back to the first row every three seconds, which made a long list of contacts to correct impossible to work through.",
|
||||
"Elecraft console: the SWR bar works. The radio answers SW; with three digits in tenths of a ratio — SW023 is 2.3:1 — and OpsLog was reading four, so every answer was discarded and the bar stayed empty."
|
||||
],
|
||||
"fr": [
|
||||
"SunSDR / ExpertSDR3 : l'audio de la radio passe désormais par la liaison TCI elle-même. Choisis « Radio (TCI network audio) » comme périphérique From Radio ou To Radio et l'enregistreur de QSO comme le manipulateur vocal fonctionnent sans câble virtuel, sans seconde carte son et sans rien à régler dans le mixeur Windows.",
|
||||
"Pour l'émission, la source audio d'émission d'ExpertSDR3 doit être réglée sur TCI et non sur le micro — elle est mémorisée par mode, donc la régler en SSB ne la règle pas en DIGU. OpsLog le dit en deux dixièmes de seconde au lieu d'émettre du silence.",
|
||||
"Diplômes, comparaison des districts RDA : la liste reste où on l'a laissée. Elle revenait à la première ligne toutes les trois secondes, ce qui rendait impraticable une longue liste de contacts à corriger.",
|
||||
"Console Elecraft : la barre de ROS fonctionne. La radio répond à SW; par trois chiffres en dixièmes de rapport — SW023 vaut 2,3:1 — et OpsLog en lisait quatre, si bien que chaque réponse était jetée et la barre restait vide."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.26.14",
|
||||
"date": "",
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
|
||||
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
|
||||
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
|
||||
GetUltrabeamSettings, SaveUltrabeamSettings, TestUltrabeam, CompactDatabase, CheckHamlogKey, CompareRDASources,
|
||||
GetUltrabeamSettings, SaveUltrabeamSettings, TestUltrabeam, CompactDatabase, CheckHamlogKey, CompareRDASources, ApplyRDAChoices,
|
||||
GetAntGeniusSettings, SaveAntGeniusSettings,
|
||||
GetTunerGeniusSettings, SaveTunerGeniusSettings,
|
||||
GetPSUSettings, SavePSUSettings,
|
||||
@@ -58,7 +58,7 @@ import {
|
||||
GetFolderSync, SaveFolderSync, PickFolderSyncFolder, GetFolderSyncStatus, SyncFolderNow,
|
||||
GetRelayAuto, SaveRelayAuto, GetStationDevices,
|
||||
GetAwardDefs, GetTrackedAwards, SaveTrackedAwards,
|
||||
GetBandOpenSettings, SaveBandOpenSettings, GetGridScopeSettings, SaveGridScopeSettings, GetPSKReporterStatus, GetChaseNewGrids, SetChaseNewGrids, GetChaseNew, SetChaseNew, GetGridCacheStatus, GetLinkedAmps, SetLinkedAmps, GetSpotTTLMinutes, SetSpotTTLMinutes, GetSpotMax, SetSpotMax,
|
||||
GetBandOpenSettings, SaveBandOpenSettings, GetGridScopeSettings, SaveGridScopeSettings, GetPSKReporterStatus, GetChaseNewGrids, SetChaseNewGrids, GetChaseNew, SetChaseNew, GetGridCacheStatus, GetLinkedAmps, SetLinkedAmps, GetSpotTTLMinutes, SetSpotTTLMinutes, GetSpotMax, SetSpotMax,
|
||||
} from '../../wailsjs/go/main/App';
|
||||
import type { profile as profileModels } from '../../wailsjs/go/models';
|
||||
import type { LookupSettingsForm, StationSettingsForm, ListsSettingsForm, ModePresetForm } from '@/types';
|
||||
@@ -1946,6 +1946,11 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
// nobody had pressed, and the one that had been pressed showed nothing at
|
||||
// all, which reads as "the button does nothing".
|
||||
const [rdaCmpMsg, setRdaCmpMsg] = useState<string>('');
|
||||
// Which source the operator kept, per QSO id. By id and not by row: a second
|
||||
// comparison rebuilds the list, and a choice that followed a row number would
|
||||
// then be applied to somebody else's contact.
|
||||
const [rdaPick, setRdaPick] = useState<Record<number, 'log' | 'db'>>({});
|
||||
const [rdaApplyBusy, setRdaApplyBusy] = useState(false);
|
||||
const runRDACompare = async () => {
|
||||
setRdaCmpBusy(true); setRdaCmp(null); setRdaCmpMsg('');
|
||||
try {
|
||||
@@ -2035,6 +2040,13 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
const [spotTTL, setSpotTTL] = useState(0);
|
||||
const [spotTTLText, setSpotTTLText] = useState('0');
|
||||
const [spotMaxText, setSpotMaxText] = useState('1000');
|
||||
// TCI receive-audio test bench. Polled only while the stream is open: a panel
|
||||
// that asks the backend twice a second for a stream nobody started is work
|
||||
// done for nothing.
|
||||
|
||||
|
||||
|
||||
// Whether the QSO recorder takes its audio from the radio's own stream.
|
||||
const [gridStat, setGridStat] = useState<any>(null);
|
||||
const [pskrStatus, setPskrStatus] = useState<any>(null);
|
||||
const saveBandOpen = async (next: any) => {
|
||||
@@ -2050,14 +2062,22 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
try { const n = await GetSpotTTLMinutes(); setSpotTTL(n); setSpotTTLText(String(n)); } catch { /* defaults stand */ }
|
||||
try { const n = await GetSpotMax(); setSpotMaxText(String(n)); } catch { /* defaults stand */ }
|
||||
})();
|
||||
// Poll the feed while the panel is open: a live count is the only thing that
|
||||
// distinguishes "connected" from "connected and receiving nothing".
|
||||
}, []);
|
||||
// Poll the feed only while the section that SHOWS it is open.
|
||||
//
|
||||
// A live count is the one thing that separates "connected" from "connected
|
||||
// and receiving nothing", so it has to be polled — but it was polled from
|
||||
// everywhere, re-rendering the whole dialog every three seconds whichever
|
||||
// panel was in front. That is a heartbeat through every list and every form
|
||||
// in Preferences for a number nobody is looking at.
|
||||
useEffect(() => {
|
||||
if (selected !== 'cluster') return;
|
||||
const t = window.setInterval(async () => {
|
||||
try { setPskrStatus(await GetPSKReporterStatus()); } catch { /* ignore */ }
|
||||
try { setGridStat(await GetGridCacheStatus()); } catch { /* ignore */ }
|
||||
}, 3000);
|
||||
return () => window.clearInterval(t);
|
||||
}, []);
|
||||
}, [selected]);
|
||||
const [selfSpot, setSelfSpot] = useState({ enabled: false, minutes: SELF_SPOT_MIN_MIN });
|
||||
const [selfSpotText, setSelfSpotText] = useState(String(SELF_SPOT_MIN_MIN));
|
||||
const [clusterStatuses, setClusterStatuses] = useState<ClusterServerStatus[]>([]);
|
||||
@@ -6738,6 +6758,12 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
<strong>{t('aud.fromRadioShort')}</strong> {t('aud.explainFrom')}{' '}
|
||||
<strong>{t('aud.toRadioShort')}</strong> {t('aud.explainTo')}
|
||||
</p>
|
||||
|
||||
{/* The radio is one of the devices above when it can carry its own
|
||||
audio — see ListAudioInputDevices. What used to be here was a test
|
||||
bench: open the stream, record ten seconds, key a tone. It settled
|
||||
how TCI works and has no business in front of an operator now that
|
||||
choosing the device is the whole of the setup. */}
|
||||
<div className="flex items-center gap-3">
|
||||
<Button
|
||||
variant={monitorOn ? 'default' : 'outline'}
|
||||
@@ -7496,6 +7522,7 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
<th className="py-1 pr-2 font-medium">{t('rda.cmpFromLog')}</th>
|
||||
<th className="py-1 pr-2 font-medium">{t('rda.cmpFromDb')}</th>
|
||||
<th className="py-1 pr-2 font-medium">{t('rda.cmpKind')}</th>
|
||||
<th className="py-1 pr-2 font-medium text-center">{t('rda.cmpKeep')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -7520,11 +7547,100 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
<td className="py-1 pr-2 text-muted-foreground">
|
||||
{c.dated ? t('rda.cmpDated') : t('rda.cmpCurrent')}
|
||||
</td>
|
||||
{/* Which one wins, on the row that shows the two values.
|
||||
Two buttons rather than a tick box: a tick box would
|
||||
have to mean one of the sources silently, and an
|
||||
operator arbitrating between "RO-19" and "KO-05"
|
||||
should be picking the value they can read, not
|
||||
remembering what a checked box stands for. */}
|
||||
<td className="py-1 pr-2 whitespace-nowrap text-center">
|
||||
<div className="inline-flex rounded border border-border overflow-hidden">
|
||||
{(['log', 'db'] as const).map((side) => (
|
||||
<button
|
||||
key={side}
|
||||
type="button"
|
||||
onClick={() => setRdaPick((p) => {
|
||||
const next = { ...p };
|
||||
if (next[c.qso_id] === side) delete next[c.qso_id];
|
||||
else next[c.qso_id] = side;
|
||||
return next;
|
||||
})}
|
||||
className={`px-2 py-0.5 font-mono text-[10px] ${rdaPick[c.qso_id] === side
|
||||
? 'bg-primary text-primary-foreground'
|
||||
: 'hover:bg-muted'}`}
|
||||
title={side === 'log' ? t('rda.cmpKeepLog') : t('rda.cmpKeepDb')}
|
||||
>
|
||||
{side === 'log' ? c.from_log : c.from_db}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/* Applying is a separate, deliberate act. Clicking through two
|
||||
hundred rows and having each one written as it is clicked would
|
||||
make a slip permanent before the operator had finished
|
||||
reading. */}
|
||||
<div className="flex items-center gap-3 flex-wrap">
|
||||
<Button size="sm" variant="secondary" disabled={rdaApplyBusy || Object.keys(rdaPick).length === 0}
|
||||
onClick={async () => {
|
||||
setRdaApplyBusy(true);
|
||||
try {
|
||||
const choices = rdaCmp.conflicts
|
||||
.filter((c: any) => rdaPick[c.qso_id])
|
||||
.map((c: any) => ({
|
||||
qso_id: c.qso_id,
|
||||
district: rdaPick[c.qso_id] === 'log' ? c.from_log : c.from_db,
|
||||
}));
|
||||
const r: any = await ApplyRDAChoices(choices);
|
||||
setRdaCmpMsg(r?.message || '');
|
||||
setRdaPick({});
|
||||
// The settled rows leave the list, and the counters follow.
|
||||
//
|
||||
// They used to stay, which made a working button look like a
|
||||
// broken one: the operator decided a hundred contacts, the
|
||||
// hundred rows stayed exactly as they were, and there was
|
||||
// nothing anywhere to say the writing had happened. Dropping
|
||||
// them here rather than re-running the comparison, because
|
||||
// that reads the whole log — seconds of silence on a remote
|
||||
// database, to be told what is already known.
|
||||
if (r?.applied > 0) {
|
||||
const settled = new Set(choices.map((c: any) => c.qso_id));
|
||||
setRdaCmp((prev: any) => prev && ({
|
||||
...prev,
|
||||
disagree: Math.max(0, (prev.disagree ?? 0) - r.applied),
|
||||
agree: (prev.agree ?? 0) + r.applied,
|
||||
conflicts: (prev.conflicts ?? []).filter((c: any) => !settled.has(c.qso_id)),
|
||||
}));
|
||||
}
|
||||
} catch (e: any) {
|
||||
setRdaCmpMsg(String(e?.message ?? e));
|
||||
} finally {
|
||||
setRdaApplyBusy(false);
|
||||
}
|
||||
}}>
|
||||
{rdaApplyBusy ? <Loader2 className="size-3.5 animate-spin mr-1.5" /> : null}
|
||||
{t('rda.cmpApply', { n: Object.keys(rdaPick).length })}
|
||||
</Button>
|
||||
<button type="button" className="text-[11px] underline decoration-dotted hover:text-primary"
|
||||
onClick={() => setRdaPick(Object.fromEntries(rdaCmp.conflicts.map((c: any) => [c.qso_id, 'db'])))}>
|
||||
{t('rda.cmpAllDb')}
|
||||
</button>
|
||||
<button type="button" className="text-[11px] underline decoration-dotted hover:text-primary"
|
||||
onClick={() => setRdaPick(Object.fromEntries(rdaCmp.conflicts.map((c: any) => [c.qso_id, 'log'])))}>
|
||||
{t('rda.cmpAllLog')}
|
||||
</button>
|
||||
{Object.keys(rdaPick).length > 0 && (
|
||||
<button type="button" className="text-[11px] underline decoration-dotted hover:text-primary"
|
||||
onClick={() => setRdaPick({})}>
|
||||
{t('rda.cmpClear')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-[11px] text-muted-foreground">{t('rda.cmpApplyHint')}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
@@ -7560,7 +7676,16 @@ function SettingsModalImpl({ onClose, onSaved, initialSection, onMainPaneChanged
|
||||
uscounties: USCountiesPanel,
|
||||
databases: DatabasesPanel,
|
||||
autostart: () => <AutostartPanelComponent />,
|
||||
awards: () => (<div className="space-y-6"><AwardsSelectionPanel profile={activeProfile ?? undefined} /><RDAPanel /></div>),
|
||||
// RDAPanel is CALLED, not written as <RDAPanel />.
|
||||
//
|
||||
// It is nested inside this component, so as an element it would be a new
|
||||
// component TYPE on every render — React cannot know it is the same panel,
|
||||
// so it unmounts the old tree and mounts a fresh one. A fresh scroll
|
||||
// container starts at the top, which is what threw the district comparison
|
||||
// back to the first row every three seconds. Calling it produces the same
|
||||
// elements in place, and the scroll position is simply never disturbed.
|
||||
// (Safe because RDAPanel holds no hooks of its own — see PanelHost.)
|
||||
awards: () => (<div className="space-y-6"><AwardsSelectionPanel profile={activeProfile ?? undefined} />{RDAPanel()}</div>),
|
||||
cat: CATPanel,
|
||||
rotator: RotatorPanel,
|
||||
winkeyer: WinkeyerPanel,
|
||||
|
||||
@@ -150,7 +150,7 @@ const en: Dict = {
|
||||
'sec.email': 'E-mail (SMTP)', 'sec.lookup': 'Callsign Lookup',
|
||||
'sec.ftx': 'FTx decodes', 'ftx.hint': 'What OpsLog does on its own with the digital decode stream.', 'ftx.enable': 'Auto-call', 'ftx.enableHint': 'answer a decode without clicking it', 'ftx.callWhen': 'Call a station that is:', 'ftx.watch': 'Watch list', 'ftx.watchHint': 'One callsign per line, wildcards allowed (4S7*, */P). A watched station is answered ahead of the criteria above.', 'ftx.watchOnlyIf': 'but only if it is also:', 'ftx.cooldown': 'Ignore a callsign for', 'ftx.warn': 'This keys your transmitter without asking. It answers CQ only, never while you are already transmitting, one station at a time, and every call is written to the log file with its reason. Halt stops it.', 'ftx.c_dxcc': 'a new DXCC entity', 'ftx.c_bandmode': 'a new band AND a new mode for the entity', 'ftx.c_band': 'a new band for the entity', 'ftx.c_mode': 'a new mode for the entity', 'ftx.c_slot': 'a new slot (band+mode never worked together)', 'ftx.c_grid': 'a new grid square', 'ftx.c_county': 'a new US county', 'ftx.c_pota': 'a new POTA park', 'ftx.c_pfx': 'a new WPX prefix',
|
||||
'sec.bands': 'Bands', 'sec.satellites': 'Satellites', 'sat.hint': 'The satellites this station works. They are offered as a dropdown on the satellite fields, in alphabetical order.', 'sat.listLabel': 'One satellite per line', 'sat.listHint': 'Written into SAT_NAME exactly as spelled here, so use the name LoTW and the awards expect — AO-91, not AO91. Leaving the list empty simply keeps the field a plain text box.', 'sec.modes': 'Modes & default RST', 'sec.cluster': 'DX Cluster',
|
||||
'sec.udp': 'Connections', 'sec.database': 'Database', 'sec.autostart': 'Autostart', 'sec.backup': 'Database backup', 'sec.uscounties': 'US Counties', 'nav.maintenance': 'Maintenance', 'sec.databases': 'Databases', 'db.hint': 'The reference data OpsLog keeps on disk. One line each, with what it holds and when it was last refreshed.', 'db.update': 'Update', 'db.never': 'never downloaded', 'db.cty': 'Country file (cty.dat)', 'db.ctyDetail': '{n} entities · file dated {d}', 'db.clublog': 'Club Log country exceptions', 'db.clublogDetail': '{n} exceptions · {d}', 'db.lotwUsers': 'LoTW users', 'db.lotwDetail': '{n} callsigns · {d}', 'db.scp': 'Super Check Partial (MASTER.SCP)', 'db.scpDetail': '{n} callsigns · {d}', 'db.uls': 'US counties (FCC ULS)', 'db.ulsDetail': '{n} callsigns · {d}', 'db.rda': 'Russian districts (RDA)', 'db.rdaDetail': '{n} callsigns, with their dated activity periods', 'db.rdaNote': 'built in', 'db.refLists': 'Award reference lists', 'db.refListsHint': 'Only the awards with an online source appear here; the others are shipped or edited by hand.', 'db.refDetail': '{n} references · {d}', 'db.refUpdated': '{code}: {n} references.', 'db.noRefLists': 'No award has an online reference list.', 'sec.rda': 'Russian districts (RDA)', 'rda.hint': 'The offline district database, and the one bulk operation it feeds.', 'rda.dbTitle': 'District database', 'rda.dbCount': '{n} Russian callsigns, each with the district it operates from and, where it moved, the dated periods it operated from each one. Built into OpsLog — nothing to download.', 'rda.backfillTitle': 'Fill the district on existing QSOs', 'rda.backfillIntro': 'Goes through every contact with a Russian entity and assigns its RDA reference, using the district the station was in ON THE DAY of the contact.', 'rda.useCurrent': 'Also use the current district for stations with no recorded history', 'rda.useCurrentHint': '(true for the great majority — the database records a history precisely for the callsigns that moved — but it is an assumption, not a dated fact)', 'rda.backfillRun': 'Fill districts', 'rda.backfillDone': '{s} Russian QSOs — {d} from a dated record, {c} from the current district, {u} unknown, {k} already had one.', 'rda.cmpTitle': 'Compare the two district sources', 'rda.cmpRunning': 'Comparing…', 'rda.cmpNoConflict': 'No disagreement — both sources say the same district everywhere.', 'rda.cmpNoRussian': 'No Russian contacts to compare.', 'rda.backfillRunning': 'Filling…', 'rda.cmpRun': 'Compare', 'rda.cmpDone': '{s} Russian QSOs — {a} identical, {d} differ, {l} only in the log, {b} only in the database', 'rda.cmpCall': 'Callsign', 'rda.cmpDate': 'Date', 'rda.cmpFromLog': 'Log (CNTY)', 'rda.cmpFromDb': 'RDA database', 'rda.cmpListHint': 'Showing {n} of {d} — click a callsign to open the contact.', 'rda.cmpOpen': 'Open this QSO', 'rda.cmpKind': 'Database', 'rda.cmpDated': 'dated', 'rda.cmpCurrent': 'current', 'rda.neverOverwrites': 'A reference you assigned by hand is never overwritten.',
|
||||
'sec.udp': 'Connections', 'sec.database': 'Database', 'sec.autostart': 'Autostart', 'sec.backup': 'Database backup', 'sec.uscounties': 'US Counties', 'nav.maintenance': 'Maintenance', 'sec.databases': 'Databases', 'db.hint': 'The reference data OpsLog keeps on disk. One line each, with what it holds and when it was last refreshed.', 'db.update': 'Update', 'db.never': 'never downloaded', 'db.cty': 'Country file (cty.dat)', 'db.ctyDetail': '{n} entities · file dated {d}', 'db.clublog': 'Club Log country exceptions', 'db.clublogDetail': '{n} exceptions · {d}', 'db.lotwUsers': 'LoTW users', 'db.lotwDetail': '{n} callsigns · {d}', 'db.scp': 'Super Check Partial (MASTER.SCP)', 'db.scpDetail': '{n} callsigns · {d}', 'db.uls': 'US counties (FCC ULS)', 'db.ulsDetail': '{n} callsigns · {d}', 'db.rda': 'Russian districts (RDA)', 'db.rdaDetail': '{n} callsigns, with their dated activity periods', 'db.rdaNote': 'built in', 'db.refLists': 'Award reference lists', 'db.refListsHint': 'Only the awards with an online source appear here; the others are shipped or edited by hand.', 'db.refDetail': '{n} references · {d}', 'db.refUpdated': '{code}: {n} references.', 'db.noRefLists': 'No award has an online reference list.', 'sec.rda': 'Russian districts (RDA)', 'rda.hint': 'The offline district database, and the one bulk operation it feeds.', 'rda.dbTitle': 'District database', 'rda.dbCount': '{n} Russian callsigns, each with the district it operates from and, where it moved, the dated periods it operated from each one. Built into OpsLog — nothing to download.', 'rda.backfillTitle': 'Fill the district on existing QSOs', 'rda.backfillIntro': 'Goes through every contact with a Russian entity and assigns its RDA reference, using the district the station was in ON THE DAY of the contact.', 'rda.useCurrent': 'Also use the current district for stations with no recorded history', 'rda.useCurrentHint': '(true for the great majority — the database records a history precisely for the callsigns that moved — but it is an assumption, not a dated fact)', 'rda.backfillRun': 'Fill districts', 'rda.backfillDone': '{s} Russian QSOs — {d} from a dated record, {c} from the current district, {u} unknown, {k} already had one.', 'rda.cmpTitle': 'Compare the two district sources', 'rda.cmpRunning': 'Comparing…', 'rda.cmpNoConflict': 'No disagreement — both sources say the same district everywhere.', 'rda.cmpNoRussian': 'No Russian contacts to compare.', 'rda.backfillRunning': 'Filling…', 'rda.cmpRun': 'Compare', 'rda.cmpDone': '{s} Russian QSOs — {a} identical, {d} differ, {l} only in the log, {b} only in the database', 'rda.cmpCall': 'Callsign', 'rda.cmpDate': 'Date', 'rda.cmpFromLog': 'Log (CNTY)', 'rda.cmpFromDb': 'RDA database', 'rda.cmpListHint': 'Showing {n} of {d} — click a callsign to open the contact.', 'rda.cmpOpen': 'Open this QSO', 'rda.cmpKind': 'Database', 'rda.cmpDated': 'dated', 'rda.cmpCurrent': 'current', 'rda.neverOverwrites': 'A reference you assigned by hand is never overwritten.', 'rda.cmpKeep': "Keep", 'rda.cmpKeepLog': "Keep the log's district for this contact", 'rda.cmpKeepDb': "Keep the database's district for this contact", 'rda.cmpApply': "Apply {n} decisions", 'rda.cmpAllDb': "keep the database everywhere", 'rda.cmpAllLog': "keep the log everywhere", 'rda.cmpClear': "clear the decisions", 'rda.cmpApplyHint': 'The chosen district is written into the contact — into CNTY and as its award reference — so the disagreement is settled and the contact counts for that district. Settled rows leave the list.',
|
||||
'sec.webpublish': 'Web publishing', 'wpub.hint': 'Publishes your log as a file for a website: a standalone HTML page or a CSV, written locally and optionally uploaded by FTP. It is refreshed when you log a QSO and, if you set an interval, on a timer.', 'wpub.enable': 'Publish the log to a file', 'wpub.fileSection': 'The file', 'wpub.format': 'Format', 'wpub.formatHtml': 'HTML page', 'wpub.formatCsv': 'CSV', 'wpub.folder': 'Output folder', 'wpub.browse': 'Browse…', 'wpub.fileName': 'File name', 'wpub.title': 'Page title', 'wpub.titlePh': 'blank = your callsign', 'wpub.count': 'Last N QSOs', 'wpub.every': 'Refresh every', 'wpub.everyHint': 'minutes — 0 = only when a QSO is logged', 'wpub.columns': 'Columns', 'wpub.columnsCount': '{n} of {total} chosen', 'wpub.columnsPick': 'Choose columns…', 'wpub.columnsSearch': 'Search a field…', 'wpub.removeColumn': 'Click to remove', 'wpub.columnsHint': 'Click to add or remove. The order shown here is the order in the file.', 'wpub.ftpEnable': 'Upload by FTP', 'wpub.ftpHost': 'Server / port', 'wpub.ftpUser': 'User', 'wpub.ftpPassword': 'Password', 'wpub.ftpFolder': 'Remote folder', 'wpub.ftpFileName': 'Remote file name', 'wpub.ftpTls': 'Use TLS (FTPS)', 'wpub.publishNow': 'Publish now', 'wpub.testFtp': 'Test connection', 'wpub.lastRun': 'Last run:', 'sec.adifmon': 'ADIF monitor',
|
||||
'sec.foldersync': 'Sync across PCs', 'sync.hint': 'Point every OpsLog at the SAME folder — one your PCs already synchronise (Seafile, OneDrive, Dropbox, a NAS share). Each machine writes what it logs there and reads the others; the databases themselves are never shared.', 'sync.enable': 'Keep my contacts in step across my PCs', 'sync.machine': 'This PC', 'sync.folder': 'Folder', 'sync.choose': 'Choose…', 'sync.state': 'State', 'sync.thisPc': 'This PC', 'sync.lastSync': 'Last check', 'sync.sent': 'Sent', 'sync.received': 'Received', 'sync.never': 'never', 'sync.noPeers': 'No other PC has written to this folder yet.', 'sync.behind': 'new contacts waiting', 'sync.now': 'Synchronise now', 'sync.applied': '{n} change(s) taken from the folder.', 'sync.saved': 'Saved.',
|
||||
'adifmon.hint': 'Watch external ADIF files and import new QSOs automatically — e.g. fldigi logging RTTY, or N1MM/VarAC. Imported QSOs are enriched, de-duplicated and uploaded to your external services just like a QSO logged here.',
|
||||
@@ -636,7 +636,7 @@ const fr: Dict = {
|
||||
'sec.email': 'E-mail (SMTP)', 'sec.lookup': "Recherche d'indicatif",
|
||||
'sec.ftx': 'Décodages FTx', 'ftx.hint': 'Ce qu’OpsLog fait de lui-même avec le flux de décodages numériques.', 'ftx.enable': 'Appel automatique', 'ftx.enableHint': 'répondre à un décodage sans cliquer', 'ftx.callWhen': 'Appeler une station qui est :', 'ftx.watch': 'Liste de surveillance', 'ftx.watchHint': 'Un indicatif par ligne, jokers acceptés (4S7*, */P). Une station surveillée est appelée avant les critères ci-dessus.', 'ftx.watchOnlyIf': 'mais seulement si elle est aussi :', 'ftx.cooldown': 'Ignorer un indicatif pendant', 'ftx.warn': 'Ceci met ton émetteur en marche sans te demander. Uniquement sur un CQ, jamais pendant que tu émets déjà, une station à la fois, et chaque appel est écrit dans le journal avec sa raison. Stop l’interrompt.', 'ftx.c_dxcc': 'une nouvelle entité DXCC', 'ftx.c_bandmode': 'une nouvelle bande ET un nouveau mode pour l’entité', 'ftx.c_band': 'une nouvelle bande pour l’entité', 'ftx.c_mode': 'un nouveau mode pour l’entité', 'ftx.c_slot': 'un nouveau slot (bande+mode jamais faits ensemble)', 'ftx.c_grid': 'un nouveau carré locator', 'ftx.c_county': 'un nouveau comté US', 'ftx.c_pota': 'un nouveau parc POTA', 'ftx.c_pfx': 'un nouveau préfixe WPX',
|
||||
'sec.bands': 'Bandes', 'sec.satellites': 'Satellites', 'sat.hint': "Les satellites que cette station travaille. Ils sont proposés en liste déroulante sur les champs satellite, par ordre alphabétique.", 'sat.listLabel': 'Un satellite par ligne', 'sat.listHint': "Inscrit dans SAT_NAME exactement tel qu'écrit ici : utilise le nom attendu par LoTW et les diplômes — AO-91, pas AO91. Une liste vide laisse simplement le champ en saisie libre.", 'sec.modes': 'Modes & RST par défaut', 'sec.cluster': 'DX Cluster',
|
||||
'sec.udp': 'Connexions', 'sec.database': 'Base de données', 'sec.autostart': 'Démarrage auto', 'sec.backup': 'Sauvegarde base', 'sec.uscounties': 'Comtés US', 'nav.maintenance': 'Maintenance', 'sec.databases': 'Bases de données', 'db.hint': 'Les données de référence qu’OpsLog garde sur disque. Une ligne chacune, avec ce qu’elle contient et sa dernière actualisation.', 'db.update': 'Mettre à jour', 'db.never': 'jamais téléchargée', 'db.cty': 'Fichier pays (cty.dat)', 'db.ctyDetail': '{n} entités · fichier daté du {d}', 'db.clublog': 'Exceptions pays Club Log', 'db.clublogDetail': '{n} exceptions · {d}', 'db.lotwUsers': 'Utilisateurs LoTW', 'db.lotwDetail': '{n} indicatifs · {d}', 'db.scp': 'Super Check Partial (MASTER.SCP)', 'db.scpDetail': '{n} indicatifs · {d}', 'db.uls': 'Comtés US (FCC ULS)', 'db.ulsDetail': '{n} indicatifs · {d}', 'db.rda': 'Districts russes (RDA)', 'db.rdaDetail': '{n} indicatifs, avec leurs périodes d’activité datées', 'db.rdaNote': 'intégrée', 'db.refLists': 'Listes de références des diplômes', 'db.refListsHint': 'Seuls les diplômes ayant une source en ligne apparaissent ici ; les autres sont livrés ou édités à la main.', 'db.refDetail': '{n} références · {d}', 'db.refUpdated': '{code} : {n} références.', 'db.noRefLists': 'Aucun diplôme n’a de liste de références en ligne.', 'sec.rda': 'Districts russes (RDA)', 'rda.hint': 'La base de districts hors ligne, et l’unique opération de masse qu’elle alimente.', 'rda.dbTitle': 'Base des districts', 'rda.dbCount': '{n} indicatifs russes, chacun avec le district d’où il émet et, pour ceux qui ont déménagé, les périodes datées passées dans chacun. Intégrée à OpsLog — rien à télécharger.', 'rda.backfillTitle': 'Renseigner le district sur les QSO existants', 'rda.backfillIntro': 'Parcourt tous les contacts avec une entité russe et attribue leur référence RDA, en utilisant le district où se trouvait la station LE JOUR du contact.', 'rda.useCurrent': 'Utiliser aussi le district actuel pour les stations sans historique connu', 'rda.useCurrentHint': '(vrai pour la grande majorité — la base enregistre un historique justement pour les indicatifs qui ont bougé — mais c’est une supposition, pas un fait daté)', 'rda.backfillRun': 'Renseigner les districts', 'rda.backfillDone': '{s} QSO russes — {d} depuis une période datée, {c} depuis le district actuel, {u} inconnus, {k} en avaient déjà un.', 'rda.cmpTitle': 'Comparer les deux sources de district', 'rda.cmpRunning': 'Comparaison…', 'rda.cmpNoConflict': 'Aucune divergence — les deux sources donnent partout le même district.', 'rda.cmpNoRussian': 'Aucun contact russe à comparer.', 'rda.backfillRunning': 'Remplissage…', 'rda.cmpRun': 'Comparer', 'rda.cmpDone': '{s} QSO russes — {a} identiques, {d} divergents, {l} seulement dans le log, {b} seulement dans la base', 'rda.cmpCall': 'Indicatif', 'rda.cmpDate': 'Date', 'rda.cmpFromLog': 'Log (CNTY)', 'rda.cmpFromDb': 'Base RDA', 'rda.cmpListHint': '{n} affichés sur {d} — cliquer un indicatif ouvre le contact.', 'rda.cmpOpen': 'Ouvrir ce QSO', 'rda.cmpKind': 'Base', 'rda.cmpDated': 'daté', 'rda.cmpCurrent': 'courant', 'rda.neverOverwrites': 'Une référence attribuée à la main n’est jamais écrasée.',
|
||||
'sec.udp': 'Connexions', 'sec.database': 'Base de données', 'sec.autostart': 'Démarrage auto', 'sec.backup': 'Sauvegarde base', 'sec.uscounties': 'Comtés US', 'nav.maintenance': 'Maintenance', 'sec.databases': 'Bases de données', 'db.hint': 'Les données de référence qu’OpsLog garde sur disque. Une ligne chacune, avec ce qu’elle contient et sa dernière actualisation.', 'db.update': 'Mettre à jour', 'db.never': 'jamais téléchargée', 'db.cty': 'Fichier pays (cty.dat)', 'db.ctyDetail': '{n} entités · fichier daté du {d}', 'db.clublog': 'Exceptions pays Club Log', 'db.clublogDetail': '{n} exceptions · {d}', 'db.lotwUsers': 'Utilisateurs LoTW', 'db.lotwDetail': '{n} indicatifs · {d}', 'db.scp': 'Super Check Partial (MASTER.SCP)', 'db.scpDetail': '{n} indicatifs · {d}', 'db.uls': 'Comtés US (FCC ULS)', 'db.ulsDetail': '{n} indicatifs · {d}', 'db.rda': 'Districts russes (RDA)', 'db.rdaDetail': '{n} indicatifs, avec leurs périodes d’activité datées', 'db.rdaNote': 'intégrée', 'db.refLists': 'Listes de références des diplômes', 'db.refListsHint': 'Seuls les diplômes ayant une source en ligne apparaissent ici ; les autres sont livrés ou édités à la main.', 'db.refDetail': '{n} références · {d}', 'db.refUpdated': '{code} : {n} références.', 'db.noRefLists': 'Aucun diplôme n’a de liste de références en ligne.', 'sec.rda': 'Districts russes (RDA)', 'rda.hint': 'La base de districts hors ligne, et l’unique opération de masse qu’elle alimente.', 'rda.dbTitle': 'Base des districts', 'rda.dbCount': '{n} indicatifs russes, chacun avec le district d’où il émet et, pour ceux qui ont déménagé, les périodes datées passées dans chacun. Intégrée à OpsLog — rien à télécharger.', 'rda.backfillTitle': 'Renseigner le district sur les QSO existants', 'rda.backfillIntro': 'Parcourt tous les contacts avec une entité russe et attribue leur référence RDA, en utilisant le district où se trouvait la station LE JOUR du contact.', 'rda.useCurrent': 'Utiliser aussi le district actuel pour les stations sans historique connu', 'rda.useCurrentHint': '(vrai pour la grande majorité — la base enregistre un historique justement pour les indicatifs qui ont bougé — mais c’est une supposition, pas un fait daté)', 'rda.backfillRun': 'Renseigner les districts', 'rda.backfillDone': '{s} QSO russes — {d} depuis une période datée, {c} depuis le district actuel, {u} inconnus, {k} en avaient déjà un.', 'rda.cmpTitle': 'Comparer les deux sources de district', 'rda.cmpRunning': 'Comparaison…', 'rda.cmpNoConflict': 'Aucune divergence — les deux sources donnent partout le même district.', 'rda.cmpNoRussian': 'Aucun contact russe à comparer.', 'rda.backfillRunning': 'Remplissage…', 'rda.cmpRun': 'Comparer', 'rda.cmpDone': '{s} QSO russes — {a} identiques, {d} divergents, {l} seulement dans le log, {b} seulement dans la base', 'rda.cmpCall': 'Indicatif', 'rda.cmpDate': 'Date', 'rda.cmpFromLog': 'Log (CNTY)', 'rda.cmpFromDb': 'Base RDA', 'rda.cmpListHint': '{n} affichés sur {d} — cliquer un indicatif ouvre le contact.', 'rda.cmpOpen': 'Ouvrir ce QSO', 'rda.cmpKind': 'Base', 'rda.cmpDated': 'daté', 'rda.cmpCurrent': 'courant', 'rda.neverOverwrites': 'Une référence attribuée à la main n’est jamais écrasée.', 'rda.cmpKeep': "Garder", 'rda.cmpKeepLog': "Garder le district du log pour ce contact", 'rda.cmpKeepDb': "Garder le district de la base pour ce contact", 'rda.cmpApply': "Appliquer {n} décisions", 'rda.cmpAllDb': "garder la base partout", 'rda.cmpAllLog': "garder le log partout", 'rda.cmpClear': "effacer les décisions", 'rda.cmpApplyHint': "Le district choisi est écrit dans le contact — dans CNTY et comme référence de diplôme — donc la divergence est réglée et le contact compte pour ce district. Les lignes réglées quittent la liste.",
|
||||
'sec.webpublish': 'Publication web', 'wpub.hint': "Publie ton journal dans un fichier destiné à un site web : une page HTML autonome ou un CSV, écrit en local et envoyé par FTP si tu le souhaites. Il est rafraîchi à chaque QSO enregistré et, si tu règles un intervalle, périodiquement.", 'wpub.enable': 'Publier le journal dans un fichier', 'wpub.fileSection': 'Le fichier', 'wpub.format': 'Format', 'wpub.formatHtml': 'Page HTML', 'wpub.formatCsv': 'CSV', 'wpub.folder': 'Dossier de sortie', 'wpub.browse': 'Parcourir…', 'wpub.fileName': 'Nom du fichier', 'wpub.title': 'Titre de la page', 'wpub.titlePh': 'vide = ton indicatif', 'wpub.count': 'N derniers QSO', 'wpub.every': 'Rafraîchir toutes les', 'wpub.everyHint': 'minutes — 0 = seulement à chaque QSO', 'wpub.columns': 'Colonnes', 'wpub.columnsCount': '{n} sur {total} choisis', 'wpub.columnsPick': 'Choisir les colonnes…', 'wpub.columnsSearch': 'Chercher un champ…', 'wpub.removeColumn': 'Cliquer pour retirer', 'wpub.columnsHint': 'Clique pour ajouter ou retirer. L ordre affiché ici est celui du fichier.', 'wpub.ftpEnable': 'Envoyer par FTP', 'wpub.ftpHost': 'Serveur / port', 'wpub.ftpUser': 'Utilisateur', 'wpub.ftpPassword': 'Mot de passe', 'wpub.ftpFolder': 'Dossier distant', 'wpub.ftpFileName': 'Nom du fichier distant', 'wpub.ftpTls': 'Utiliser TLS (FTPS)', 'wpub.publishNow': 'Publier maintenant', 'wpub.testFtp': 'Tester la connexion', 'wpub.lastRun': 'Dernière exécution :', 'sec.adifmon': 'Moniteur ADIF',
|
||||
'sec.foldersync': 'Synchro entre PC', 'sync.hint': 'Fais pointer chaque OpsLog vers le MÊME dossier — un dossier que tes PC synchronisent déjà (Seafile, OneDrive, Dropbox, un partage NAS). Chaque machine y écrit ce qu’elle enregistre et lit celui des autres ; les bases de données, elles, ne sont jamais partagées.', 'sync.enable': 'Garder mes contacts à jour sur tous mes PC', 'sync.machine': 'Ce PC', 'sync.folder': 'Dossier', 'sync.choose': 'Choisir…', 'sync.state': 'État', 'sync.thisPc': 'Ce PC', 'sync.lastSync': 'Dernière vérification', 'sync.sent': 'Envoyés', 'sync.received': 'Reçus', 'sync.never': 'jamais', 'sync.noPeers': 'Aucun autre PC n’a encore écrit dans ce dossier.', 'sync.behind': 'nouveaux contacts en attente', 'sync.now': 'Synchroniser maintenant', 'sync.applied': '{n} changement(s) repris du dossier.', 'sync.saved': 'Enregistré.',
|
||||
'adifmon.hint': "Surveille des fichiers ADIF externes et importe les nouveaux QSO automatiquement — ex. fldigi en RTTY, ou N1MM/VarAC. Les QSO importés sont enrichis, dédoublonnés et envoyés à tes services externes comme un QSO loggé ici.",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Single source of truth for the app version shown in the UI (header + About).
|
||||
// Bump this on a release (the release script updates it alongside telemetry.go).
|
||||
export const APP_VERSION = '0.26.14';
|
||||
export const APP_VERSION = '0.26.17';
|
||||
|
||||
// Author / credits, shown in Help -> About.
|
||||
export const APP_AUTHOR = 'F4BPO';
|
||||
|
||||
Vendored
+2
@@ -65,6 +65,8 @@ export function ApplyAwardPreset(arg1:string,arg2:string):Promise<number>;
|
||||
|
||||
export function ApplyAwardUpdate(arg1:string):Promise<void>;
|
||||
|
||||
export function ApplyRDAChoices(arg1:Array<main.RDAChoice>):Promise<main.RDAApplyResult>;
|
||||
|
||||
export function AssignAwardRefToQSOs(arg1:string,arg2:string,arg3:Array<number>):Promise<number>;
|
||||
|
||||
export function AudioApplyLevels(arg1:number,arg2:number):Promise<void>;
|
||||
|
||||
@@ -70,6 +70,10 @@ export function ApplyAwardUpdate(arg1) {
|
||||
return window['go']['main']['App']['ApplyAwardUpdate'](arg1);
|
||||
}
|
||||
|
||||
export function ApplyRDAChoices(arg1) {
|
||||
return window['go']['main']['App']['ApplyRDAChoices'](arg1);
|
||||
}
|
||||
|
||||
export function AssignAwardRefToQSOs(arg1, arg2, arg3) {
|
||||
return window['go']['main']['App']['AssignAwardRefToQSOs'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
@@ -3349,6 +3349,36 @@ export namespace main {
|
||||
this.team_last60 = source["team_last60"];
|
||||
}
|
||||
}
|
||||
export class RDAApplyResult {
|
||||
applied: number;
|
||||
failed: number;
|
||||
message: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new RDAApplyResult(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.applied = source["applied"];
|
||||
this.failed = source["failed"];
|
||||
this.message = source["message"];
|
||||
}
|
||||
}
|
||||
export class RDAChoice {
|
||||
qso_id: number;
|
||||
district: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new RDAChoice(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.qso_id = source["qso_id"];
|
||||
this.district = source["district"];
|
||||
}
|
||||
}
|
||||
export class RDAConflict {
|
||||
qso_id: number;
|
||||
callsign: string;
|
||||
|
||||
@@ -157,7 +157,21 @@ func (m *Manager) Play(deviceID, path string, gainPct int) error {
|
||||
// instantly, the PTT is released 120 ms later, and NOTHING says why —
|
||||
// which is exactly what a station heard as "it plays once, then never
|
||||
// again": the call succeeded, the sound did not.
|
||||
if err := playPCM(deviceID, pcm, rate, ch, bits, stop); err != nil {
|
||||
play := func() error { return playPCM(deviceID, pcm, rate, ch, bits, stop) }
|
||||
if deviceID == NetworkDeviceID {
|
||||
// Straight to the radio over its own link. Decided HERE rather than
|
||||
// inside playPCM because there is no Windows endpoint to open: asked
|
||||
// for one, the system complains about a missing device instead of
|
||||
// saying the true thing, which is that no radio is connected.
|
||||
fn := networkPlayer()
|
||||
play = func() error {
|
||||
if fn == nil {
|
||||
return errNoNetworkRadio
|
||||
}
|
||||
return fn(pcm, rate, ch, bits, stop)
|
||||
}
|
||||
}
|
||||
if err := play(); err != nil {
|
||||
LogSink("audio: playback on %q failed: %v", DeviceName(deviceID), err)
|
||||
}
|
||||
m.mu.Lock()
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package audio
|
||||
|
||||
// Playing a message through the RADIO instead of a sound card.
|
||||
//
|
||||
// A SunSDR takes its transmit audio over TCI, on the same socket as the
|
||||
// commands, so the voice keyer can hand it the message directly: no virtual
|
||||
// cable, no second sound card, no Windows mixer between the recording and the
|
||||
// air. To everything above, that radio is simply another output device.
|
||||
//
|
||||
// The device it presents itself as is a name rather than a WASAPI endpoint id,
|
||||
// which is why Play checks for it before opening anything: there is no endpoint
|
||||
// to open, and asking Windows for one produces a confusing error about a device
|
||||
// that does not exist rather than the truth, which is that nothing is connected
|
||||
// to the radio.
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// NetworkDeviceID is the id the radio-over-network output carries in the
|
||||
// settings and in the device lists. A fixed string, not a Windows endpoint id:
|
||||
// it is chosen by us and must survive a radio being switched off and on.
|
||||
const NetworkDeviceID = "net:radio"
|
||||
|
||||
// NetworkPlayer sends already-decoded PCM to the radio, returning when the
|
||||
// message has been played or when stop is closed.
|
||||
//
|
||||
// It carries the same arguments as the sound-card path so that Play can hand
|
||||
// over whatever it read, and the radio can decide what converting it needs —
|
||||
// the sample rate a WAV was recorded at is not the radio's business until the
|
||||
// moment it has to be resampled.
|
||||
type NetworkPlayer func(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error
|
||||
|
||||
var (
|
||||
netMu sync.RWMutex
|
||||
netPlayer NetworkPlayer
|
||||
)
|
||||
|
||||
// SetNetworkPlayer installs (or clears, with nil) the radio's transmit path.
|
||||
//
|
||||
// Package-level rather than per-Manager: there is one radio, the CAT backend
|
||||
// owns it, and a Manager that happened to be built before the radio connected
|
||||
// would otherwise be permanently unable to reach it.
|
||||
func SetNetworkPlayer(fn NetworkPlayer) {
|
||||
netMu.Lock()
|
||||
netPlayer = fn
|
||||
netMu.Unlock()
|
||||
}
|
||||
|
||||
// networkPlayer returns the installed player, or nil.
|
||||
func networkPlayer() NetworkPlayer {
|
||||
netMu.RLock()
|
||||
defer netMu.RUnlock()
|
||||
return netPlayer
|
||||
}
|
||||
|
||||
// NetworkPlayerReady says whether a radio is currently able to take transmit
|
||||
// audio, so the settings panel can offer the option honestly rather than
|
||||
// listing a device that would fail when used.
|
||||
func NetworkPlayerReady() bool { return networkPlayer() != nil }
|
||||
|
||||
// errNoNetworkRadio is what a message played to a radio that is not there
|
||||
// comes back with. Named, because "the device could not be opened" would send
|
||||
// an operator hunting through Windows sound settings for a device that never
|
||||
// existed.
|
||||
var errNoNetworkRadio = errors.New("no radio is connected to take the audio — check the CAT link (the radio output only works with a TCI radio)")
|
||||
@@ -0,0 +1,9 @@
|
||||
package audio
|
||||
|
||||
// RecorderSampleRate is the rate the QSO recorder works in.
|
||||
//
|
||||
// Exported because a source that is NOT a sound card — the TCI receive stream,
|
||||
// the Icom network audio — has to resample into it, and hard-coding 16000 at
|
||||
// each of those call sites is how one of them ends up at the wrong speed after
|
||||
// this constant is ever changed.
|
||||
const RecorderSampleRate = sampleRate
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
// any device regardless of its native mix format.
|
||||
const (
|
||||
sampleRate = 16000
|
||||
|
||||
channels = 1
|
||||
bitsPerSample = 16
|
||||
blockAlign = channels * bitsPerSample / 8 // bytes per frame (=2)
|
||||
|
||||
@@ -15,6 +15,10 @@ package cat
|
||||
// good match on a bad antenna. So the raw answers are LOGGED, for a real
|
||||
// radio to settle, and until then the panel says the scaling is provisional.
|
||||
//
|
||||
// SWR is settled: SW; answers three digits in tenths of a ratio ("SW023;" =
|
||||
// 2.3:1), from Elecraft's release note. The power meter is still read from the
|
||||
// bargraph and still provisional.
|
||||
//
|
||||
// The same discipline as the Yaesu meters, which were guessed wrong twice and
|
||||
// only settled when an FTDX10 keyed a carrier at two known power levels.
|
||||
|
||||
@@ -309,7 +313,9 @@ func kenwoodAGCValue(name string) int {
|
||||
// answered and what it said, next to the power SETTING: the meter that tracks a
|
||||
// known carrier at two different power levels is the power meter, and no amount
|
||||
// of reading the reference settles that as well as one transmission does.
|
||||
var kenwoodMeterProbes = []string{"SM;", "SMH;", "BG;", "SW;", "PO;", "TQ;"}
|
||||
// SW is no longer among them: it is known, read above, and asking again during
|
||||
// a transmission costs a round trip on the one link the carrier depends on.
|
||||
var kenwoodMeterProbes = []string{"SM;", "SMH;", "BG;", "PO;", "TQ;"}
|
||||
|
||||
// readTXMeters reads the transmit meters.
|
||||
func (k *Kenwood) readTXMeters() {
|
||||
@@ -321,10 +327,12 @@ func (k *Kenwood) readTXMeters() {
|
||||
if v, ok := k.askNum("BG;", "BG", 2); ok {
|
||||
k.panel.PowerMeter = k.powerPeak.update(kenwoodBargraphPercent(v), now)
|
||||
}
|
||||
if v, ok := k.askNum("SW;", "SW", 4); ok {
|
||||
// SW; — SETTLED, from Elecraft's own release note: three digits, tenths of a
|
||||
// ratio. "SW023;" is 2.3:1, and "SW999;" is the 99.9:1 it reports instead of
|
||||
// infinity. This was reading FOUR digits, so every answer failed to parse
|
||||
// and the bar stayed empty — which is why a tester saw no SWR at all.
|
||||
if v, ok := k.askNum("SW;", "SW", 3); ok {
|
||||
k.panel.SWRRaw = v
|
||||
// Tenths of a ratio, provisionally: 15 → 1.5. Reported as raw as well,
|
||||
// so the log can correct this without anyone having to trust the bar.
|
||||
if v > 0 {
|
||||
k.panel.SWR = float64(k.swrPeak.update(v, now)) / 10
|
||||
}
|
||||
|
||||
+94
-2
@@ -34,6 +34,16 @@ type TCI struct {
|
||||
OnSpotClick func(callsign string, freqHz int64)
|
||||
unhandledSeen map[string]bool // log each unknown TCI message type once
|
||||
|
||||
// audio holds the receive-audio stream — see tci_audio.go. TCI carries it
|
||||
// on this same WebSocket, which is what lets a SunSDR record and decode
|
||||
// without a virtual audio cable in the way.
|
||||
audio tciAudio
|
||||
|
||||
// One writer at a time. send() held the lock only long enough to READ conn,
|
||||
// which was enough while every command came from the poll loop — a stream of
|
||||
// audio frames from a second goroutine is not, and gorilla panics on a
|
||||
// concurrent write rather than corrupting the socket quietly.
|
||||
wmu sync.Mutex // serialises writes to the socket (text AND binary)
|
||||
mu sync.Mutex // guards conn + writes + state
|
||||
conn *websocket.Conn
|
||||
dialCancel context.CancelFunc // cancels an in-flight Connect dial (Interrupt/Stop)
|
||||
@@ -56,7 +66,14 @@ type TCI struct {
|
||||
// txAllowedKnown keeps an OLDER ExpertSDR, or a TCI-compatible program that
|
||||
// never sends TX_ENABLE at all, from being treated as refusing: without a
|
||||
// word from the radio we key and let it decide.
|
||||
txAllowed bool
|
||||
txAllowed bool
|
||||
// txSource is the TRX third argument: "tci" while OpsLog has audio to send,
|
||||
// empty for the operator's microphone. See SetPTT.
|
||||
txSource string
|
||||
// drive is the radio's transmit drive, 0-100. Kept because a quiet
|
||||
// transmission has two possible causes — our level or the radio's — and a
|
||||
// log that names both settles it in one line instead of an evening.
|
||||
drive int
|
||||
txAllowedKnown bool
|
||||
|
||||
lastSig string // last logged state signature (log only on change)
|
||||
@@ -330,9 +347,49 @@ func (t *TCI) SetPTT(on bool) error {
|
||||
"check the frequency is inside a transmit band and that TX is enabled in ExpertSDR")
|
||||
}
|
||||
}
|
||||
// THE THIRD ARGUMENT NAMES THE AUDIO SOURCE, and it is the whole answer to
|
||||
// "why does the radio ignore what I send it".
|
||||
//
|
||||
// TCI 2.0 §TRX: "The signal for transmitting is always taken from the
|
||||
// microphone selected in the ExpertSDR3. If a third-party software connected
|
||||
// via TCI wants to transmit its audio signal, you must specify the third
|
||||
// argument - TCI." Without it the radio never sends a single chrono frame,
|
||||
// whatever the mode and whatever is configured in its window — which is
|
||||
// exactly what a night of experiments showed and misread as "digital modes
|
||||
// only".
|
||||
//
|
||||
// Sent only when a transmission is ours to feed. A plain trx keeps the
|
||||
// operator's own microphone, which is what every other PTT in OpsLog means.
|
||||
t.mu.Lock()
|
||||
src := t.txSource
|
||||
t.mu.Unlock()
|
||||
if on && src != "" {
|
||||
return t.send(fmt.Sprintf("trx:0,true,%s;", src))
|
||||
}
|
||||
return t.send(fmt.Sprintf("trx:0,%t;", on))
|
||||
}
|
||||
|
||||
// SetTXAudioSource says where the radio should take its transmit audio from
|
||||
// while OpsLog keys it: "tci" for the stream this program sends, "" for the
|
||||
// microphone the operator chose in ExpertSDR3.
|
||||
//
|
||||
// Set from the audio settings — it follows the "To radio" device — so keying
|
||||
// for a voice message and keying for anything else behave differently on
|
||||
// purpose: only the first one takes the audio away from the microphone.
|
||||
func (t *TCI) SetTXAudioSource(src string) {
|
||||
t.mu.Lock()
|
||||
changed := t.txSource != src
|
||||
t.txSource = src
|
||||
t.mu.Unlock()
|
||||
if changed {
|
||||
if src == "" {
|
||||
debugLog.Printf("TCI: transmit audio will come from the radio's own microphone")
|
||||
} else {
|
||||
debugLog.Printf("TCI: transmit audio will be taken from %s when OpsLog keys the radio", src)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send writes a command to the WebSocket (one writer at a time).
|
||||
func (t *TCI) send(cmd string) error {
|
||||
t.mu.Lock()
|
||||
@@ -341,6 +398,8 @@ func (t *TCI) send(cmd string) error {
|
||||
if c == nil {
|
||||
return fmt.Errorf("tci: not connected")
|
||||
}
|
||||
t.wmu.Lock()
|
||||
defer t.wmu.Unlock()
|
||||
_ = c.SetWriteDeadline(time.Now().Add(3 * time.Second))
|
||||
if err := c.WriteMessage(websocket.TextMessage, []byte(cmd)); err != nil {
|
||||
debugLog.Printf("TCI: send %q failed: %v", cmd, err)
|
||||
@@ -354,10 +413,18 @@ func (t *TCI) send(cmd string) error {
|
||||
// connection closes.
|
||||
func (t *TCI) reader(conn *websocket.Conn) {
|
||||
for {
|
||||
_, data, err := conn.ReadMessage()
|
||||
mt, data, err := conn.ReadMessage()
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
// TEXT frames are commands, BINARY frames are streams. The type used to
|
||||
// be ignored and every frame split on ';' — harmless only for as long as
|
||||
// no stream was ever opened, since audio bytes would then have been fed
|
||||
// to the command parser a hundred times a second.
|
||||
if wsMessageIsBinary(mt) {
|
||||
t.handleBinary(data)
|
||||
continue
|
||||
}
|
||||
// A frame may carry several ";"-terminated commands.
|
||||
for _, cmd := range strings.Split(string(data), ";") {
|
||||
t.handle(strings.TrimSpace(cmd))
|
||||
@@ -393,6 +460,16 @@ func (t *TCI) handle(msg string) {
|
||||
switch strings.ToLower(name) {
|
||||
case "device":
|
||||
t.device = strings.TrimSpace(args)
|
||||
// The radio ANNOUNCES its audio format at connect —
|
||||
// "audio_stream_sample_type:float32" and "audio_stream_channels:2" — which
|
||||
// is better evidence than anything derived from a frame, and it arrives
|
||||
// before the first frame does. Both were being logged as unhandled.
|
||||
case "audio_stream_sample_type":
|
||||
t.audio.declaredType = strings.TrimSpace(args)
|
||||
case "audio_stream_channels":
|
||||
if n, err := strconv.Atoi(strings.TrimSpace(args)); err == nil && n > 0 && n <= 8 {
|
||||
t.audio.declaredChans = n
|
||||
}
|
||||
case "ready", "start":
|
||||
t.ready = true
|
||||
case "stop":
|
||||
@@ -421,7 +498,22 @@ func (t *TCI) handle(msg string) {
|
||||
}
|
||||
case "trx":
|
||||
if get(0) == "0" {
|
||||
was := t.tx
|
||||
t.tx = get(1) == "true"
|
||||
// Said out loud, every time. The transmit side of TCI can only be
|
||||
// written from a log of a real transmission, and the first one came
|
||||
// back without a single line to say whether the radio had even been
|
||||
// keyed — which left the interesting question, why no transmit
|
||||
// frames, indistinguishable from nobody having pressed anything.
|
||||
if was != t.tx {
|
||||
t.noteTXTransition(t.tx)
|
||||
}
|
||||
}
|
||||
case "drive":
|
||||
if get(0) == "0" {
|
||||
if v, err := strconv.Atoi(get(1)); err == nil {
|
||||
t.drive = v
|
||||
}
|
||||
}
|
||||
case "tx_enable":
|
||||
if get(0) == "0" {
|
||||
|
||||
@@ -0,0 +1,424 @@
|
||||
//go:build windows
|
||||
|
||||
package cat
|
||||
|
||||
// TCI audio — receiving the radio's audio over the same WebSocket that carries
|
||||
// the commands, so a SunSDR needs no virtual audio cable.
|
||||
//
|
||||
// TCI mixes two kinds of frame on one socket: TEXT frames are the commands
|
||||
// ("trx:0,true;"), BINARY frames are streams. A binary frame is a fixed header
|
||||
// followed by float32 samples:
|
||||
//
|
||||
// uint32 receiver which receiver the stream belongs to
|
||||
// uint32 sampleRate Hz
|
||||
// uint32 format 0 = float32
|
||||
// uint32 codec 0 = uncompressed
|
||||
// uint32 crc unused in practice
|
||||
// uint32 length samples in the payload
|
||||
// uint32 type which stream this is (see tciStream*)
|
||||
// uint32 reserved[9]
|
||||
// float32 payload[…] stereo, interleaved
|
||||
//
|
||||
// The stream is asked for with "audio_samplerate:" then "audio_start:<rx>;",
|
||||
// and stopped with "audio_stop:<rx>;".
|
||||
//
|
||||
// NOTHING HERE IS CONFIRMED ON A RADIO YET. The layout above is read from the
|
||||
// TCI documentation, and the stream-type numbers in particular are the sort of
|
||||
// detail a document gets right and a memory of it does not — so every header is
|
||||
// logged for the first few seconds of a session, and the numbers the radio
|
||||
// actually sends will settle it. Same discipline as the Yaesu meters and the
|
||||
// Flex spot feed: measure on the real thing, then write the constant down.
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
// TCI stream types. RX audio is the one this file consumes; the others are
|
||||
// named so a log line says what arrived rather than "type 3".
|
||||
const (
|
||||
tciStreamIQ = 0
|
||||
tciStreamRXAudio = 1
|
||||
tciStreamTXAudio = 2
|
||||
tciStreamTXChrono = 3
|
||||
)
|
||||
|
||||
// tciHeaderWords is the header length in uint32 words (7 named + 9 reserved).
|
||||
const tciHeaderWords = 16
|
||||
|
||||
// tciHeaderBytes is the same in bytes.
|
||||
const tciHeaderBytes = tciHeaderWords * 4
|
||||
|
||||
// tciAudioProbeMax bounds the header logging. Enough frames to see the shape
|
||||
// and the rate; few enough that an evening of listening does not fill the log.
|
||||
const tciAudioProbeMax = 40
|
||||
|
||||
// TCIAudioStatus is what the panel polls while testing the stream.
|
||||
type TCIAudioStatus struct {
|
||||
Running bool `json:"running"`
|
||||
SampleRate int `json:"sample_rate"`
|
||||
Frames int64 `json:"frames"` // binary frames accepted
|
||||
Samples int64 `json:"samples"` // audio samples decoded
|
||||
// PeakDB is the loudest sample of the last second, in dBFS: the one number
|
||||
// that says "audio is really arriving" rather than "a socket is open".
|
||||
PeakDB float64 `json:"peak_db"`
|
||||
LastErr string `json:"last_err,omitempty"`
|
||||
}
|
||||
|
||||
// tciAudio is the receive-side state, kept on the backend so it lives exactly
|
||||
// as long as the connection does.
|
||||
type tciAudio struct {
|
||||
mu sync.Mutex
|
||||
want bool // the host asked for audio
|
||||
rx int // which receiver
|
||||
rate int
|
||||
frames int64
|
||||
samples int64
|
||||
peak float64
|
||||
peakAt time.Time
|
||||
probeByType map[int]int
|
||||
// countByType counts EVERY frame per stream type, capped by nothing.
|
||||
// The probe above stops logging after forty frames of a type; these keep
|
||||
// counting, so a transmission that produced no transmit frames at all can
|
||||
// be reported as a fact rather than inferred from an absence of lines.
|
||||
countByType map[int]int64
|
||||
lastErr string
|
||||
// widthLogged keeps the one-line note about the sample width to once a
|
||||
// session — it is a fact about the radio, not an event.
|
||||
widthLogged bool
|
||||
// txMark is the per-type frame count when transmission began, so the census
|
||||
// at the end reports the pass rather than the whole session.
|
||||
txMark map[int]int64
|
||||
|
||||
// txFeed supplies the next frame of transmit audio when the radio asks for
|
||||
// one, or is nil when nothing is being sent. Set under this same lock, and
|
||||
// read on the reader goroutine — the radio's request and our answer are two
|
||||
// halves of one exchange and must not straddle a race.
|
||||
txFeed func(samples int) []byte
|
||||
txSent int64
|
||||
txShort int64 // requests the feed could not fill (it had run out)
|
||||
|
||||
// What the radio SAID about its stream at connect (audio_stream_sample_type,
|
||||
// audio_stream_channels). Its own declaration, and it arrives before the
|
||||
// first frame — the frame arithmetic below stays as the check on it rather
|
||||
// than as the only source.
|
||||
declaredType string
|
||||
declaredChans int
|
||||
|
||||
// OnSamples receives decoded MONO samples (the two channels averaged) at
|
||||
// the negotiated rate. Mono because everything downstream — the QSO
|
||||
// recorder, the CW decoder — works on one channel, and a receiver's two
|
||||
// channels carry the same audio.
|
||||
OnSamples func(rate int, samples []float32)
|
||||
}
|
||||
|
||||
// StartTCIAudio asks the radio to stream receiver rx's audio.
|
||||
func (t *TCI) StartTCIAudio(rx, rate int) error {
|
||||
if rate <= 0 {
|
||||
rate = 48000
|
||||
}
|
||||
t.audio.mu.Lock()
|
||||
t.audio.want = true
|
||||
t.audio.rx = rx
|
||||
t.audio.rate = rate
|
||||
t.audio.frames, t.audio.samples, t.audio.peak = 0, 0, 0
|
||||
t.audio.lastErr = ""
|
||||
t.audio.mu.Unlock()
|
||||
|
||||
// Sample rate first: the radio applies it to the stream it is about to
|
||||
// open, and asking afterwards restarts the stream on some firmware.
|
||||
if err := t.send(fmt.Sprintf("audio_samplerate:%d;", rate)); err != nil {
|
||||
return err
|
||||
}
|
||||
// Said rather than assumed. float32 and two channels are the documented
|
||||
// defaults and what this radio streams, but a default is a thing another
|
||||
// program can have changed — they share the radio, not just the protocol —
|
||||
// and a stream arriving in a format the decoder was not expecting is heard
|
||||
// as noise, not as a mistake.
|
||||
_ = t.send("audio_stream_sample_type:float32;")
|
||||
_ = t.send("audio_stream_channels:2;")
|
||||
return t.send(fmt.Sprintf("audio_start:%d;", rx))
|
||||
}
|
||||
|
||||
// SetTCIAudioSink installs (or removes) the consumer of the decoded samples.
|
||||
//
|
||||
// One sink, not a list: today it is a test recording, tomorrow the QSO
|
||||
// recorder, and two consumers of a live stream would need a policy about which
|
||||
// one wins that nothing yet has an opinion about.
|
||||
func (t *TCI) SetTCIAudioSink(fn func(rate int, samples []float32)) {
|
||||
t.audio.mu.Lock()
|
||||
t.audio.OnSamples = fn
|
||||
t.audio.mu.Unlock()
|
||||
}
|
||||
|
||||
// StopTCIAudio closes the stream.
|
||||
func (t *TCI) StopTCIAudio() error {
|
||||
t.audio.mu.Lock()
|
||||
t.audio.want = false
|
||||
rx := t.audio.rx
|
||||
t.audio.mu.Unlock()
|
||||
return t.send(fmt.Sprintf("audio_stop:%d;", rx))
|
||||
}
|
||||
|
||||
// TCIAudioStatus reports what has arrived.
|
||||
func (t *TCI) TCIAudioStatus() TCIAudioStatus {
|
||||
t.audio.mu.Lock()
|
||||
defer t.audio.mu.Unlock()
|
||||
st := TCIAudioStatus{
|
||||
Running: t.audio.want,
|
||||
SampleRate: t.audio.rate,
|
||||
Frames: t.audio.frames,
|
||||
Samples: t.audio.samples,
|
||||
LastErr: t.audio.lastErr,
|
||||
}
|
||||
// A peak older than a second is not a level, it is a memory. Reported as
|
||||
// silence rather than left standing, so a stream that has stopped arriving
|
||||
// looks stopped.
|
||||
if time.Since(t.audio.peakAt) < time.Second && t.audio.peak > 0 {
|
||||
st.PeakDB = 20 * math.Log10(t.audio.peak)
|
||||
} else {
|
||||
st.PeakDB = -99
|
||||
}
|
||||
return st
|
||||
}
|
||||
|
||||
// handleBinary decodes one binary WebSocket frame.
|
||||
//
|
||||
// Called from the reader goroutine. Anything malformed is counted and dropped:
|
||||
// a stream frame is not worth breaking the command connection over, and the
|
||||
// command connection is what keeps the radio usable.
|
||||
func (t *TCI) handleBinary(data []byte) {
|
||||
if len(data) < tciHeaderBytes {
|
||||
t.audioErr(fmt.Sprintf("binary frame of %d bytes is shorter than a header", len(data)))
|
||||
return
|
||||
}
|
||||
le := binary.LittleEndian
|
||||
receiver := int(le.Uint32(data[0:]))
|
||||
rate := int(le.Uint32(data[4:]))
|
||||
format := le.Uint32(data[8:])
|
||||
codec := le.Uint32(data[12:])
|
||||
length := int(le.Uint32(data[20:]))
|
||||
stype := int(le.Uint32(data[24:]))
|
||||
|
||||
// Counted PER STREAM TYPE, not overall.
|
||||
//
|
||||
// A single counter was spent on the first forty receive-audio frames, which
|
||||
// arrive twenty-four times a second — so a transmit-chrono or transmit-audio
|
||||
// frame, the two this needs to see before the voice keyer can be written,
|
||||
// would never have been logged at all. They only appear once the operator
|
||||
// keys the radio, long after any global budget is gone.
|
||||
t.audio.mu.Lock()
|
||||
if t.audio.probeByType == nil {
|
||||
t.audio.probeByType = map[int]int{}
|
||||
}
|
||||
if t.audio.countByType == nil {
|
||||
t.audio.countByType = map[int]int64{}
|
||||
}
|
||||
t.audio.countByType[stype]++
|
||||
probe := t.audio.probeByType[stype]
|
||||
if probe < tciAudioProbeMax {
|
||||
t.audio.probeByType[stype]++
|
||||
}
|
||||
t.audio.mu.Unlock()
|
||||
if probe < tciAudioProbeMax {
|
||||
debugLog.Printf("TCI: binary frame — rx=%d rate=%d format=%d codec=%d length=%d type=%d payload=%d bytes",
|
||||
receiver, rate, format, codec, length, stype, len(data)-tciHeaderBytes)
|
||||
}
|
||||
|
||||
if stype == tciStreamTXChrono {
|
||||
// The radio asking for the next frame of transmit audio. It is empty —
|
||||
// the whole message IS the request — and it carries the size it wants in
|
||||
// the header's length field, so the answer is written from what it says
|
||||
// rather than from what we assumed.
|
||||
t.serveChrono(rate, length)
|
||||
return
|
||||
}
|
||||
if stype != tciStreamRXAudio {
|
||||
// IQ and transmit audio. The latter is ours to send, not to receive:
|
||||
// counted above, and dropped.
|
||||
return
|
||||
}
|
||||
if codec != 0 {
|
||||
t.audioErr(fmt.Sprintf("stream is codec=%d, and nothing here decodes a compressed stream", codec))
|
||||
return
|
||||
}
|
||||
|
||||
// The FORMAT number is decided by measurement, not by the number itself.
|
||||
//
|
||||
// A real SunSDR answered format=3, where the code expected 0 — and 0 was a
|
||||
// guess from reading the documentation, which is exactly the kind of detail
|
||||
// a memory of a document gets wrong. Rather than swap one magic number for
|
||||
// another, the sample width is derived from what arrived: the header says
|
||||
// how many samples the payload holds, so the bytes per sample follow from
|
||||
// dividing. That is true whatever number the format field carries, on this
|
||||
// firmware and the next.
|
||||
payload := data[tciHeaderBytes:]
|
||||
if len(payload) == 0 || length <= 0 {
|
||||
return
|
||||
}
|
||||
width := len(payload) / length
|
||||
var n int
|
||||
switch width {
|
||||
case 4:
|
||||
n = len(payload) / 4 // float32
|
||||
case 2:
|
||||
n = len(payload) / 2 // 16-bit PCM
|
||||
default:
|
||||
t.audioErr(fmt.Sprintf("frame carries %d bytes for %d samples (format=%d) — not a width this reads",
|
||||
len(payload), length, format))
|
||||
return
|
||||
}
|
||||
if n == 0 {
|
||||
return
|
||||
}
|
||||
// Under the lock like the rest of the counters: the reader is the only
|
||||
// writer today, but a fact about the radio that is read from another
|
||||
// goroutine has no business being the one field left unguarded.
|
||||
t.audio.mu.Lock()
|
||||
first := !t.audio.widthLogged
|
||||
t.audio.widthLogged = true
|
||||
t.audio.mu.Unlock()
|
||||
if first {
|
||||
debugLog.Printf("TCI: audio is %d bytes per sample at %d Hz (format field says %d)", width, rate, format)
|
||||
}
|
||||
// Stereo interleaved → mono. Both channels of a receiver carry the same
|
||||
// audio, and everything downstream works on one.
|
||||
// How many channels are interleaved. The radio says so at connect; two is
|
||||
// the fallback, which is what every SunSDR seen so far streams.
|
||||
t.audio.mu.Lock()
|
||||
chans := t.audio.declaredChans
|
||||
t.audio.mu.Unlock()
|
||||
if chans <= 0 {
|
||||
chans = 2
|
||||
}
|
||||
mono := make([]float32, 0, n/chans+1)
|
||||
var peak float64
|
||||
sample := func(i int) float32 {
|
||||
if width == 2 {
|
||||
// 16-bit PCM, scaled to the same -1…1 the rest of the audio path
|
||||
// works in, so a change of format cannot change what a level means.
|
||||
return float32(int16(le.Uint16(payload[i*2:]))) / 32768
|
||||
}
|
||||
return math.Float32frombits(le.Uint32(payload[i*4:]))
|
||||
}
|
||||
for i := 0; i+chans-1 < n; i += chans {
|
||||
var sum float32
|
||||
for c := 0; c < chans; c++ {
|
||||
sum += sample(i + c)
|
||||
}
|
||||
v := sum / float32(chans)
|
||||
if a := math.Abs(float64(v)); a > peak {
|
||||
peak = a
|
||||
}
|
||||
mono = append(mono, v)
|
||||
}
|
||||
|
||||
t.audio.mu.Lock()
|
||||
t.audio.frames++
|
||||
t.audio.samples += int64(len(mono))
|
||||
if rate > 0 {
|
||||
t.audio.rate = rate
|
||||
}
|
||||
if peak > t.audio.peak || time.Since(t.audio.peakAt) > time.Second {
|
||||
t.audio.peak = peak
|
||||
t.audio.peakAt = time.Now()
|
||||
}
|
||||
cb := t.audio.OnSamples
|
||||
t.audio.mu.Unlock()
|
||||
|
||||
if cb != nil {
|
||||
cb(rate, mono)
|
||||
}
|
||||
}
|
||||
|
||||
// audioErr records a decoding complaint, once, so the panel can show it without
|
||||
// the log filling with the same line at fifty frames a second.
|
||||
func (t *TCI) audioErr(msg string) {
|
||||
t.audio.mu.Lock()
|
||||
first := t.audio.lastErr != msg
|
||||
t.audio.lastErr = msg
|
||||
t.audio.mu.Unlock()
|
||||
if first {
|
||||
debugLog.Printf("TCI: audio: %s", msg)
|
||||
}
|
||||
}
|
||||
|
||||
// resumeAudio re-opens the stream after a reconnect, if the host had asked for
|
||||
// it. A dropped WebSocket takes the audio with it, and an operator who switched
|
||||
// recording on does not expect to switch it on again.
|
||||
func (t *TCI) resumeAudio() {
|
||||
t.audio.mu.Lock()
|
||||
want, rx, rate := t.audio.want, t.audio.rx, t.audio.rate
|
||||
t.audio.mu.Unlock()
|
||||
if !want {
|
||||
return
|
||||
}
|
||||
if err := t.StartTCIAudio(rx, rate); err != nil {
|
||||
debugLog.Printf("TCI: re-opening the audio stream failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// wsMessageIsBinary keeps the type test in one place — the reader used to
|
||||
// ignore the message type entirely and split every frame on ';', which would
|
||||
// have fed audio bytes to the command parser the moment a stream was opened.
|
||||
func wsMessageIsBinary(mt int) bool { return mt == websocket.BinaryMessage }
|
||||
|
||||
// noteTXTransition reports what the stream did across a transmission.
|
||||
//
|
||||
// The voice keyer needs two numbers the documentation does not give: the size
|
||||
// and the cadence of the frames the radio expects while transmitting. They can
|
||||
// only be read off a real transmission — and the first attempt came back with a
|
||||
// log that said nothing at all, which is ambiguous: either no transmit frames
|
||||
// arrived, or they arrived and went unlogged.
|
||||
//
|
||||
// So the boundaries are marked and every stream type is counted. A pass that
|
||||
// produces "type 1: 240, and nothing else" is a RESULT — it says the radio
|
||||
// sends no chrono unless something more is asked of it — where a log with no
|
||||
// transmit lines in it was merely a silence.
|
||||
func (t *TCI) noteTXTransition(on bool) {
|
||||
t.audio.mu.Lock()
|
||||
if t.audio.countByType == nil {
|
||||
t.audio.countByType = map[int]int64{}
|
||||
}
|
||||
if on {
|
||||
// Let the transmit types speak again on every pass: forty frames is a
|
||||
// budget spent long before the operator gets round to keying.
|
||||
if t.audio.probeByType != nil {
|
||||
delete(t.audio.probeByType, tciStreamTXAudio)
|
||||
delete(t.audio.probeByType, tciStreamTXChrono)
|
||||
}
|
||||
t.audio.txMark = map[int]int64{}
|
||||
for k, v := range t.audio.countByType {
|
||||
t.audio.txMark[k] = v
|
||||
}
|
||||
streaming := t.audio.want
|
||||
t.audio.mu.Unlock()
|
||||
debugLog.Printf("TCI: TRANSMIT started — watching for transmit-audio (type %d) and chrono (type %d) frames; receive stream is %s",
|
||||
tciStreamTXAudio, tciStreamTXChrono, map[bool]string{true: "open", false: "CLOSED (tick the TCI recording option, or the radio has no reason to stream)"}[streaming])
|
||||
return
|
||||
}
|
||||
names := map[int]string{
|
||||
tciStreamIQ: "IQ",
|
||||
tciStreamRXAudio: "receive audio",
|
||||
tciStreamTXAudio: "transmit audio",
|
||||
tciStreamTXChrono: "transmit chrono",
|
||||
}
|
||||
var parts []string
|
||||
for _, k := range []int{tciStreamIQ, tciStreamRXAudio, tciStreamTXAudio, tciStreamTXChrono} {
|
||||
if n := t.audio.countByType[k] - t.audio.txMark[k]; n > 0 {
|
||||
parts = append(parts, fmt.Sprintf("%s (type %d): %d", names[k], k, n))
|
||||
}
|
||||
}
|
||||
t.audio.mu.Unlock()
|
||||
if len(parts) == 0 {
|
||||
debugLog.Printf("TCI: TRANSMIT ended — NO binary frames of any type arrived during it")
|
||||
return
|
||||
}
|
||||
debugLog.Printf("TCI: TRANSMIT ended — frames during the pass: %s", strings.Join(parts, ", "))
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//go:build windows
|
||||
|
||||
package cat
|
||||
|
||||
import "fmt"
|
||||
|
||||
// TCIAudioController is the receive-audio capability of the TCI backend, kept
|
||||
// as an interface for the same reason as the Flex and Yaesu ones: the host asks
|
||||
// the manager, and a station running something else gets a clear "this backend
|
||||
// does not do that" instead of a nil dereference.
|
||||
type TCIAudioController interface {
|
||||
StartTCIAudio(rx, rate int) error
|
||||
StopTCIAudio() error
|
||||
TCIAudioStatus() TCIAudioStatus
|
||||
}
|
||||
|
||||
// TCIAudioState returns the stream's state, or (zero, false) when the active
|
||||
// backend is not a TCI radio.
|
||||
func (m *Manager) TCIAudioState() (TCIAudioStatus, bool) {
|
||||
m.mu.RLock()
|
||||
b := m.backend
|
||||
m.mu.RUnlock()
|
||||
if tc, ok := b.(TCIAudioController); ok {
|
||||
return tc.TCIAudioStatus(), true
|
||||
}
|
||||
return TCIAudioStatus{}, false
|
||||
}
|
||||
|
||||
// TCIAudioDo dispatches an audio command onto the CAT goroutine, like every
|
||||
// other backend-specific control.
|
||||
func (m *Manager) TCIAudioDo(fn func(TCIAudioController) error) error {
|
||||
return m.exec(func(b Backend) error {
|
||||
tc, ok := b.(TCIAudioController)
|
||||
if !ok {
|
||||
return fmt.Errorf("active CAT backend is not a TCI radio")
|
||||
}
|
||||
return fn(tc)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package cat
|
||||
|
||||
// Playing a recorded message to the radio over TCI — the voice keyer's path.
|
||||
//
|
||||
// The same exchange the tone probe established, with a WAV in place of the
|
||||
// sine: the radio asks for a frame, we answer with the next slice of the
|
||||
// message, and it sets the pace. What is added here is the conversion, because
|
||||
// a recording is whatever the microphone gave it — 16-bit, often mono, often
|
||||
// not 48 kHz — and the radio wants interleaved float32 at the stream's rate.
|
||||
//
|
||||
// The message is converted ONCE, up front, rather than per frame. A voice
|
||||
// message is a few hundred kilobytes; resampling it inside the callback would
|
||||
// put arithmetic on the path that has 21 ms to answer, and a late frame is a
|
||||
// gap in what goes out.
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
// tciTXFirstAskTimeout is how long to wait for the radio to ask for the first
|
||||
// frame before giving up.
|
||||
//
|
||||
// It answers within a frame or two when it is going to answer at all, so this
|
||||
// is generous. When it stays quiet the cause is always the same — the transmit
|
||||
// audio source is the microphone rather than TCI — and a fifth of a second of
|
||||
// carrier is a cheap way to find that out.
|
||||
const tciTXFirstAskTimeout = 200 * time.Millisecond
|
||||
|
||||
// PlayTXAudio sends one message and returns when it has all been handed over,
|
||||
// or when stop is closed.
|
||||
//
|
||||
// The PTT is NOT touched here. The voice keyer keys before calling and unkeys
|
||||
// after, exactly as it does with a sound card, so the transmission is bracketed
|
||||
// by the same code whichever way the audio travels.
|
||||
func (t *TCI) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error {
|
||||
t.mu.Lock()
|
||||
connected := t.conn != nil
|
||||
t.mu.Unlock()
|
||||
if !connected {
|
||||
return fmt.Errorf("not connected to the radio")
|
||||
}
|
||||
|
||||
t.audio.mu.Lock()
|
||||
outRate := t.audio.rate
|
||||
t.audio.mu.Unlock()
|
||||
if outRate <= 0 {
|
||||
outRate = 48000
|
||||
}
|
||||
|
||||
mono := decodeToMono(pcm, ch, bits)
|
||||
if len(mono) == 0 {
|
||||
return fmt.Errorf("the message is empty")
|
||||
}
|
||||
if rate > 0 && rate != outRate {
|
||||
mono = resampleLinear(mono, rate, outRate)
|
||||
}
|
||||
|
||||
// Served from here on. The callback does nothing but copy and interleave,
|
||||
// which is what keeps it inside the frame interval.
|
||||
pos := 0
|
||||
done := make(chan struct{})
|
||||
var closed bool
|
||||
t.setTXFeed(func(samples int) []byte {
|
||||
if samples <= 0 {
|
||||
samples = 2048
|
||||
}
|
||||
pairs := samples / 2
|
||||
if pos >= len(mono) {
|
||||
if !closed {
|
||||
closed = true
|
||||
close(done)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
payload := make([]byte, samples*4)
|
||||
le := binary.LittleEndian
|
||||
for i := 0; i < pairs; i++ {
|
||||
var v float32
|
||||
if pos < len(mono) {
|
||||
v = mono[pos]
|
||||
pos++
|
||||
}
|
||||
bits := math.Float32bits(v)
|
||||
le.PutUint32(payload[(i*2)*4:], bits) // left
|
||||
le.PutUint32(payload[(i*2+1)*4:], bits) // right
|
||||
}
|
||||
return payload
|
||||
})
|
||||
defer t.setTXFeed(nil)
|
||||
|
||||
// Nothing asked for in a fifth of a second means nothing is listening.
|
||||
// Reported plainly: the message would otherwise go out as silence, and a
|
||||
// voice keyer that transmits silence is worse than one that refuses.
|
||||
deadline := time.Now().Add(tciTXFirstAskTimeout)
|
||||
for time.Now().Before(deadline) {
|
||||
t.audio.mu.Lock()
|
||||
asked := t.audio.txSent > 0
|
||||
t.audio.mu.Unlock()
|
||||
if asked {
|
||||
break
|
||||
}
|
||||
select {
|
||||
case <-stop:
|
||||
return nil
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
}
|
||||
}
|
||||
t.audio.mu.Lock()
|
||||
asked := t.audio.txSent
|
||||
t.audio.mu.Unlock()
|
||||
if asked == 0 {
|
||||
return fmt.Errorf("the radio did not ask for any audio — set its transmit audio source to TCI instead of the microphone")
|
||||
}
|
||||
|
||||
// The radio drains the message at real time, so this waits for the feed to
|
||||
// run out. The cap is the message's own length with a second to spare: a
|
||||
// radio that stops asking mid-message must not hold the transmitter up.
|
||||
limit := time.Duration(float64(len(mono))/float64(outRate)*float64(time.Second)) + time.Second
|
||||
select {
|
||||
case <-done:
|
||||
case <-stop:
|
||||
case <-time.After(limit):
|
||||
debugLog.Printf("TCI: the radio stopped asking for audio before the message ended")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// decodeToMono turns interleaved PCM into one channel of -1…1 floats.
|
||||
func decodeToMono(pcm []byte, ch, bits int) []float32 {
|
||||
if ch <= 0 {
|
||||
ch = 1
|
||||
}
|
||||
switch bits {
|
||||
case 16:
|
||||
frame := ch * 2
|
||||
out := make([]float32, 0, len(pcm)/frame+1)
|
||||
for i := 0; i+frame <= len(pcm); i += frame {
|
||||
var sum float32
|
||||
for c := 0; c < ch; c++ {
|
||||
v := int16(uint16(pcm[i+c*2]) | uint16(pcm[i+c*2+1])<<8)
|
||||
sum += float32(v) / 32768
|
||||
}
|
||||
out = append(out, sum/float32(ch))
|
||||
}
|
||||
return out
|
||||
case 8:
|
||||
// Unsigned, centred on 128 — the one format where silence is not zero.
|
||||
out := make([]float32, 0, len(pcm)/ch+1)
|
||||
for i := 0; i+ch <= len(pcm); i += ch {
|
||||
var sum float32
|
||||
for c := 0; c < ch; c++ {
|
||||
sum += (float32(pcm[i+c]) - 128) / 128
|
||||
}
|
||||
out = append(out, sum/float32(ch))
|
||||
}
|
||||
return out
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// resampleLinear moves samples from one rate to another.
|
||||
//
|
||||
// Linear interpolation, which is crude and entirely adequate here: a voice
|
||||
// recording at 16 kHz going to 48 kHz is being INTERPOLATED, and interpolation
|
||||
// invents no frequencies to alias. Going the other way would want a filter
|
||||
// first, but a message recorded above the radio's stream rate is not a case
|
||||
// that arises — the recorder works at 16 kHz and radios stream at 48.
|
||||
func resampleLinear(in []float32, from, to int) []float32 {
|
||||
if from <= 0 || to <= 0 || from == to || len(in) == 0 {
|
||||
return in
|
||||
}
|
||||
ratio := float64(from) / float64(to)
|
||||
n := int(float64(len(in)) / ratio)
|
||||
out := make([]float32, n)
|
||||
for i := 0; i < n; i++ {
|
||||
src := float64(i) * ratio
|
||||
j := int(src)
|
||||
frac := float32(src - float64(j))
|
||||
if j+1 < len(in) {
|
||||
out[i] = in[j]*(1-frac) + in[j+1]*frac
|
||||
} else {
|
||||
out[i] = in[len(in)-1]
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package cat
|
||||
|
||||
// Sending audio TO the radio over TCI.
|
||||
//
|
||||
// Three transmissions on a real SunSDR settled how this works, and none of it
|
||||
// was guessable from the documentation:
|
||||
//
|
||||
// 1. The radio asks for audio only when the transmission is the CLIENT'S. With
|
||||
// the operator keying the microphone it sent 282 receive frames and nothing
|
||||
// else, over six seconds.
|
||||
// 2. It asks only when its TRANSMIT AUDIO SOURCE is TCI rather than the
|
||||
// microphone. This first read as "digital modes only" — SSB produced
|
||||
// nothing four times over, DIGU answered at once — but the mode was a
|
||||
// coincidence: ExpertSDR3 keeps that source setting per mode, and it was on
|
||||
// the microphone in SSB. Which is why nothing is refused on the strength of
|
||||
// the mode: the radio is asked, and it answers by asking or by staying
|
||||
// quiet.
|
||||
// 3. The chrono is a REQUEST, not a clock to follow. It carries no payload —
|
||||
// the message itself is the ask — and it names the size it wants in the
|
||||
// header's length field: 2048 samples, two channels interleaved, arriving
|
||||
// 47 times a second. Which is 1024 sample-pairs at 48 kHz, exactly real
|
||||
// time, measured rather than assumed.
|
||||
//
|
||||
// So audio is sent in ANSWER to chrono, never on a timer of our own. A timer
|
||||
// was the first attempt and the radio ignored every frame of it: 234 sent, none
|
||||
// used. Answering the request is what makes the difference, and it also means
|
||||
// the radio sets the pace — no drift, no buffer to tune.
|
||||
//
|
||||
// All of it was established with a tone probe — key the radio, push a sine,
|
||||
// watch — which is gone now that it has served its purpose: it answered the
|
||||
// three questions above, confirmed 80 W out on a real SunSDR, and had no
|
||||
// business in front of an operator once the voice keyer worked. What is left is
|
||||
// the exchange it discovered, with tci_tx_play.go supplying the message.
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
// sendBinaryFrame writes one TCI binary frame: the 16-word header the radio's
|
||||
// own frames carry, then the payload.
|
||||
func (t *TCI) sendBinaryFrame(stype, rx, rate, length int, payload []byte) error {
|
||||
t.mu.Lock()
|
||||
c := t.conn
|
||||
t.mu.Unlock()
|
||||
if c == nil {
|
||||
return fmt.Errorf("tci: not connected")
|
||||
}
|
||||
buf := make([]byte, tciHeaderBytes+len(payload))
|
||||
le := binary.LittleEndian
|
||||
le.PutUint32(buf[0:], uint32(rx))
|
||||
le.PutUint32(buf[4:], uint32(rate))
|
||||
// format=3, codec=0: mirrored from what this radio SENDS. The field is
|
||||
// documented as an enumeration whose numbering did not survive contact with
|
||||
// the firmware — the receive stream answers 3 for four-byte floats — so the
|
||||
// only defensible choice is to speak back exactly what was spoken to us.
|
||||
le.PutUint32(buf[8:], 3)
|
||||
le.PutUint32(buf[12:], 0)
|
||||
le.PutUint32(buf[16:], 0) // crc — the radio sends 0 and does not check ours
|
||||
le.PutUint32(buf[20:], uint32(length))
|
||||
le.PutUint32(buf[24:], uint32(stype))
|
||||
copy(buf[tciHeaderBytes:], payload)
|
||||
|
||||
t.wmu.Lock()
|
||||
defer t.wmu.Unlock()
|
||||
_ = c.SetWriteDeadline(time.Now().Add(3 * time.Second))
|
||||
return c.WriteMessage(websocket.BinaryMessage, buf)
|
||||
}
|
||||
|
||||
// serveChrono answers one request for transmit audio.
|
||||
//
|
||||
// Called from the reader goroutine, so it does the least it can: take the
|
||||
// frame from whatever is feeding, and write it. A feed that has run out returns
|
||||
// nil and the request is counted rather than answered with silence — silence
|
||||
// would be indistinguishable from a working stream on a meter.
|
||||
func (t *TCI) serveChrono(rate, samples int) {
|
||||
t.audio.mu.Lock()
|
||||
feed := t.audio.txFeed
|
||||
t.audio.mu.Unlock()
|
||||
if feed == nil {
|
||||
return
|
||||
}
|
||||
if samples <= 0 {
|
||||
samples = 2048
|
||||
}
|
||||
payload := feed(samples)
|
||||
if payload == nil {
|
||||
// Answered with silence rather than left unanswered. TCI 2.0 §3.4: "the
|
||||
// client may not send a response or may send a signal with zero counts,
|
||||
// which corresponds to no signal - this option is preferable."
|
||||
payload = make([]byte, samples*4)
|
||||
t.audio.mu.Lock()
|
||||
t.audio.txShort++
|
||||
t.audio.mu.Unlock()
|
||||
}
|
||||
if rate <= 0 {
|
||||
rate = 48000
|
||||
}
|
||||
if err := t.sendBinaryFrame(tciStreamTXAudio, 0, rate, samples, payload); err != nil {
|
||||
debugLog.Printf("TCI: could not send transmit audio: %v", err)
|
||||
return
|
||||
}
|
||||
t.audio.mu.Lock()
|
||||
t.audio.txSent++
|
||||
t.audio.mu.Unlock()
|
||||
}
|
||||
|
||||
// setTXFeed installs (or clears) the source of transmit audio.
|
||||
func (t *TCI) setTXFeed(fn func(samples int) []byte) {
|
||||
t.audio.mu.Lock()
|
||||
t.audio.txFeed = fn
|
||||
t.audio.txSent, t.audio.txShort = 0, 0
|
||||
t.audio.mu.Unlock()
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package qso
|
||||
|
||||
import "testing"
|
||||
|
||||
// The colour of a matrix cell is a claim about what the operator still needs,
|
||||
// and it was wrong for several releases: a callsign worked and not confirmed
|
||||
// outranked an entity CONFIRMED on the same band and mode, so a slot that was
|
||||
// finished showed as unfinished.
|
||||
//
|
||||
// Reported by VK4DX with the case that names itself: YB confirmed on 20m
|
||||
// digital, shown blue, because one unconfirmed YB station had also been worked
|
||||
// there.
|
||||
func TestBandStatusConfirmedOutranksWorked(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
callWorked, callConfirmed, entityConfirm bool
|
||||
want string
|
||||
}{
|
||||
{"entity worked only", false, false, false, "dxcc_w"},
|
||||
{"this call worked, nothing confirmed", true, false, false, "call_w"},
|
||||
// The regression, in one line.
|
||||
{"entity confirmed, this call worked but not confirmed", true, false, true, "dxcc_c"},
|
||||
{"entity confirmed, this call not worked here", false, false, true, "dxcc_c"},
|
||||
{"this call confirmed", true, true, true, "call_c"},
|
||||
// A confirmed contact with this call implies it was worked, but the flags
|
||||
// arrive from separate SQL aggregates and nothing guarantees the pair.
|
||||
{"call confirmed without the worked flag", false, true, true, "call_c"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
got := bandStatusNames[bandStatusCode(c.callWorked, c.callConfirmed, c.entityConfirm)]
|
||||
if got != c.want {
|
||||
t.Errorf("bandStatusCode(worked=%v, callConf=%v, entityConf=%v) = %s, want %s",
|
||||
c.callWorked, c.callConfirmed, c.entityConfirm, got, c.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// The ladder itself, stated once: every confirmed code must beat every worked
|
||||
// code. A future edit that reorders the constants fails here rather than in a
|
||||
// screenshot from an operator.
|
||||
func TestBandStatusLadderPutsConfirmedAbove(t *testing.T) {
|
||||
for _, worked := range []int{stDxccW, stCallW} {
|
||||
for _, confirmed := range []int{stDxccC, stCallC} {
|
||||
if confirmed <= worked {
|
||||
t.Errorf("%s (%d) does not outrank %s (%d)",
|
||||
bandStatusNames[confirmed], confirmed, bandStatusNames[worked], worked)
|
||||
}
|
||||
}
|
||||
}
|
||||
if stCallC <= stDxccC {
|
||||
t.Error("call_c must outrank dxcc_c: the callsign is the more specific claim")
|
||||
}
|
||||
if stCallW <= stDxccW {
|
||||
t.Error("call_w must outrank dxcc_w for the same reason")
|
||||
}
|
||||
}
|
||||
+58
-19
@@ -1895,7 +1895,8 @@ type WorkedBefore struct {
|
||||
|
||||
// Status grid driving the band×class matrix in the UI. One entry per
|
||||
// (band, class) where ANY QSO exists in this DXCC. Only the highest
|
||||
// status for that cell is kept (call_c > call_w > dxcc_c > dxcc_w).
|
||||
// status for that cell is kept (call_c > dxcc_c > call_w > dxcc_w —
|
||||
// confirmed outranks worked).
|
||||
BandStatus []BandStatus `json:"band_status"`
|
||||
}
|
||||
|
||||
@@ -1906,6 +1907,48 @@ type BandStatus struct {
|
||||
Status string `json:"status"` // "call_c" | "call_w" | "dxcc_c" | "dxcc_w"
|
||||
}
|
||||
|
||||
// Band-status codes, lowest first. The ORDER is the rule: a cell shows the
|
||||
// highest that applies.
|
||||
const (
|
||||
stDxccW = iota // the entity was worked on this slot
|
||||
stCallW // …and this callsign was one of them
|
||||
stDxccC // the entity is CONFIRMED here
|
||||
stCallC // …and by this callsign
|
||||
)
|
||||
|
||||
// bandStatusNames maps those codes to what the UI colours by.
|
||||
var bandStatusNames = [...]string{"dxcc_w", "call_w", "dxcc_c", "call_c"}
|
||||
|
||||
// bandStatusCode picks the status of one cell of the band × mode matrix.
|
||||
//
|
||||
// CONFIRMED OUTRANKS WORKED, and that is the whole of it. The ladder used to
|
||||
// run call_c > call_w > dxcc_c > dxcc_w, so a callsign worked and not confirmed
|
||||
// beat an entity confirmed on the same slot: an operator with YB confirmed on
|
||||
// 20m digital saw that cell as "worked, not confirmed" because he had also
|
||||
// worked one unconfirmed YB station there. The grid answers "what do I still
|
||||
// need", and a confirmed entity needs nothing, whoever was worked afterwards.
|
||||
//
|
||||
// Taken as a MAXIMUM rather than as a run of assignments, which is how the
|
||||
// later test came to overwrite the earlier one in the first place.
|
||||
func bandStatusCode(callWorked, callConfirmed, entityConfirmed bool) int {
|
||||
code := stDxccW // there is a row at all ⇒ the entity was worked here
|
||||
raise := func(c int) {
|
||||
if c > code {
|
||||
code = c
|
||||
}
|
||||
}
|
||||
if callWorked {
|
||||
raise(stCallW)
|
||||
}
|
||||
if entityConfirmed {
|
||||
raise(stDxccC)
|
||||
}
|
||||
if callConfirmed {
|
||||
raise(stCallC)
|
||||
}
|
||||
return code
|
||||
}
|
||||
|
||||
// modeClass collapses ADIF modes into the three buckets DXers care about.
|
||||
// Anything not voice and not CW is treated as digital.
|
||||
func modeClass(mode string) string {
|
||||
@@ -2167,7 +2210,18 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
|
||||
// ---- Per-(band, class) status grid ----
|
||||
// One pass over every distinct (band, mode) in the DXCC, aggregating
|
||||
// "did this call work it?" and "was anything confirmed?" via MAX.
|
||||
// Status precedence: call_c > call_w > dxcc_c > dxcc_w.
|
||||
// Status precedence: CONFIRMED OUTRANKS WORKED — call_c > dxcc_c > call_w >
|
||||
// dxcc_w.
|
||||
//
|
||||
// It used to run call_c > call_w > dxcc_c > dxcc_w, which made a call worked
|
||||
// and not confirmed outrank an entity confirmed on the same slot. Reported
|
||||
// from a real log: YB confirmed on 20m digital showed BLUE, because that
|
||||
// operator had also worked one unconfirmed YB station there. The cell said
|
||||
// "not confirmed" about a slot that is confirmed.
|
||||
//
|
||||
// The grid answers "what do I still need on this band and mode", and for
|
||||
// that question confirmation is the axis that matters: a confirmed entity
|
||||
// needs nothing, whoever else was worked afterwards.
|
||||
// Filter NULL/empty band+mode rows — they'd create a NULL group key
|
||||
// that Scan into *string can't handle and would error out the whole
|
||||
// WorkedBefore call, blanking the matrix in the UI.
|
||||
@@ -2188,12 +2242,6 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
|
||||
return wb, fmt.Errorf("band status: %w", err)
|
||||
}
|
||||
type cellKey struct{ band, class string }
|
||||
const (
|
||||
stDxccW = 0
|
||||
stDxccC = 1
|
||||
stCallW = 2
|
||||
stCallC = 3
|
||||
)
|
||||
best := map[cellKey]int{}
|
||||
for statusRows.Next() {
|
||||
var band, mode string
|
||||
@@ -2202,23 +2250,14 @@ func (r *Repo) WorkedBefore(ctx context.Context, callsign string, dxccHint int,
|
||||
statusRows.Close()
|
||||
return wb, fmt.Errorf("scan band status: %w", err)
|
||||
}
|
||||
code := stDxccW // row exists ⇒ entity worked at minimum
|
||||
if dxccConfirmed == 1 {
|
||||
code = stDxccC
|
||||
}
|
||||
if callW == 1 {
|
||||
code = stCallW
|
||||
}
|
||||
if callC == 1 {
|
||||
code = stCallC
|
||||
}
|
||||
code := bandStatusCode(callW == 1, callC == 1, dxccConfirmed == 1)
|
||||
k := cellKey{band: band, class: modeClass(mode)}
|
||||
if cur, ok := best[k]; !ok || code > cur {
|
||||
best[k] = code
|
||||
}
|
||||
}
|
||||
statusRows.Close()
|
||||
codeStr := [...]string{"dxcc_w", "dxcc_c", "call_w", "call_c"}
|
||||
codeStr := bandStatusNames
|
||||
for k, code := range best {
|
||||
wb.BandStatus = append(wb.BandStatus, BandStatus{
|
||||
Band: k.band, Class: k.class, Status: codeStr[code],
|
||||
|
||||
@@ -44,7 +44,11 @@ import (
|
||||
// Rig is what the server needs from OpsLog's CAT manager. An interface, so this
|
||||
// package stays testable without a radio and without importing internal/cat.
|
||||
type Rig interface {
|
||||
Freq() int64 // current TX frequency in Hz, 0 if unknown
|
||||
// Freq is the frequency of the CURRENT VFO — where the operator is
|
||||
// listening. Hamlib's "f" means the VFO in use, not the transmit one; the
|
||||
// split TX frequency is a separate question, asked with "i". Answering "f"
|
||||
// with the TX frequency invites a client to write it back as the dial.
|
||||
Freq() int64 // current (RX) frequency in Hz, 0 if unknown
|
||||
Mode() string // ADIF mode (SSB, CW, FT8…)
|
||||
Split() (bool, int64) // split on?, and the other VFO's frequency
|
||||
SetFreq(hz int64) error
|
||||
|
||||
@@ -148,3 +148,73 @@ func isHamlogConfirmed(v string) bool {
|
||||
v = strings.ToUpper(strings.TrimSpace(v))
|
||||
return v != "" && v != "N" && v != "NO"
|
||||
}
|
||||
|
||||
// RDAChoice is one arbitrated contact: which district the operator decided is
|
||||
// right for that QSO.
|
||||
type RDAChoice struct {
|
||||
QSOID int64 `json:"qso_id"`
|
||||
District string `json:"district"`
|
||||
}
|
||||
|
||||
// RDAApplyResult reports what an arbitration did.
|
||||
type RDAApplyResult struct {
|
||||
Applied int `json:"applied"`
|
||||
Failed int `json:"failed"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// ApplyRDAChoices writes the chosen district onto each contact — into CNTY and
|
||||
// as the award reference, both.
|
||||
//
|
||||
// The first version wrote only the award override, to keep the imported CNTY as
|
||||
// a record of what HAMLOG said. That was wrong in the way that matters: CNTY is
|
||||
// what the comparison READS, so the contact went on disagreeing for ever. The
|
||||
// operator settled a hundred contacts, ran the comparison again and got the
|
||||
// same hundred rows — the decision had no visible effect anywhere, which is
|
||||
// indistinguishable from a button that does nothing.
|
||||
//
|
||||
// So the chosen district lands in CNTY, where it settles the disagreement, and
|
||||
// in the award reference, where it decides what the contact counts for. This is
|
||||
// the operator's own log: correcting a field in it is the point of the exercise,
|
||||
// not a loss of evidence.
|
||||
func (a *App) ApplyRDAChoices(choices []RDAChoice) (RDAApplyResult, error) {
|
||||
var res RDAApplyResult
|
||||
if a.qso == nil {
|
||||
return res, fmt.Errorf("db not initialized")
|
||||
}
|
||||
for _, c := range choices {
|
||||
district := strings.ToUpper(strings.TrimSpace(c.District))
|
||||
if !rdaDistrictRe.MatchString(district) {
|
||||
res.Failed++
|
||||
applog.Printf("rda apply: qso %d — %q is not a district reference", c.QSOID, c.District)
|
||||
continue
|
||||
}
|
||||
q, err := a.qso.GetByID(a.ctx, c.QSOID)
|
||||
if err != nil {
|
||||
res.Failed++
|
||||
applog.Printf("rda apply: qso %d could not be read: %v", c.QSOID, err)
|
||||
continue
|
||||
}
|
||||
if q.Extras == nil {
|
||||
q.Extras = map[string]string{}
|
||||
}
|
||||
q.County = district
|
||||
q.Extras[award.ManualRefsKey] = setOverrideRef(q.Extras[award.ManualRefsKey], "RDA", district)
|
||||
if err := a.qso.Update(a.ctx, q); err != nil {
|
||||
res.Failed++
|
||||
applog.Printf("rda apply: qso %d update failed: %v", c.QSOID, err)
|
||||
continue
|
||||
}
|
||||
res.Applied++
|
||||
}
|
||||
if res.Applied > 0 {
|
||||
// The award totals were computed from the old answers.
|
||||
a.invalidateAwardStats()
|
||||
}
|
||||
applog.Printf("rda apply: %d contacts settled, %d failed", res.Applied, res.Failed)
|
||||
res.Message = fmt.Sprintf("%d settled", res.Applied)
|
||||
if res.Failed > 0 {
|
||||
res.Message += fmt.Sprintf(", %d failed (see the log)", res.Failed)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
// appVersion is stamped on every heartbeat (and could feed the About box).
|
||||
appVersion = "0.26.14"
|
||||
appVersion = "0.26.17"
|
||||
|
||||
// posthogHost is the PostHog ingestion endpoint. EU cloud by default; change
|
||||
// to https://us.i.posthog.com for a US project.
|
||||
|
||||
Reference in New Issue
Block a user