Commit Graph

36 Commits

Author SHA1 Message Date
sjg 37c36d196e [fix](trx-frontend-http): uniform buttons, jog wheel, VFO picker, signal graph, and client count
Reorganize layout: frequency row with jog wheel on top, mode and
transmit/power side by side below. Replace VFO text box with segmented
picker. Add rolling signal history canvas. Track connected SSE clients
and display count in status hint. Unify button heights and add Enter
key support for TX limit input.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-08 09:53:33 +01:00
sjg b142d68ca2 [fix](trx-server): fix busy-loop in rig polling caused by interval recreation
time::interval() fires its first tick immediately. Recreating it on
every loop iteration made the select! always resolve instantly,
turning the main polling loop into a busy-loop (~13% CPU idle).

Replace with a Box::pin(sleep()) that is only reset after it
completes or when the poll duration changes (rx/tx transition).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:14:31 +01:00
sjg 75de1e50b9 [fix](trx-server): pause audio capture when no clients are connected
Instead of running the cpal input stream continuously, start it
paused and only activate when broadcast subscribers are present.
When the last client disconnects, pause the stream and sleep at
100ms intervals polling for new receivers.

This eliminates idle CPU usage from continuous CoreAudio callbacks,
channel allocations, and sample processing when nobody is listening.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:14:16 +01:00
sjg 90b981ef49 [fix](trx-client): enable audio by default
Enable audio streaming by default in AudioClientConfig so the
client connects to the server audio port without requiring
explicit configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:05:34 +01:00
sjg 3b606688bc [fix](trx-server): enable audio by default and fix playback thread panic
Enable audio streaming by default in AudioConfig.

Fix panic in audio playback thread caused by calling
tokio::runtime::Handle::current() from a plain std::thread.
Use rx.blocking_recv() instead, which is the correct API for
consuming a tokio mpsc receiver from a synchronous context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:05:25 +01:00
sjg 96edf7fc09 [fix](trx-frontend-http): misc JS cleanup and UX polish
Move window._opusDecoder, window._txEncoder, window._nextPlayTime
into closure-scoped variables to avoid polluting the global namespace.

Add showHint() helper to debounce status hint text, preventing
multiple button handlers from fighting over powerHint.textContent.

Throttle audio level indicator updates to max 10/sec instead of
updating on every Opus packet (~50/sec).

Hide audio controls row if the server has no audio configured
(checks /audio endpoint on load).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 15:00:10 +01:00
sjg 57d5b0633c [fix](trx-frontend-http): add PTT safety timeout and audio compatibility fallback
Add a 120-second TX safety timeout that auto-releases PTT if no mic
data flows (browser crash, disconnect). Timer resets on each audio
callback. Shows countdown in status when < 10s remaining.

Add beforeunload handler that releases PTT via navigator.sendBeacon
when the browser tab is closed during TX.

Detect WebCodecs support on page load and show "Audio requires
Chrome/Edge" on non-Chromium browsers instead of silently failing.

Remove dead playBuffer/playNode variables that were declared but
never used. Fix TX AudioData to always use mono (channel 0) with
numberOfChannels: 1 matching the f32-planar format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:52:51 +01:00
sjg 83342628fa [fix](trx-frontend-http): add CSS variables, focus states, and mobile breakpoints
Replace all hardcoded colors with CSS custom properties on :root for
easier theming. Add focus-visible outlines for keyboard accessibility.
Add mobile breakpoints for screens <= 480px.

Fix PTT button styling to use theme-aware colors (var(--accent-red))
instead of hardcoded light-theme colors (#ffefef, #f3f3f3).

Remove unused .value, .controls, and .section-title CSS classes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:51:18 +01:00
sjg 20fbd3c2cd [fix](trx-frontend-http): compress images and fix SSE heartbeat timing
Resize favicon from 1024x1024 to 64x64 and logo from 1024x1024 to
256x256, reducing total image size from ~3 MB to ~70 KB.

Fix SSE heartbeat race condition where the 10s ping interval competed
with the 8s stale threshold, causing spurious reconnects. Now pings
every 5s server-side, with a 15s stale threshold and 5s check interval
client-side.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:50:25 +01:00
sjg 2bda78d724 [refactor](trx-frontend-http): extract HTML/CSS/JS into separate asset files
Split the monolithic status.rs string template into three files under
assets/web/ (index.html, style.css, app.js) loaded via include_str!.
Add /style.css and /app.js endpoints with correct content types.

This makes the frontend editable with proper syntax highlighting and
linting support in editors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:49:06 +01:00
sjg e9830adaea [docs](trx-rs): document audio streaming and new dependencies
Add Audio streaming section and Dependencies table covering system
libraries (libopus, cmake, pkgconf) and new Rust crates (cpal, opus,
bytes, actix-ws).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:23:14 +01:00
sjg 079310fcc4 [feat](trx-frontend-http): add audio WebSocket endpoint with auto-PTT
Add /audio WebSocket endpoint that streams RX Opus frames to the
browser and accepts TX frames back. Browser UI includes RX/TX Audio
toggle buttons with WebCodecs Opus decode/encode and a level indicator.
TX audio automatically engages PTT on start and releases on stop or
WebSocket disconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:23:07 +01:00
sjg a8aeeaca4e [feat](trx-client): add audio TCP proxy with auto-reconnect
Connect to the server audio TCP port, relay RX Opus frames into a
broadcast channel and TX frames from an mpsc channel. Pass audio
channels to the HTTP frontend via set_audio_channels. Reconnects
with exponential backoff on disconnect.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:22:56 +01:00
sjg eba13ac2c2 [feat](trx-server): add audio capture and TCP streaming
Add AudioConfig to server configuration with support for RX capture
and TX playback via cpal and Opus encoding. Run a dedicated TCP
listener (default port 4533) that sends StreamInfo on connect, streams
RX Opus frames to clients, and receives TX frames back.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:21:59 +01:00
sjg 771cbd1987 [feat](trx-core): add audio protocol types and framing helpers
Add audio streaming wire protocol: message type constants (StreamInfo,
RxFrame, TxFrame), AudioStreamInfo struct, and async read/write helpers
for length-prefixed frames over AsyncRead/AsyncWrite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 14:21:42 +01:00
sjg a664a5f1a1 [fix](trx-client): give AppKit the process main thread
Replace #[tokio::main] with a manual fn main() that builds the tokio
runtime explicitly. All async initialization moves into async_init().

When the appkit frontend is requested, the runtime context is entered
on the main thread and run_appkit_main_thread() is called directly,
giving AppKit thread 0 as required by MainThreadMarker. Ctrl+C is
handled via a spawned task that calls process::exit.

When appkit is not requested, behaviour is unchanged: block on Ctrl+C.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:36:54 +01:00
sjg e7ddaa7300 [fix](trx-frontend-appkit): run AppKit event loop on calling thread
Extract the AppKit event loop from FrontendSpawner::spawn_frontend into
a new public run_appkit_main_thread() function that blocks on the
calling thread. This allows the process main thread (thread 0) to drive
the UI, which is required for MainThreadMarker::new() to succeed.

The FrontendSpawner impl now only spawns the async state watcher task.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:36:32 +01:00
sjg a7582f17f2 [feat](trx-client): default to port 4532 when not specified in URL
Allow connecting with just an IP address (e.g. --url 127.0.0.1)
instead of requiring host:port format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:03:27 +01:00
sjg c4007f16e3 [feat](trx-server): add JSON TCP listener for client connections
Add a JSON-over-TCP listener so trx-client can connect to trx-server.
Speaks the ClientEnvelope/ClientResponse protocol from trx-core::client.

- New listener.rs module with per-client connection handling
- ListenConfig/AuthConfig in config.rs (default: 127.0.0.1:4532)
- CLI args --listen and --port for override
- Optional token-based authentication
- Updated example config with [listen] section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:03:19 +01:00
sjg 3d137fabb1 [feat](trx-backend): add dummy rig backend
Register a dummy rig backend that holds state in memory and responds
to all CAT commands immediately. Useful for development and testing
without hardware.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 13:03:05 +01:00
sjg e7512b3cf0 [feat](trx-frontend-appkit): add native macOS AppKit frontend
Add a new trx-frontend-appkit crate using objc2 + AppKit as a
replacement for the removed Qt/QML frontend. The frontend provides
the same feature set: frequency/mode/band display, PTT/power/VFO/lock
controls, signal/TX metering, and frequency/mode/TX-limit input.

Architecture splits platform-agnostic model (model.rs) from AppKit
UI (ui.rs) to facilitate future UIKit porting. State flows from the
async tokio watcher via std::sync::mpsc to the AppKit main thread;
button actions flow back through a channel to stay on the UI thread.

Feature-gated behind `appkit-frontend` cargo feature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 09:25:13 +01:00
sjg 2c128127e6 [refactor](trx-client): remove Qt/QML frontend support
Remove the Linux-only Qt/QML frontend (trx-frontend-qt) crate and all
references to it from the workspace, trx-client binary, configuration,
and documentation. This prepares for replacement with a native macOS
AppKit frontend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-07 09:10:46 +01:00
sjg 004eea0000 [docs](trx-frontend-qt): update trx-bin reference to trx-client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-06 23:02:21 +01:00
sjg 28cd7fe577 [docs](trx-plugin-example): update paths and references
Update dependency paths to new trx-backend and trx-frontend
locations. Replace trx-bin references with trx-server/trx-client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-06 23:02:13 +01:00
sjg 11f1a095f6 [docs](trx-rs): update docs and split example configs
Replace trx-rs.toml.example with separate trx-server.toml.example
and trx-client.toml.example. Update OVERVIEW.md and README.md
references from trx-bin to trx-server/trx-client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-06 23:02:03 +01:00
sjg e609022356 [docs](trx-rs): add CONTRIBUTING.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2026-02-06 23:01:32 +01:00
sjg 5f91287369 refactor: nest trx-frontend under trx-client, trx-backend under trx-server
Move the frontend and backend crate trees to live physically under their
respective binary crate directories, grouping related code together
without merging crate boundaries. Also flatten sub-crate nesting by
moving them out of src/ subdirectories into direct children.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:47:58 +01:00
sjg 4e9f1d2be6 refactor: split into independent trx-server and trx-client binaries
Delete trx-bin (all-in-one) and trx-bin-common (shared lib). Each binary
now has its own config, plugins, and helper modules inlined.

- trx-server: backend-only daemon with ServerConfig (general, rig, behavior)
  no frontend dependencies
- trx-client: remote client with ClientConfig (general, remote, frontends)
  includes all frontend support (http, rigctl, http-json, qt)
- Dedicated config files: trx-server.toml / trx-client.toml

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 22:44:04 +01:00
sjg ee25271275 docs: update overview and sample config 2026-01-18 09:24:16 +01:00
sjg bceb049e0e bin: add config loader and remote client mode 2026-01-18 09:24:06 +01:00
sjg cbd500edae workspace: wire new frontends into workspace 2026-01-18 09:23:56 +01:00
sjg 74d06e7a7c frontend: add new qt, rigctl, and json frontends 2026-01-18 09:23:25 +01:00
sjg a941c77039 rig: integrate controller and rig task updates 2026-01-18 09:20:10 +01:00
sjg 1be08b245c registry: add backend/frontend registries and plugin loader 2026-01-18 09:19:37 +01:00
sjg 6ef16f2cf4 core: make rig snapshot serializable 2026-01-18 09:18:54 +01:00
sjg 025eb237b2 initial commit
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
2025-11-30 23:54:05 +01:00