diff --git a/wfmain.cpp b/wfmain.cpp index 498edaa..3805a62 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2233,6 +2233,12 @@ void wfmain::doCmd(commandtype cmddata) emit setMode(m); break; } + case cmdSetTxPower: + { + unsigned char txpower = (*std::static_pointer_cast(data)); + emit setTxPower(txpower); + break; + } default: doCmd(cmd); break; @@ -2507,17 +2513,47 @@ void wfmain::issueDelayedCommandUnique(cmds cmd) } -void wfmain::cmdGoToFreq(freqt f) +void wfmain::issueCmd(cmds cmd, mode_info m) { commandtype cmddata; - cmddata.cmd = cmdSetFreq; - cmddata.data = std::shared_ptr(new freqt()); - *static_cast(cmddata.data.get()) = f; - //static_cast(cmddata.data.get())->Hz = f.Hz; - //static_cast(cmddata.data.get())->MHzDouble = f.MHzDouble; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new mode_info(m)); + //*static_cast(cmddata.data.get()) = mode; delayedCmdQue.push_back(cmddata); } +void wfmain::issueCmd(cmds cmd, char c) +{ + commandtype cmddata; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new char(c)); + delayedCmdQue.push_back(cmddata); +} + +void wfmain::issueCmd(cmds cmd, bool b) +{ + commandtype cmddata; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new bool(b)); + delayedCmdQue.push_back(cmddata); +} + +void wfmain::issueCmd(cmds cmd, unsigned char c) +{ + commandtype cmddata; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new unsigned char(c)); + delayedCmdQue.push_back(cmddata); +} + +void wfmain::issueCmd(cmds cmd, freqt f) +{ + commandtype cmddata; + cmddata.cmd = cmd; + cmddata.data = std::shared_ptr(new freqt(f)); + //*static_cast(cmddata.data.get()) = f; + delayedCmdQue.push_back(cmddata); +} void wfmain::receiveRigID(rigCapabilities rigCaps) { @@ -3090,7 +3126,8 @@ void wfmain::on_goFreqBtn_clicked() { f.Hz = freq*1E6; //emit setFrequency(f); - cmdGoToFreq(f); + issueCmd(cmdSetFreq, f); + //issueCmdSetFreq(f); issueDelayedCommand(cmdGetFreq); } } else { @@ -3098,8 +3135,9 @@ void wfmain::on_goFreqBtn_clicked() if(ok) { f.Hz = KHz*1E3; - cmdGoToFreq(f); + //issueCmdSetFreq(f); //emit setFrequency(f); + issueCmd(cmdSetFreq, f); issueDelayedCommand(cmdGetFreq); } } @@ -3355,7 +3393,7 @@ void wfmain::on_freqDial_valueChanged(int value) ui->freqLabel->setText(QString("%1").arg(f.MHzDouble, 0, 'f')); //emit setFrequency(f); - cmdGoToFreq(f); + issueCmd(cmdSetFreq, f); } else { ui->freqDial->blockSignals(true); ui->freqDial->setValue(oldFreqDialVal); @@ -4791,6 +4829,6 @@ void wfmain::on_debugBtn_clicked() qInfo(logSystem()) << "Debug button pressed."; freqt f; f.Hz = 14290000; - cmdGoToFreq(f); + issueCmd(cmdSetFreq, f); } diff --git a/wfmain.h b/wfmain.h index dbeb95c..890411b 100644 --- a/wfmain.h +++ b/wfmain.h @@ -586,7 +586,7 @@ private: cmdSetDataModeOn, cmdSetDataModeOff, cmdGetRitEnabled, cmdGetRitValue, cmdSpecOn, cmdSpecOff, cmdDispEnable, cmdDispDisable, cmdGetRxGain, cmdGetAfGain, cmdGetSql, cmdGetATUStatus, cmdGetSpectrumMode, cmdGetSpectrumSpan, cmdScopeCenterMode, cmdScopeFixedMode, cmdGetPTT, - cmdGetTxPower, cmdGetMicGain, cmdGetSpectrumRefLevel, cmdGetDuplexMode, cmdGetModInput, cmdGetModDataInput, + cmdGetTxPower, cmdSetTxPower, cmdGetMicGain, cmdGetSpectrumRefLevel, cmdGetDuplexMode, cmdGetModInput, cmdGetModDataInput, cmdGetCurrentModLevel, cmdStartRegularPolling, cmdStopRegularPolling, cmdQueNormalSpeed, cmdGetVdMeter, cmdGetIdMeter, cmdGetSMeter, cmdGetPowerMeter, cmdGetALCMeter, cmdGetCompMeter, cmdGetTxRxMeter, cmdGetTone, cmdGetTSQL, cmdGetDTCS, cmdGetRptAccessMode, cmdGetPreamp, cmdGetAttenuator, cmdGetAntenna}; @@ -601,7 +601,12 @@ private: std::deque slowPollCmdQueue; // slow, regular checking for UI sync void doCmd(cmds cmd); void doCmd(commandtype cmddata); - void cmdGoToFreq(freqt f); + + void issueCmd(cmds cmd, freqt f); + void issueCmd(cmds cmd, mode_info m); + void issueCmd(cmds cmd, unsigned char c); + void issueCmd(cmds cmd, char c); + void issueCmd(cmds cmd, bool b); int pCmdNum = 0; int delayedCmdIntervalLAN_ms = 100;