![]() |
SoDaRadio-12.2.0-cut_dependencies:6c82803
|
SoDaCLI is a read-eval-print-loop (REPL) that connects to a running SoDaServer process and lets you send and receive SoDa::Command messages from the command line. It is useful for scripted testing, manual exploration of radio parameters, and regression harnesses.
SoDaCLI talks to SoDaServer over the same Unix-domain command socket that the Qt GUI uses. It can optionally launch SoDaServer itself before connecting.
All input typed at the prompt and all messages received from the server are appended to CLIHarnessLog.md in the current working directory.
SoDaCLI is built automatically as part of the normal CMake build:
The resulting binary is build/TestCLI/SoDaCLI.
Run the binary with no arguments. You will see a short command summary and then the prompt:
Command verbs are case-insensitive. Command target names (e.g. RX_TUNE_FREQ) are converted to upper-case automatically, so you may type them in any case.
Blank lines and lines beginning with # are ignored, which makes script files readable.
Forks and execs SoDaServer (found via PATH) with the supplied arguments, then waits up to 30 seconds for the server's command socket file to appear, and finally connects to it.
The socket base name is extracted from the --uds_name or -S argument if present; otherwise the SoDaServer default /tmp/SoDa_ is used, giving a command socket at /tmp/SoDa__cmd.
Example — connect to a USRP at IP address 192.168.10.2:
Sends a SET command to SoDaServer. The target name must appear in the SoDa::Command::CmdTarget enumeration (see Command.hxx).
The optional type indicator selects the parameter encoding:
I — integer (enum names are also accepted, see Parameter Types and Enum Names)D — double-precision floatS — character stringWhen no type indicator is given the type is inferred from the value:
. , e , or E → doubleExamples:
Sends a GET request to SoDaServer. The server will typically respond with a REP message on the command socket, which SoDaCLI prints automatically (see Incoming Messages).
Example:
Sends a REP (report) command. The syntax is identical to SET. REP is seldom needed from the CLI; it is included for completeness and for test harness use.
Opens filename and processes each line as if it were typed at the prompt. The filename argument is case-sensitive on Linux. Script execution stops immediately if a line causes an error; the file is then closed.
Incoming server messages are drained after each script line.
Example script file init.cli:
Run it with:
Controls real-time audio I/O between SoDaCLI and SoDaServer. Audio is exchanged as raw 32-bit float PCM samples at 48 000 Hz, mono, over Unix-domain sockets that SoDaServer creates alongside the command socket.
Each audio direction runs in its own Qt thread with a private event loop, so audio processing never blocks the REPL.
AUDIO LIST — print all available audio output and input devices, one per line. The system default device for each direction is marked with an asterisk. Use the device description (or a unique substring of it) as the argument to AUDIO OUT or AUDIO IN. This command does not require a server connection.
AUDIO OUT [device] — start receiving demodulated audio from SoDaServer and play it through the named output device. The initial volume is 0 (muted). Use AUDIO VOLUME to unmute. If device is omitted or "default", the system default output device is used. A substring match (case-insensitive) against the device description is performed, so "Headphones" matches "Built-in Headphones".
AUDIO VOLUME v — set playback volume to v, a linear floating-point factor in [0.0, 1.0]. This command is valid only after AUDIO OUT.
AUDIO IN [device] — start capturing microphone audio and forwarding it to SoDaServer. The initial gain is 0 (muted). Use AUDIO GAIN to unmute. Device matching follows the same rules as AUDIO OUT.
AUDIO GAIN g — set the capture gain multiplier to g. A value of 1.0 means unity gain; values above 1.0 amplify the captured samples. This command is valid only after AUDIO IN.
AUDIO TEST [device] — toggle a 440 Hz sine-wave tone at 0.2 amplitude (−14 dBFS) through the named output device. Run a second time to stop. This command does not require a server connection; it is useful for verifying that audio output is working before connecting to SoDaServer. Device matching follows the same rules as AUDIO OUT. If device is omitted, the system default output device is used.
The server's audio socket paths are derived from the socket base name in the same way as the command socket:
{basename}_rxa — server → CLI (receive audio, use with AUDIO OUT){basename}_txa — CLI → server (transmit audio, use with AUDIO IN)Example:
Sends SET STOP to SoDaServer, waits one second for any final messages, stops any active audio threads, disconnects from the socket, then exits SoDaCLI. If SoDaServer was started with the START command, the server process is also reaped.
While waiting for user input SoDaCLI polls the command socket for inbound messages from the server. Any arriving SET, GET, or REP message is pretty-printed to stdout (using SoDa::Command::toString()) and logged:
After every command sent the socket is also drained, so short request-reply exchanges work naturally.
When a target takes an integer parameter drawn from a named enumeration you may supply the symbolic name instead of the integer. The following names are recognised:
| Enumeration | Names |
|---|---|
| ModulationType | LSB USB CW_U CW_L AM WBFM NBFM |
| RxTxState | TX_OFF_0 TX_OFF_1 TX_OFF_2 TX_ON_0 TX_ON_1 TX_ON_2 |
| ClockSource | EXTERNAL INTERNAL |
| TXAudioSelector | MIC NOISE |
For targets not listed above, supply the raw integer value.
The full list of command targets is defined in SoDa::Command::CmdTarget. Commonly used targets and their expected parameter types are:
| Target | Type | Description |
|---|---|---|
| RX_TUNE_FREQ | double | RX centre frequency (Hz) |
| TX_TUNE_FREQ | double | TX centre frequency (Hz) |
| RX_MODE | int | Modulation mode (see ModulationType) |
| TX_MODE | int | TX modulation mode |
| RX_RF_GAIN | double | RX front-end gain (dB) |
| TX_RF_GAIN | double | TX amplifier gain (dB) |
| RX_AF_GAIN | double | RX audio gain |
| TX_STATE | int | Transmit on/off state (see RxTxState) |
| TX_CW_SPEED | int | CW keyer speed (WPM) |
| TX_CW_TEXT | string | CW text to send (up to 8 chars) |
| CLOCK_SOURCE | int | Reference clock (INTERNAL or EXTERNAL) |
| SDR_VERSION | — | GET only; server reports version string |
| HWMB_REP | — | GET only; server reports motherboard name |
| STOP | — | Shut down all server threads |
SoDaCLI appends all session activity to CLIHarnessLog.md in the current working directory. Each session begins with a Markdown heading:
Log entry prefixes:
INPUT: — a line typed by the userSEND: — a command transmitted to the serverRECV: — a message received from the serverSTATUS: — a connection lifecycle eventRUN: — a script file executedERROR: — a parse or I/O error