35#include <SoDa/MailBox.hxx>
597 return std::make_shared<Command>(_ct, _tgt);
632 return std::make_shared<Command>(_ct, _tgt, p0, p1, p2, p3);
666 return std::make_shared<Command>(_ct, _tgt, p0, p1, p2, p3);
682 const char *cp = _str_arg.c_str();
684 for (i = 0; i < 64; i++)
696 const std::string &_str_arg,
unsigned int _tag = 0)
698 return std::make_shared<Command>(_ct, _tgt, _str_arg, _tag);
715 for (i = 0; i < 64; i++)
727 return std::make_shared<Command>(_ct, _tgt, cp, _tag);
765 return std::make_shared<Command>();
821 template<
typename... Args>
823 static_assert(
sizeof...(dvs) == numargs);
824 static_assert(numargs <= 4);
825 std::vector<double> vals = {
static_cast<double>(dvs)... };
826 for(
int i = 0; i < numargs; i++) {
827 dparms[i] = (i >= numargs) ? 0.0 : vals[i];
832 template<
typename... Args>
834 return std::make_shared<DoubleCommand<Targ, numargs>>(sgr, dvs...);
839 template<
typename... Args>
841 static_assert(
sizeof...(ivs) == numargs);
842 static_assert(numargs <= 4);
843 std::vector<int> vals = {
static_cast<int>(ivs)... };
844 for(
int i = 0; i < numargs; i++) {
850 template<
typename... Args>
852 return std::make_shared<IntCommand<Targ, numargs>>(sgr, ivs...);
858 iparms[0] =
static_cast<int>(ev);
862 ::strncpy(
sparm + 4, name.c_str(), 59);
871 return std::make_shared<EnumCommand<Targ, enum_type>>(sgr, ev);
875 return std::make_shared<EnumCommand<Targ, enum_type>>(sgr);
889 return std::make_shared<StringCommand<Targ>>(sgr, s,
tag);
892 return std::make_shared<StringCommand<Targ>>(sgr);
946 default:
return "CmdType(" + std::to_string((
int)v) +
")";
954 default:
return "ClockSource(" + std::to_string((
int)v) +
")";
966 default:
return "RxTxState(" + std::to_string((
int)v) +
")";
979 default:
return "ModulationType(" + std::to_string((
int)v) +
")";
992 default:
return "AudioFilterBW(" + std::to_string((
int)v) +
")";
1004 default:
return "UnitSelector(" + std::to_string((
int)v) +
")";
1012 default:
return "TXAudioSelector(" + std::to_string((
int)v) +
")";
This is a list of all the commands that can "do something" to one or more components in the SoDa radi...
int iparms[4]
integer parameters
static void initTables()
setup maps to support parseCommandString and toString
Command(CmdType _ct, CmdTarget _tgt, const char *cp, unsigned int _tag=0)
Constructor for commands with a string parameter.
CmdTarget target
the thing we're touching
CmdTarget
Each command has a "target" state that it is meant to modify, query, or report.
@ TX_IF_FREQ
Set/report the TX IF frequency.
@ TX_CW_TEXT
TX CW text control – a buffer of up to 8 characters.
@ RX_ANT_NAME
Report RX antenna choice (asciiz string, uint tag)
@ RX_BW
tweak the AF chain – filter settings
@ RX_AF_GAIN
RX audio gain setting.
@ RX_MODE
Set the modulation mode for the receive chain.
@ TVRT_LO_ENABLE
On receipt of a TVRT_LO_ENABLE command dump a perpetual constant IF stream of (1.0,...
@ GPS_UTC
Report UTC (time) from GPS receiver.
@ TX_SAMP_RATE
Sample rate for TX needs to be fast enough for reasonable FM We set it to 625000 just because there d...
@ GPS_LATLON
Report LAT and LON from GPS receiver.
@ LIST_MODES
Get a report of supported modes from the baseband rx module.
@ SPEC_RANGE_LOW
low spectrum frequency range
@ RX_TUNE_FREQ
Set the RX front end (1st LO, the 2nd IF LO), and the 3rd LO in a more-or-less optimal way to positio...
@ GPS_LOCK
Report when GPS is locked.
@ RX_RF_GAIN
Set the RX front end attenuator/amp.
@ LO_OFFSET
this is a GET/REP command – BaseBandRX takes FFT centered around 0 and reports largest peak within 50...
@ RX_SAMP_RATE
Sample rate for RX is typically 600 KHz or better to allow a reasonable span for the waterfall and pe...
@ AF_FILT_ENTRY
Report a string/name pair for AF filter bandwidth.
@ TX_ANT
Not many choices for TX ant, just TX.
@ TX_CW_MARKER
Put a marker in the CW text stream, report its "passing".
@ SDR_VERSION
Report the SDR (SoDa server program) version info.
@ TX_LO_FREQ
Tune the RX hardware front end local oscillator.
@ TX_ANT_NAME
Report TX antenna choice (asciiz string, uint tag)
@ RX_AF_FILTER_SHAPE
Audio Filter.
@ RX_AF_SIDETONE_GAIN
RX audio gain for sidetone (CW) monitor.
@ SPEC_BUF_LEN
number of samples in the buffer.
@ HWMB_REP
Report the motherboard name (the model name of the USRP)
@ STOP
On receipt of a STOP command, all threads should exit their run loop.
@ TX_STATE
turn transmitter on and off.
@ TX_MODE
Set the modulation mode for the transmit chain.
@ SPEC_DIMS
all spec info in one call, cf, span, and buflen
@ TX_CW_FLUSHTEXT
Flush outstanding CW text strings from pending buffer.
@ RX_IF_FREQ
Tune the software NCO (final LO) frequency to shift to baseband.
@ DBG_REP
Initiate a debug dump.
@ STATUS_MESSAGE
The STATUS_MESSAGE carries a payload of up to 64 characters.
@ SPEC_RANGE_HI
high spectrum frequency range
@ TX_AUDIO_FILT_ENA
Enable the TX audio bandpass filter (limit to 2.5 kHz) for SSB/AM/FM.
@ TX_GAIN_RANGE
Report min max TX Gain setting (dparm[0,1] = min, max)
@ TVRT_LO_CONFIG
On receipt of a TVRT_LO_CONFIG command , set the TX2 channel frequency to dparam[0] and the TX2 outpu...
@ RX_AF_FILTER
Audio Filter.
@ INIT_SETUP_COMPLETE
indicate to GUI that we've sent all the initial configuration information
@ CW_CHAR_SENT
send character count from start-of-time each time we send a character.
@ LO_CHECK
This is an LO check command - use it for finding the actual microwave LO frequency.
@ RF_RECORD_START
Start recording raw IF stream to file.
@ MOD_SEL_ENTRY
Report a string/name pair for modulation mode.
@ RF_RECORD_STOP
Stop recording raw IF stream to file.
@ TVRT_LO_DISABLE
On receipt of a TVRT_LO_DISABLE command, turn the LO output on TX2 off.
@ LIST_AF_FILTERS
Get a report of supported filters from the baseband rx module.
@ NBFM_SQUELCH
Set/Get NBMF squelch level.
@ RX_GAIN_RANGE
Report min max RX Gain setting (dparm[0,1] = min, max)
@ RX_ANT
RX ant choices are TX/RX, and RX2.
@ TX_RF_GAIN
Set the TX final amplifier.
@ TX_BEACON
TX Carrier Control – send a dead carrier.
@ RX_STATE
Ignored for now.
@ SPEC_CENTER_FREQ
the center frequency (command from GUI)
@ CLOCK_SOURCE
The master clock oscillator source Reference oscilator selector set to 1 for external,...
@ TX_CW_SPEED
Set speed of CW generator.
@ RX_CENTER_FREQ
The center frequency for IF buffers from USRPRX.
@ TX_AUDIO_IN
Select the transmit chain audio input (for SSB, AM, and FM)
@ RBW
tweak the waterfall display parameters like resolution bandwidth
@ TX_CW_EMPTY
Report when CW TX envelope buffer was empty (cmd enables report)
@ TX_TUNE_FREQ
Set the TX front end (1st LO, the 2nd IF LO), and the 3rd LO in a more-or-less optimal way to positio...
@ SPEC_AVG_WINDOW
how many FFT samples contribute to a spectrum report
@ RX_LO_FREQ
Tune the RX hardware front end local oscillator.
@ SPEC_UPDATE_RATE
how many FFT samples between spectrum reports
static int command_sequence_number
sequential ID applied to each command
static int getMaxStringLen()
how long can a string parameter to a command be?
static Command * parseCommandString(std::string str)
convert a string to a command
RxTxState
Transmit/Receive state changes go through stages.
Command(CmdType _ct, CmdTarget _tgt)
Constructor for commands with no parameters.
static std::map< CmdTarget, std::string > target_map_v2s
mapping for toString
Command(CmdType _ct, CmdTarget _tgt, const std::string &_str_arg, unsigned int _tag=0)
Constructor for commands with a string parameter.
Command(CmdType _ct, CmdTarget _tgt, double p0, double p1=0.0, double p2=0.0, double p3=0.0)
Constructor for commands with double float parameters.
Command(CmdType _ct, CmdTarget _tgt, int p0, int p1=0, int p2=0, int p3=0)
Constructor for commands with integer parameters.
std::string toString() const
return a string that displays the command
static CommandPtr make(CmdType _ct, CmdTarget _tgt, int p0, int p1=0, int p2=0, int p3=0)
ModulationType
modulation selector targets take one of these values
double dparms[4]
double float parameters
char sparm[64]
a buffer holding the string
Command()
Constructor – create an empty command.
static CommandPtr make(CmdType _ct, CmdTarget _tgt, const std::string &_str_arg, unsigned int _tag=0)
int id
a sequential ID for each command – used in debugging and sequencing
AudioFilterBW
these are the possible audio filter bandwidths
static void initTableEntry(const std::string &, CmdTarget tgt)
ClockSource
some radios support two sources for the master oscillator reference.
TXAudioSelector
a selector to identify the Audio TX input (MIC, NOISE...)
CmdType
Commands are of the form, SET, GET, or REPort some parameter.
char parm_type
is this a double, int, string?
static CommandPtr make(CmdType _ct, CmdTarget _tgt, const char *cp, unsigned int _tag=0)
Command(const Command &cc)
Copy Constructor.
static CommandPtr make(CmdType _ct, CmdTarget _tgt)
UnitSelector
a selector to identify a particular unit for debug reports
static CommandPtr make(CmdType _ct, CmdTarget _tgt, double p0, double p1=0.0, double p2=0.0, double p3=0.0)
unsigned int tag
used to pair an int with a string or other param.
static bool table_needs_init
if true, we need to call initTables()
CmdType cmd
the command type (SET, GET, REP)
static std::map< std::string, CmdTarget > target_map_s2v
mapping for parseCommandString
IntCommand< Command::SPEC_BUF_LEN, 1 > CmdSpecBufLen
IntCommand< Command::TX_CW_MARKER, 1 > CmdTXCWMarker
EnumCommand< Command::TX_MODE, Command::ModulationType > CmdTXMode
DoubleCommand< Command::RX_CENTER_FREQ, 1 > CmdRXCenterFreq
IntCommand< Command::TX_BEACON, 1 > CmdTXBeacon
DoubleCommand< Command::RX_LO_FREQ, 1 > CmdRXLOFreq
IntCommand< Command::GPS_LOCK, 1 > CmdGPSLock
StringCommand< Command::MOD_SEL_ENTRY > CmdModSelEntry
StringCommand< Command::RX_ANT_NAME > CmdRXAntName
IntCommand< Command::TX_CW_SPEED, 1 > CmdTXCWSpeed
EnumCommand< Command::CLOCK_SOURCE, Command::ClockSource > CmdClockSource
DoubleCommand< Command::TX_LO_FREQ, 1 > CmdTXLOFreq
StringCommand< Command::RX_ANT > CmdRXAnt
IntCommand< Command::TX_CW_FLUSHTEXT, 1 > CmdTXCWFlushText
StringCommand< Command::TX_ANT_NAME > CmdTXAntName
IntCommand< Command::DBG_REP, 1 > CmdDbgRep
IntCommand< Command::TX_CW_EMPTY, 1 > CmdTXCWEmpty
EnumCommand< Command::TX_AUDIO_IN, Command::TXAudioSelector > CmdTXAudioIn
std::shared_ptr< Command > CommandPtr
StringCommand< Command::SDR_VERSION > CmdSDRVersion
EnumCommand< Command::RX_MODE, Command::ModulationType > CmdRXMode
IntCommand< Command::RX_AF_FILTER, 1 > CmdRXAFFilter
IntCommand< Command::RX_BW, 1 > CmdRXBW
StringCommand< Command::TX_CW_TEXT > CmdTXCWText
IntCommand< Command::SPEC_AVG_WINDOW, 1 > CmdSpecAvgWindow
IntCommand< Command::GPS_UTC, 3 > CmdGPSUTC
StringCommand< Command::CW_CHAR_SENT > CmdCWCharSent
std::string enumToString(Command::CmdType v)
DoubleCommand< Command::RX_TUNE_FREQ, 1 > CmdRXTuneFreq
DoubleCommand< Command::RX_IF_FREQ, 1 > CmdRXIFFreq
StringCommand< Command::STATUS_MESSAGE > CmdStatusMessage
IntCommand< Command::SPEC_UPDATE_RATE, 1 > CmdSpecUpdateRate
IntCommand< Command::TX_AUDIO_FILT_ENA, 1 > CmdTXAudioFiltEna
StringCommand< Command::RF_RECORD_START > CmdRFRecordStart
StringCommand< Command::TX_ANT > CmdTXAnt
IntCommand< Command::RX_AF_FILTER_SHAPE, 1 > CmdRXAFFilterShape
DoubleCommand< Command::TX_IF_FREQ, 1 > CmdTXIFFreq
StringCommand< Command::HWMB_REP > CmdHWMBRep
EnumCommand< Command::TX_STATE, Command::RxTxState > CmdTXState
StringCommand< Command::AF_FILT_ENTRY > CmdAFFiltEntry
DoubleCommand< Command::TX_TUNE_FREQ, 1 > CmdTXTuneFreq
static CommandPtr make(CmdType sgr, Args... dvs)
DoubleCommand(CmdType sgr, Args... dvs)
static CommandPtr make(CmdType sgr, enum_type ev)
static CommandPtr make(CmdType sgr)
EnumCommand(CmdType sgr, enum_type ev)
IntCommand(CmdType sgr, Args... ivs)
static CommandPtr make(CmdType sgr, Args... ivs)
StringCommand(CmdType sgr, const std::string &s, unsigned int tag=0)
static CommandPtr make(CmdType sgr, const std::string &s, unsigned int tag=0)
StringCommand(CmdType sgr)
static CommandPtr make(CmdType sgr)