6. Use Case Model (ART 0508)

6.1 Actors

Actor Description
HAM Operator Primary user controlling FT-710 from browser
System Maintainer Starts service, manages serial ports, observes logs
Browser Runtime Supplies WebSocket, Web Audio, touch, microphone, Canvas
Yaesu FT-710 Radio device controlled via serial CAT, scope via FT4222 SPI, audio via USB

6.2 Core Use Cases

UC-001: Start Control Session

Field Description
Goal Open the web UI and establish control/audio/spectrum channels
Preconditions Server running, FT-710 connected via USB, browser can reach host
Basic Flow User opens http://host:8888; login page; enter password; server sets ft710_auth cookie; redirects to /; index.html loads; bodyload() connects /WSradio; on open receives fullState with bands/modes; connects /WSspectrum, /WSaudioRX, /WSaudioTX
Postconditions UI fully rendered: frequency display, mode badge, band indicator, S-meter, waterfall, multi-meter, all controls active
Exceptions Serial not connected → UI still usable; auth expired → redirect to /login; stale service worker cache

UC-002: Remote Receive Audio

Field Description
Goal Hear FT-710 RX audio in the browser
Preconditions FT-710 connected via USB; USB audio input available; /WSaudioRX connected
Basic Flow Server captures 48kHz Int16 PCM from FT-710 USB audio via PyAudio; Opus encodes; broadcasts tagged frames to audio_rx_clients; browser decodes (Opus WASM or Int16→Float32); AudioWorklet playback with jitter buffer
Postconditions Operator hears radio audio through browser/phone speakers
Exceptions PyAudio unavailable → audio disabled; Opus unavailable → PCM fallback (768kbps); AudioContext suspended (iOS) → resume on user interaction

UC-003: Tune Frequency and Mode

Field Description
Goal Change FT-710 frequency and operating mode
Preconditions /WSradio connected; CAT serial connected
Basic Flow User taps band button, tuning arrows, or mode cycle; frontend sends {"type":"set","field":"freq","value":14200000} or {"type":"set","field":"mode","value":"USB"}; server sends CAT FA014200000; or MD02;; radio responds; state updates; broadcast to all clients
Postconditions UI reflects new frequency/mode; radio follows
Notes Band select uses Band Stack Register (BS command); mode uses Yaesu mode register (0x01-0x0F)

UC-004: Monitor Spectrum and S-Meter

Field Description
Goal See signal context while listening
Preconditions Server running; scope_pipe or S-meter polling active
Basic Flow (FT4222) scope_pipe reads 4096-byte SPI frames → extracts 850-point wf1+wf2 → writes to stdout pipe → server parses → broadcasts via /WSspectrum binary → browser renders waterfall row
Basic Flow (Fallback) CAT SM0; polls at 100ms → RadioState.s_meterScopeHandler.update_from_radio_state() → synthetic multi-peak Gaussian spectrum → /WSspectrum same binary format
Waterfall Browser receives 850-byte wf1 array; appends to top of 120-row canvas; scrolls older rows down; colormap: black→blue→green→yellow→red
S-Meter Canvas horizontal bar with S1–S9+60 gradient; peak-from-spectrum or CAT SM0; dBm digital readout
Frequency Scale Auto-scaled labels below waterfall based on scope span + VFO center

UC-005: PTT and Tune Control

Field Description
Goal Key/de-key transmitter safely
Preconditions /WSradio connected; CAT serial connected
Basic Flow User touches-and-holds PTT button; handlePTTStart()sendCommand('ptt', true); server sends CAT TX1;; radio keys TX; server starts TX audio stream; user releases; handlePTTEnd()sendCommand('ptt', false); server sends CAT TX0; (fire-and-forget); stop TX audio stream; TX-status poll + PTT watchdog confirm RX
Tune Flow User taps TUNE; sendCommand('tune', true) → CAT TX2;; tap again → TX0; + verify
Safety Touch cancel (touchcancel/mouseleave) → release; dead-man switch on WS disconnect; beforeunload beacon; PTT watchdog 500ms interval
Postconditions Radio returns to RX

UC-006: Adjust Radio Settings

Field Description
Goal Change filter, preamp, attenuator, NR, NB, compressor, etc.
Preconditions /WSradio connected
Basic Flow User toggles NR switch → {"type":"set","field":"nr","value":true} → server sends CAT NR01;; state updates; broadcast. Similar for NB, AN, COMP, ATU, ATT, PRE. Sliders for NR level, NB level, RF power, AF gain, mic gain
Postconditions Radio settings updated; UI reflects new state within one poll cycle

UC-007: Manage Memory Channels

Field Description
Goal Save and recall frequency/mode to memory slots
Preconditions /WSradio connected
Basic Flow User taps memory slot → {"type":"memSave","channels":[...]} → server writes mem_channels.json → broadcasts updated channels to all clients. Tap saved channel → sends freq/mode set commands
Postconditions Memories persist across server restarts

UC-008: View Multi-Meter Telemetry

Field Description
Goal Monitor TX power, ALC, SWR, drain current/voltage
Preconditions /WSradio connected; radio may be in TX for PWR/ALC/SWR
Basic Flow Poll scheduler queries CAT RM4; (ALC), RM5; (PWR), RM6; (SWR), RM7; (Id), RM8; (Vd) at 500ms (TX) / 5s (RX) intervals; updates RadioState; broadcasts dirty fields; UI renders horizontal bar meters
Postconditions Real-time meter bars visible during TX