30 #include <boost/format.hpp> 31 #include <boost/foreach.hpp> 32 #include <hamlib/rig.h> 104 const char * longname,
108 QString sn(shortname);
109 QString ln(longname);
124 QStringList cmd_list = cmd.split(QRegularExpression(
"\\s+"), QString::SkipEmptyParts);
126 if (cmd_list.size() == 0)
return;
128 QTextStream out(socket_p);
130 QTextStream in(&lcmd, QIODevice::ReadOnly);
138 if(cmdkey.size() == 0)
continue;
147 qDebug() << QString(
"HAMLIB handler can't deal with this command [%1]\n").arg(cmd);
148 out <<
"RPRT " << RIG_EINVAL << endl;
159 double rx_freq_min = 1.0;
160 double rx_freq_max = 1.0e12;
161 double tx_freq_min = 1.0;
162 double tx_freq_max = 1.0e12;
168 int mode_mask = RIG_MODE_AM | RIG_MODE_CW |
169 RIG_MODE_USB | RIG_MODE_LSB |
170 RIG_MODE_FM | RIG_MODE_WFM | RIG_MODE_CWR;
172 out << QString(
"%1 %2 ").arg(rx_freq_min, 15,
'f').arg(rx_freq_max, 15,
'f');
173 out << QString(
"0x%1 %2 %3 ").arg(mode_mask, 0, 16).arg(-1).arg(-1);
174 out << QString(
"0x%1 0x%2\n").arg(RIG_VFO_A | RIG_VFO_B, 0, 16).arg(RIG_ANT_1 | RIG_ANT_2, 0, 16);
175 out <<
"0 0 0 0 0 0 0\n";
178 out << QString(
"%1 %2 ").arg(tx_freq_min, 15,
'f').arg(tx_freq_max, 15,
'f');
179 out << QString(
"0x%1 %2 %3 ").arg(mode_mask, 0, 16).arg(1).arg(200);
180 out << QString(
"0x%1 0x%2\n").arg(RIG_VFO_A | RIG_VFO_B, 0, 16).arg(RIG_ANT_1, 0, 16);
181 out <<
"0 0 0 0 0 0 0\n";
184 int ssb_mask = (RIG_MODE_CW | RIG_MODE_USB | RIG_MODE_LSB | RIG_MODE_CWR );
185 int amfm_mask = (RIG_MODE_AM | RIG_MODE_FM | RIG_MODE_WFM);
186 out << QString(
"0x%1 %2\n").arg(ssb_mask, 0, 16).arg(1);
187 out << QString(
"0x%1 %2\n").arg(amfm_mask, 0, 16).arg(100);
191 out << QString(
"0x%1 %2\n").arg(ssb_mask, 0, 16).arg(100);
192 out << QString(
"0x%1 %2\n").arg(ssb_mask, 0, 16).arg(500);
193 out << QString(
"0x%1 %2\n").arg(ssb_mask | amfm_mask, 0, 16).arg(2000);
194 out << QString(
"0x%1 %2\n").arg(ssb_mask | amfm_mask, 0, 16).arg(6000);
200 out <<
"1000\n1000\n1000\n";
209 out <<
"5 10 15 20 25 30 35\n";
212 out << QString(
"0x%1\n0x%1\n").arg(RIG_FUNC_NONE, 0, 16);
214 out << QString(
"0x%1\n0x%1\n").arg(RIG_LEVEL_NONE, 0, 16);
216 out << QString(
"0x%1\n0x%1\n").arg(RIG_PARM_NONE, 0, 16);
228 out <<
"RPRT 0" << endl;
236 QString resp = QString(
"%1").arg(
rx_freq, 15,
'f');
250 out <<
"RPRT 0" << endl;
259 QString resp = QString(
"%1").arg(
tx_freq, 15,
'f');
267 out <<
"RPRT 0" << endl;
284 typedef std::pair<const QString, SoDa::Command::ModulationType> h2sm_t;
287 out << delim << mp.first;
291 out <<
"RPRT 0" << endl;
297 out <<
"RPRT 0" << endl;
300 out <<
"RPRT " << RIG_EINVAL << endl;
310 QString tx_state =
tx_on ?
"1" :
"0";
311 out << tx_state << endl;
312 out <<
"RPRT 0" << endl;
317 tx_on = (tx_sel != 0);
318 out <<
"RPRT 0" << endl;
328 out << se << endl <<
tx_VFO << endl;
329 out <<
"RPRT 0" << endl;
333 in >> split_ena >>
tx_VFO;
335 out <<
"RPRT 0" << endl;
345 qDebug() <<
"called cmdQuit\n";
void reportTXOn(bool tx_on)
bool cmdMode(QTextStream &out, QTextStream &in, bool getval)
void reportTXFreq(double f)
void setModulation(SoDa::Command::ModulationType mod)
void processCommand(const QString &cmd, QTcpSocket *socket_p)
bool cmdPTT(QTextStream &out, QTextStream &in, bool getval)
std::map< QString, SoDa::Command::ModulationType > hl2soda_modmap
bool cmdSplitVFO(QTextStream &out, QTextStream &in, bool getval)
ModulationType
modulation selector targets take one of these values
std::map< QString, cmdHandler_t > set_command_map
bool cmdQuit(QTextStream &out, QTextStream &in, bool getval)
bool(HamlibHandler::* cmdHandler_t)(QTextStream &, QTextStream &, bool)
bool cmdVFO(QTextStream &out, QTextStream &in, bool getval)
void registerCommand(const char *shortname, const char *longname, cmdHandler_t handler, bool is_get)
std::map< QString, cmdHandler_t > get_command_map
void reportModulation(int mod_id)
void reportRXFreq(double f)
bool cmdDumpState(QTextStream &out, QTextStream &in, bool getval)
bool cmdSplitFreq(QTextStream &out, QTextStream &in, bool getval)
HamlibHandler(QObject *parent=0)
SoDa::Command::ModulationType modulation
std::map< SoDa::Command::ModulationType, QString > soda2hl_modmap
bool cmdFreq(QTextStream &out, QTextStream &in, bool getval)