From f8beed5531ec3352d52ad2fecdb3add650b96a3c Mon Sep 17 00:00:00 2001 From: Steve Netting Date: Wed, 26 May 2021 16:21:32 +0300 Subject: [PATCH 01/37] added Fedora build/install notes --- INSTALL.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/INSTALL.md b/INSTALL.md index e725619..050a71b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -99,3 +99,27 @@ in this case, use your homedir: wfview is now installed in /usr/local/bin --- + +### Fedora install ### +--- + +Tested under Fedora 33/34. + +Install qt5 dependencies: +- sudo dnf install qt5-qtbase-common qt5-qtbase qt5-qtbase-gui qt5-qtserialport qt5-qtmultimedia mingw64-qt5-qmake qt5-qtbase-devel qt5-qtserialport-devel qt5-qtmultimedia-devel + +Install qcustomplot: +- sudo dnf install qcustomplot qcustomplot-devel + +When done, create a build area, clone the repo, build and install: + +- mkdir -p ~/src/build && cd src +- git clone https://gitlab.com/eliggett/wfview.git +- cd build +- qmake-qt5 ../wfview/wfview.pro +- make -j +- sudo ./install.sh + +wfview is now installed in /usr/local/bin + +--- From a777864a0bd7ada7c47b373db4082b5e6a522c8b Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Mon, 26 Jul 2021 09:03:09 -0700 Subject: [PATCH 02/37] Fixed error in IC-7410 attenuator spec. --- rigcommander.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 61b9c89..4c350a2 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -3100,7 +3100,7 @@ void rigCommander::determineRigCaps() rigCaps.hasATU = true; rigCaps.hasCTCSS = true; rigCaps.hasDTCS = true; - rigCaps.attenuators.push_back('\x12'); + rigCaps.attenuators.push_back('\x20'); rigCaps.preamps.push_back('\x01'); rigCaps.preamps.push_back('\x02'); rigCaps.antennas = {0x00, 0x01}; From 2403f5352adce212474a78e245f0b56b78ed0b44 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Mon, 26 Jul 2021 19:50:40 +0200 Subject: [PATCH 03/37] changelog --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 84d29a0..9a9d6af 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # CHANGELOG +- 20210726 + + Fix for blank username/password in server + - 20210724 small changes to INSTAll.md and addition of mint 20.2/openSUSE 15.3 From 7992d6f870b2edc92a20c0c40ac629dd32da96d6 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Thu, 29 Jul 2021 10:53:57 +0200 Subject: [PATCH 04/37] added /usr/local to search path for the stylesheet --- wfmain.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index a5b9f08..d73de2f 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2225,11 +2225,11 @@ void wfmain::setAppTheme(bool isCustom) QFile f(":"+prefs.stylesheetPath); // built-in resource #else QFile f("/usr/share/wfview/stylesheets/" + prefs.stylesheetPath); + QFile g("/usr/local/share/wfview/stylesheets/" + prefs.stylesheetPath); #endif if (!f.exists()) { - printf("Unable to set stylesheet, file not found\n"); - printf("Tried to load: [%s]\n", QString( QString("/usr/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); + printf("Unable to set stylesheet, file not found or permission issue [%s]\n", QString( QString("/usr/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); } else { @@ -2237,6 +2237,18 @@ void wfmain::setAppTheme(bool isCustom) QTextStream ts(&f); qApp->setStyleSheet(ts.readAll()); } + + if (!g.exists()) + { + printf("Unable to set stylesheet, file not found or permisson issue [%s]\n", QString( QString("/usr/local/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); + } + else + { + g.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&g); + qApp->setStyleSheet(ts.readAll()); + } + } else { qApp->setStyleSheet(""); } From 2ac1b8c0acb6a6c6a3f4374f050aa828f07fa7a5 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Thu, 29 Jul 2021 11:28:45 +0200 Subject: [PATCH 05/37] fix: set the style once --- wfmain.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index d73de2f..cb69885 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2224,32 +2224,38 @@ void wfmain::setAppTheme(bool isCustom) #ifndef Q_OS_LINUX QFile f(":"+prefs.stylesheetPath); // built-in resource #else - QFile f("/usr/share/wfview/stylesheets/" + prefs.stylesheetPath); - QFile g("/usr/local/share/wfview/stylesheets/" + prefs.stylesheetPath); +// two paths are possible - fu = /usr; fl = /usr/local + QFile fu("/usr/share/wfview/stylesheets/" + prefs.stylesheetPath); + QFile fl("/usr/local/share/wfview/stylesheets/" + prefs.stylesheetPath); #endif - if (!f.exists()) + +// check if the filepath is in /usr and if so -- set the style and return + if (!fu.exists()) { printf("Unable to set stylesheet, file not found or permission issue [%s]\n", QString( QString("/usr/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); } else { - f.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&f); + fu.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&fu); qApp->setStyleSheet(ts.readAll()); + return; } - if (!g.exists()) +// if above fails, check if filepath is in /usr/local and if so -- set the style from there and return + if (!fl.exists()) { printf("Unable to set stylesheet, file not found or permisson issue [%s]\n", QString( QString("/usr/local/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); } else { - g.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&g); + fl.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&fl); qApp->setStyleSheet(ts.readAll()); + return; } - } else { +// if both fail, we revert to no style sheet set qApp->setStyleSheet(""); } } From 4e63a72106d6da3eb87e28f263415d54fc722947 Mon Sep 17 00:00:00 2001 From: Elliott Liggett Date: Fri, 30 Jul 2021 17:30:34 -0700 Subject: [PATCH 06/37] Added a little extra logic, also some cross-platform help, to the custom stylesheet loader. --- wfmain.cpp | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index cb69885..4d0c196 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2222,40 +2222,52 @@ void wfmain::setAppTheme(bool isCustom) if(isCustom) { #ifndef Q_OS_LINUX - QFile f(":"+prefs.stylesheetPath); // built-in resource -#else -// two paths are possible - fu = /usr; fl = /usr/local - QFile fu("/usr/share/wfview/stylesheets/" + prefs.stylesheetPath); - QFile fl("/usr/local/share/wfview/stylesheets/" + prefs.stylesheetPath); -#endif - -// check if the filepath is in /usr and if so -- set the style and return - if (!fu.exists()) + QFile fresource(":"+prefs.stylesheetPath); // built-in resource + if (!fresource.exists()) { - printf("Unable to set stylesheet, file not found or permission issue [%s]\n", QString( QString("/usr/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); + // This would be quite unusual... + qApp->setStyleSheet(""); + return; } else { - fu.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&fu); + fresource.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&fresource); qApp->setStyleSheet(ts.readAll()); return; } +#else +// two paths are possible - fusr = /usr; flocal = /usr/local + QFile fusr("/usr/share/wfview/stylesheets/" + prefs.stylesheetPath); + QFile flocal("/usr/local/share/wfview/stylesheets/" + prefs.stylesheetPath); + +// check if the filepath is in /usr and if so -- set the style and return + if (fusr.exists()) + { + fusr.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&fusr); + qApp->setStyleSheet(ts.readAll()); + return; + } + // if above fails, check if filepath is in /usr/local and if so -- set the style from there and return - if (!fl.exists()) + if (flocal.exists()) { - printf("Unable to set stylesheet, file not found or permisson issue [%s]\n", QString( QString("/usr/local/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); - } - else - { - fl.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&fl); + flocal.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&flocal); qApp->setStyleSheet(ts.readAll()); - return; + return; } + + // Still here? Then we could not find a file: + printf("Unable to set stylesheet, file not found or permisson issue. Tried loading [%s] and ", QString( QString("/usr/local/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); + printf(" [%s]\n", QString( QString("/usr/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); + printf("Unsetting stylesheet."); + qApp->setStyleSheet(""); +#endif } else { -// if both fail, we revert to no style sheet set + // Not custom, proceed without: qApp->setStyleSheet(""); } } From 472709357805cdfdf6de24888397e0d768c25cce Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sun, 1 Aug 2021 13:55:44 +0200 Subject: [PATCH 07/37] added derSuessmann additions to have a linux install prefix --- INSTALL.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 6df4ada..11df8c7 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -40,15 +40,16 @@ git clone https://gitlab.com/eliggett/wfview.git ~~~ ### 3. Create a build directory, compile, and install: +If you want to change the default install path from `/usr/local` to a different prefix (e.g. `/opt`), you must call `qmake ../wfview/wfview.pro PREFIX=/opt` + ~~~ mkdir build cd build qmake ../wfview/wfview.pro make -j -sudo ./install.sh +sudo make install ~~~ - ### 4. You can now launch wfview, either from the terminal or from your desktop environment. If you encounter issues using the serial port, run the following command: ~~~ @@ -65,7 +66,7 @@ sudo usermod -aG dialout $USER ~~~ -### opensuse/sles/tumbleweed install ### +### opensuse/sles/tumbleweed install --- install wfview on suse 15.x sles 15.x or tumbleweed; this was done on a clean install/updated OS. From 680262b4d2ef00b49fa3e98e0f41c0ab4d6a816f Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Sun, 1 Aug 2021 13:58:47 +0200 Subject: [PATCH 08/37] added derSuessmann additions to have a linux install prefix --- wfview.pro | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/wfview.pro b/wfview.pro index 86d16a4..9c56e55 100644 --- a/wfview.pro +++ b/wfview.pro @@ -38,6 +38,12 @@ equals(QT_ARCH, arm): DEFINES += USE_NEON DEFINES += OUTSIDE_SPEEX DEFINES += RANDOM_PREFIX=wf +isEmpty(PREFIX) { + PREFIX = /usr/local +} + +DEFINES += PREFIX=\\\"$$PREFIX\\\" + # Choose audio system, uses QTMultimedia if both are commented out. # DEFINES += RTAUDIO # DEFINES += PORTAUDIO @@ -74,18 +80,25 @@ win32:DEFINES += UNAME=\\\"build\\\" RESOURCES += qdarkstyle/style.qrc \ resources/resources.qrc +unix:target.path = $$PREFIX/bin +INSTALLS += target + # Why doesn't this seem to do anything? DISTFILES += resources/wfview.png \ resources/install.sh DISTFILES += resources/wfview.desktop -linux:QMAKE_POST_LINK += cp ../wfview/resources/wfview.png .; -linux:QMAKE_POST_LINK += cp ../wfview/resources/wfview.desktop .; -linux:QMAKE_POST_LINK += cp ../wfview/resources/install.sh .; -linux:QMAKE_POST_LINK += cp -r ../wfview/qdarkstyle .; -linux:QMAKE_POST_LINK += chmod 755 install.sh; -linux:QMAKE_POST_LINK += echo; echo; echo "Run install.sh as root from the build directory to install."; echo; echo; +unix:applications.files = resources/wfview.desktop +unix:applications.path = $$PREFIX/share/applications +INSTALLS += applications +unix:pixmaps.files = resources/wfview.png +unix:pixmaps.path = $$PREFIX/share/pixmaps +INSTALLS += pixmaps + +unix:stylesheets.files = qdarkstyle +unix:stylesheets.path = $$PREFIX/share/wfview +INSTALLS += stylesheets # Do not do this, it will hang on start: # CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT From eddc5d42ba7e237f2ca87f02d7c5cb363b067b20 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 1 Aug 2021 18:34:32 +0100 Subject: [PATCH 09/37] Fix broken 8bit audio --- audiohandler.cpp | 4 ++-- audiohandler.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/audiohandler.cpp b/audiohandler.cpp index 9b99d0a..3bd256f 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -470,7 +470,7 @@ void audioHandler::incomingAudio(audioPacket inPacket) { for (int g = setup.radioChan; g <= devChannels; g++) { - if (isUlaw) + if (setup.ulaw) *out++ = ulaw_decode[(quint8)inPacket.data[f]] * this->volume; else *out++ = (qint16)(((quint8)inPacket.data[f] << 8) - 32640 * this->volume); @@ -620,7 +620,7 @@ void audioHandler::getNextAudioChunk(QByteArray& ret) for (int f = 0; f < outPacket.length(); f++) { quint8 outdata = 0; - if (isUlaw) { + if (setup.ulaw) { qint16 enc = qFromLittleEndian(in + f); if (enc >= 0) outdata = ulaw_encode[enc]; diff --git a/audiohandler.h b/audiohandler.h index 4e7a3f2..8fc730d 100644 --- a/audiohandler.h +++ b/audiohandler.h @@ -155,9 +155,7 @@ private: #endif SpeexResamplerState* resampler = Q_NULLPTR; - bool isUlaw; quint16 audioLatency; - bool isInput; // Used to determine whether input or output audio unsigned int chunkSize; bool chunkAvailable; From bee4f03edb6edf534c2cfe71c5219a5b2a7cb382 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Mon, 2 Aug 2021 08:06:19 +0200 Subject: [PATCH 10/37] added derSuessman prefix code --- wfmain.cpp | 51 +++++++++------------------------------------------ 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/wfmain.cpp b/wfmain.cpp index 4d0c196..b5d1497 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -2222,52 +2222,22 @@ void wfmain::setAppTheme(bool isCustom) if(isCustom) { #ifndef Q_OS_LINUX - QFile fresource(":"+prefs.stylesheetPath); // built-in resource - if (!fresource.exists()) + QFile f(":"+prefs.stylesheetPath); // built-in resource +#else + QFile f(PREFIX "/share/wfview/" + prefs.stylesheetPath); +#endif + if (!f.exists()) { - // This would be quite unusual... - qApp->setStyleSheet(""); - return; + printf("Unable to set stylesheet, file not found\n"); + printf("Tried to load: [%s]\n", f.fileName().toStdString().c_str() ); } else { - fresource.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&fresource); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream ts(&f); qApp->setStyleSheet(ts.readAll()); - return; } - -#else -// two paths are possible - fusr = /usr; flocal = /usr/local - QFile fusr("/usr/share/wfview/stylesheets/" + prefs.stylesheetPath); - QFile flocal("/usr/local/share/wfview/stylesheets/" + prefs.stylesheetPath); - -// check if the filepath is in /usr and if so -- set the style and return - if (fusr.exists()) - { - fusr.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&fusr); - qApp->setStyleSheet(ts.readAll()); - return; - } - -// if above fails, check if filepath is in /usr/local and if so -- set the style from there and return - if (flocal.exists()) - { - flocal.open(QFile::ReadOnly | QFile::Text); - QTextStream ts(&flocal); - qApp->setStyleSheet(ts.readAll()); - return; - } - - // Still here? Then we could not find a file: - printf("Unable to set stylesheet, file not found or permisson issue. Tried loading [%s] and ", QString( QString("/usr/local/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); - printf(" [%s]\n", QString( QString("/usr/share/wfview/stylesheets/") + prefs.stylesheetPath).toStdString().c_str() ); - printf("Unsetting stylesheet."); - qApp->setStyleSheet(""); -#endif } else { - // Not custom, proceed without: qApp->setStyleSheet(""); } } @@ -3955,9 +3925,6 @@ void wfmain::on_bandGenbtn_clicked() void wfmain::on_aboutBtn_clicked() { abtBox->show(); - - - } void wfmain::on_fStoBtn_clicked() From ee2cf70dc046f161fa4d3be61174d9a90397c79b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Wed, 4 Aug 2021 20:49:32 +0100 Subject: [PATCH 11/37] Add rigctld config to ui and fix some bugs --- rigcommander.cpp | 7 +++- rigcommander.h | 1 + rigctld.cpp | 76 ++++++++++++++++++++++++++++++------------ rigctld.h | 1 + wfmain.cpp | 44 +++++++++++++++++++----- wfmain.h | 3 ++ wfmain.ui | 22 +++++++++++- wfview.vcxproj | 64 +++++++++++++++++++++++++++++++---- wfview.vcxproj.filters | 27 +++++++++++++++ 9 files changed, 208 insertions(+), 37 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index efff77c..5226d57 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -140,7 +140,7 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs, aud // data from the comm port to the program: emit commReady(); - emit stateInfo(&rigState); + sendState(); // Send current rig state to rigctld pttAllowed = true; // This is for developing, set to false for "safe" debugging. Set to true for deployment. @@ -3785,6 +3785,11 @@ QByteArray rigCommander::stripData(const QByteArray &data, unsigned char cutPosi return rtndata; } +void rigCommander::sendState() +{ + emit stateInfo(&rigState); +} + void rigCommander::getDebug() { // generic debug function for development. diff --git a/rigcommander.h b/rigcommander.h index 676d07f..170476d 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -270,6 +270,7 @@ public slots: // Housekeeping: void handleStatusUpdate(const QString text); + void sendState(); void getDebug(); signals: diff --git a/rigctld.cpp b/rigctld.cpp index 7eff599..ab7c1b4 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -9,6 +9,7 @@ rigCtlD::rigCtlD(QObject* parent) : rigCtlD::~rigCtlD() { + qInfo(logRigCtlD()) << "closing rigctld"; } void rigCtlD::receiveFrequency(freqt freq) @@ -124,7 +125,6 @@ void rigCtlClient::socketReadyRead() } QStringList command = commandBuffer.mid(num).split(" "); - if (command[0] == 0xf0 || command[0]=="chk_vfo") { if (longReply) @@ -146,7 +146,12 @@ void rigCtlClient::socketReadyRead() if (command.length()>1) { freqt freq; - freq.Hz = command[1].toInt(); + bool ok; + double newFreq = command[1].toDouble(&ok); + if (ok) { + freq.Hz = static_cast(newFreq); + } + qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); emit parent->setFrequency(freq); } sendData(QString("RPRT 0\n")); @@ -180,9 +185,23 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "M" || command[0] == "set_mode") { // Set mode - if (command.length() > 1) { - qInfo(logRigCtlD()) << "setting mode: " << getMode(command[1]); - emit parent->setMode(getMode(command[1]), 0x06); + if (command.length() > 2) { + + qInfo(logRigCtlD()) << "setting mode: " << getMode(command[1]) << command[1] << "width" << command[2]; + int width = command[2].toInt(); + + if (width != -1 && width <= 1800) + width = 2; + else + width = 1; + + emit parent->setMode(getMode(command[1]), width); + if (command[1].mid(0, 3) == "PKT") { + emit parent->setDataMode(true, width); + } + else { + emit parent->setDataMode(false, 0x01); + } } sendData(QString("RPRT 0\n")); } @@ -295,36 +314,51 @@ QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) { } QString rigCtlClient::getMode(unsigned char mode, bool datamode) { - (void)datamode; + + QString ret; + if (datamode) { + return ret="PKT"; + } + switch (mode) { case 0: - return QString("LSB"); + ret.append("LSB"); + break; case 1: - return QString("USB"); + ret.append("USB"); + break; case 2: - return QString("AM"); + ret.append("AM"); + break; case 3: - return QString("CW"); + ret.append("CW"); + break; case 4: - return QString("RTTY"); + ret.append("RTTY"); + break; case 5: - return QString("FM"); + ret.append("FM"); + break; case 6: - return QString("WFM"); + ret.append("WFM"); + break; case 7: - return QString("CWR"); + ret.append("CWR"); + break; case 8: - return QString("RTTYR"); + ret.append("RTTYR"); + break; case 12: - return QString("PKTUSB"); + ret.append("USB"); + break; case 17: - return QString("PKTLSB"); + ret.append("LSB"); + break; case 22: - return QString("PKTFM"); - default: - return QString(""); + ret.append("FM"); + break; } - return QString(""); + return ret; } unsigned char rigCtlClient::getMode(QString modeString) { diff --git a/rigctld.h b/rigctld.h index 8694f4b..257509b 100644 --- a/rigctld.h +++ b/rigctld.h @@ -33,6 +33,7 @@ signals: void setFrequency(freqt freq); void setPTT(bool state); void setMode(unsigned char mode, unsigned char modeFilter); + void setDataMode(bool dataOn, unsigned char modeFilter); public slots: virtual void incomingConnection(qintptr socketDescriptor); diff --git a/wfmain.cpp b/wfmain.cpp index a5b9f08..a353cf4 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -175,13 +175,6 @@ void wfmain::openRig() qDebug(logSystem()) << "Remote host name specified by user: " << hostCL; } - // Start rigctld - if (prefs.enableRigCtlD && rigCtl == Q_NULLPTR) { - rigCtl = new rigCtlD(this); - - rigCtl->startServer(prefs.rigCtlPort); - connect(this, SIGNAL(sendRigCaps(rigCapabilities)), rigCtl, SLOT(receiveRigCaps(rigCapabilities))); - } makeRig(); @@ -405,8 +398,10 @@ void wfmain::makeRig() if (rigCtl != Q_NULLPTR) { connect(rig, SIGNAL(stateInfo(rigStateStruct*)), rigCtl, SLOT(receiveStateInfo(rigStateStruct*))); + connect(this, SIGNAL(requestRigState()), rig, SLOT(sendState())); connect(rigCtl, SIGNAL(setFrequency(freqt)), rig, SLOT(setFrequency(freqt))); connect(rigCtl, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char))); + connect(rigCtl, SIGNAL(setDataMode(bool, unsigned char)), rig, SLOT(setDataMode(bool, unsigned char))); connect(rigCtl, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool))); } } @@ -425,7 +420,7 @@ void wfmain::removeRig() delete rigThread; delete rig; - + rig = Q_NULLPTR; } } @@ -1367,7 +1362,11 @@ void wfmain::loadSettings() ui->connectBtn->setEnabled(true); prefs.enableRigCtlD = settings->value("EnableRigCtlD", defPrefs.enableRigCtlD).toBool(); + ui->enableRigctldChk->setChecked(prefs.enableRigCtlD); prefs.rigCtlPort = settings->value("RigCtlPort", defPrefs.rigCtlPort).toInt(); + ui->rigctldPortTxt->setText(QString("%1").arg(prefs.rigCtlPort)); + // Call the function to start rigctld if enabled. + on_enableRigctldChk_clicked(prefs.enableRigCtlD); udpPrefs.ipAddress = settings->value("IPAddress", udpDefPrefs.ipAddress).toString(); ui->ipAddressTxt->setEnabled(ui->lanEnableBtn->isChecked()); @@ -5247,6 +5246,35 @@ void wfmain::on_meter2selectionCombo_activated(int index) (void)index; } +void wfmain::on_enableRigctldChk_clicked(bool checked) +{ + if (rigCtl != Q_NULLPTR) + { + rigCtl->disconnect(); + delete rigCtl; + rigCtl = Q_NULLPTR; + } + + if (checked) { + // Start rigctld + rigCtl = new rigCtlD(this); + rigCtl->startServer(prefs.rigCtlPort); + connect(this, SIGNAL(sendRigCaps(rigCapabilities)), rigCtl, SLOT(receiveRigCaps(rigCapabilities))); + if (rig != Q_NULLPTR) { + // We are already connected to a rig. + connect(rig, SIGNAL(stateInfo(rigStateStruct*)), rigCtl, SLOT(receiveStateInfo(rigStateStruct*))); + connect(rigCtl, SIGNAL(setFrequency(freqt)), rig, SLOT(setFrequency(freqt))); + connect(rigCtl, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char))); + connect(rigCtl, SIGNAL(setDataMode(bool, unsigned char)), rig, SLOT(setDataMode(bool, unsigned char))); + connect(rigCtl, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool))); + emit sendRigCaps(rigCaps); + emit requestRigState(); + } + } + prefs.enableRigCtlD = checked; +} + + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { diff --git a/wfmain.h b/wfmain.h index a119c77..8835f32 100644 --- a/wfmain.h +++ b/wfmain.h @@ -153,6 +153,7 @@ signals: void initServer(); void sendServerConfig(SERVERCONFIG conf); void sendRigCaps(rigCapabilities caps); + void requestRigState(); private slots: void updateSizes(int tabIndex); @@ -472,6 +473,8 @@ private slots: void on_meter2selectionCombo_activated(int index); + void on_enableRigctldChk_clicked(bool checked); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); diff --git a/wfmain.ui b/wfmain.ui index fe15c95..d55ba9b 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2232,7 +2232,7 @@ - + Qt::Horizontal @@ -2244,6 +2244,26 @@ + + + + Qt::RightToLeft + + + Enable RigCtld + + + + + + + Port + + + + + + diff --git a/wfview.vcxproj b/wfview.vcxproj index 2502415..6d319a1 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -57,7 +57,7 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="ea09e1f";HOST="wfview.org";UNAME="build";QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="eddc5d4";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false MultiThreadedDLL @@ -67,12 +67,13 @@ true shell32.lib;%(AdditionalDependencies) - C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.6.11-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) + C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true false true false + true $(OutDir)\wfview.exe true Windows @@ -84,7 +85,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"ea09e1f\";HOST=\"wfview.org\";UNAME=\"build\";QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"eddc5d4\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h @@ -98,7 +99,7 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="ea09e1f";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="eddc5d4";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true @@ -107,7 +108,7 @@ true shell32.lib;%(AdditionalDependencies) - C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.6.11-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) + C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions) true true @@ -123,10 +124,11 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"ea09e1f\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"eddc5d4\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h + @@ -144,12 +146,23 @@ + + + + + + + + + + + @@ -161,6 +174,7 @@ + @@ -269,6 +283,16 @@ + + + + + + + + + + @@ -320,6 +344,8 @@ + + Document true @@ -362,6 +388,10 @@ + + + + @@ -369,6 +399,17 @@ + + + + + + + + + + + @@ -401,6 +442,17 @@ + + + + + + + + + + + diff --git a/wfview.vcxproj.filters b/wfview.vcxproj.filters index bc7845e..d78480d 100644 --- a/wfview.vcxproj.filters +++ b/wfview.vcxproj.filters @@ -57,6 +57,9 @@ + + Source Files + Source Files @@ -108,6 +111,9 @@ Source Files + + Source Files + Source Files @@ -122,12 +128,18 @@ + + Header Files + Header Files Header Files + + Header Files + Header Files @@ -182,6 +194,9 @@ Header Files + + Header Files + Header Files @@ -207,6 +222,8 @@ + + Generated Files @@ -239,6 +256,10 @@ + + + + @@ -246,6 +267,9 @@ + + Form Files + Form Files @@ -255,6 +279,9 @@ Form Files + + Form Files + Form Files From 1e2a0db60423eed3927c5e8ef0b54333a7d0a32b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 5 Aug 2021 01:23:15 +0100 Subject: [PATCH 12/37] More rigctld fixes --- rigcommander.cpp | 2 + rigcommander.h | 2 + rigctld.cpp | 103 +++++++++++++++++++++++++++++++++++++---------- rigctld.h | 3 +- wfmain.cpp | 10 +++++ wfmain.h | 2 + 6 files changed, 100 insertions(+), 22 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 5226d57..f6fa8d8 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -25,6 +25,8 @@ rigCommander::rigCommander() rigState.filter = 0; rigState.mode = 0; rigState.ptt = 0; + rigState.currentVfo = 0; + rigState.splitEnabled = 0; } rigCommander::~rigCommander() diff --git a/rigcommander.h b/rigcommander.h index 170476d..ebb03f6 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -62,9 +62,11 @@ struct timekind { struct rigStateStruct { freqt vfoAFreq; freqt vfoBFreq; + unsigned char currentVfo; unsigned char ptt; unsigned char mode; unsigned char filter; + unsigned char splitEnabled; bool datamode; // Tones quint16 ctcss; diff --git a/rigctld.cpp b/rigctld.cpp index ab7c1b4..384b3c9 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -83,6 +83,7 @@ void rigCtlClient::socketReadyRead() static QString sep = " "; static int num = 0; bool longReply = false; + unsigned char responseCode = 0; if (commandBuffer.endsWith('\n')) { qDebug(logRigCtlD()) << sessionId << "command received" << commandBuffer; @@ -108,17 +109,18 @@ void rigCtlClient::socketReadyRead() else if (commandBuffer[num] == "+") { sep = "\n"; - } - - else if (commandBuffer[num].toLower() == "q") - { - closeSocket(); + num++; } else if (commandBuffer[num] == "#") { return; } - else if (commandBuffer[num] == "\\") + else if (commandBuffer[num].toLower() == "q") + { + closeSocket(); + } + + if (commandBuffer[num] == "\\") { num++; longReply = true; @@ -127,10 +129,7 @@ void rigCtlClient::socketReadyRead() if (command[0] == 0xf0 || command[0]=="chk_vfo") { - if (longReply) - sendData(QString("0\n")); - else - sendData(QString("0\n")); + sendData(QString("%1\n").arg(rigState->currentVfo)); } else if (command[0] == "dump_state") { @@ -139,7 +138,12 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "f" || command[0] == "get_freq") { - sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz)); + if (rigState->currentVfo == 0) { + sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz)); + } + else { + sendData(QString("%1\n").arg(rigState->vfoBFreq.Hz)); + } } else if (command[0] == "F" || command[0] == "set_freq") { @@ -154,17 +158,17 @@ void rigCtlClient::socketReadyRead() qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); emit parent->setFrequency(freq); } - sendData(QString("RPRT 0\n")); + sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "1" || command[0] == "dump_caps") { dumpCaps(sep); } - else if (command[0] == "t") + else if (command[0] == "t" || command[0] == "get_ptt") { sendData(QString("%1\n").arg(rigState->ptt)); } - else if (command[0] == "T") + else if (command[0] == "T" || command[0] == "set_ptt") { if (command.length()>1 && command[1] == "0") { emit parent->setPTT(false); @@ -172,15 +176,72 @@ void rigCtlClient::socketReadyRead() else { emit parent->setPTT(true); } - sendData(QString("RPRT 0\n")); + sendData(QString("RPRT %1\n").arg(responseCode)); } - else if (command[0] == "v" || command[0] == "get_vfo") + else if (command[0] == "v" || command[0] == "get_vfo") { - sendData(QString("VFOA\n")); + if (rigState->currentVfo == 0) { + sendData(QString("%1\n").arg("VFOA")); + } + else { + sendData(QString("%1\n").arg("VFOB")); + } } - else if (command[0] == "m" || command[0] == "get_mode") + else if (command[0] == "V" || command[0] == "set_vfo") { - sendData(QString("%1\n%2\n").arg(getMode(rigState->mode,rigState->datamode)).arg(getFilter(rigState->mode,rigState->filter))); + qDebug(logRigCtlD()) << QString("Got VFO command: %1").arg(command[1]); + if (command.length() > 1 && command[1] == "VFOB") { + emit parent->setVFO(1); + } + else { + emit parent->setVFO(0); + } + sendData(QString("RPRT %1\n").arg(responseCode)); + } + else if (command[0] == "s" || command[0] == "get_split_vfo") + { + sendData(QString("%1\n").arg(rigState->splitEnabled)); + if (rigState->currentVfo == 0) + { + sendData(QString("%1\n").arg("VFOB")); + } + else { + sendData(QString("%1\n").arg("VFOA")); + } + } + else if (command[0] == "S" || command[0] == "set_split_vfo") + { + if (command.length() > 1 && command[1] == "1") + { + emit parent->setSplit(1); + } + else { + emit parent->setSplit(0); + } + sendData(QString("RPRT %1\n").arg(responseCode)); + } + else if (command[0] == "i" || command[0] == "get_split_freq") + { + if (rigState->currentVfo == 0) { + sendData(QString("%1\n").arg(rigState->vfoBFreq.Hz)); + } + else { + sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz)); + } + } + else if (command[0] == "I" || command[0] == "set_split_freq") + { + sendData(QString("RPRT %1\n").arg(responseCode)); + } + else if (command[0] == "m" || command[0] == "get_mode") + { + if (longReply) { + sendData(QString("Mode: %1\nPassband: %2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter))); + } + else { + sendData(QString("%1\n%2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter))); + } + sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "M" || command[0] == "set_mode") { @@ -203,7 +264,7 @@ void rigCtlClient::socketReadyRead() emit parent->setDataMode(false, 0x01); } } - sendData(QString("RPRT 0\n")); + sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "s" || command[0] == "get_split_vfo") { @@ -240,7 +301,6 @@ void rigCtlClient::sendData(QString data) } } - void rigCtlClient::dumpCaps(QString sep) { sendData(QString("Caps dump for model: %1%2").arg(rigCaps.modelID).arg(sep)); @@ -404,3 +464,4 @@ unsigned char rigCtlClient::getMode(QString modeString) { } return 0; } + diff --git a/rigctld.h b/rigctld.h index 257509b..917091f 100644 --- a/rigctld.h +++ b/rigctld.h @@ -34,6 +34,8 @@ signals: void setPTT(bool state); void setMode(unsigned char mode, unsigned char modeFilter); void setDataMode(bool dataOn, unsigned char modeFilter); + void setVFO(unsigned char vfo); + void setSplit(unsigned char split); public slots: virtual void incomingConnection(qintptr socketDescriptor); @@ -75,7 +77,6 @@ private: QString getMode(unsigned char mode, bool datamode); unsigned char getMode(QString modeString); QString getFilter(unsigned char mode, unsigned char filter); - }; diff --git a/wfmain.cpp b/wfmain.cpp index a353cf4..f7ab67e 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -5274,6 +5274,16 @@ void wfmain::on_enableRigctldChk_clicked(bool checked) prefs.enableRigCtlD = checked; } +void wfmain::on_rigctldPortTxt_editingFinished() +{ + + bool okconvert = false; + unsigned int port = ui->rigctldPortTxt->text().toUInt(&okconvert); + if (okconvert) + { + prefs.rigCtlPort = port; + } +} // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() diff --git a/wfmain.h b/wfmain.h index 8835f32..934870d 100644 --- a/wfmain.h +++ b/wfmain.h @@ -475,6 +475,8 @@ private slots: void on_enableRigctldChk_clicked(bool checked); + void on_rigctldPortTxt_editingFinished(); + private: Ui::wfmain *ui; void closeEvent(QCloseEvent *event); From f36cefac3a1e70828a55f0d555a82b93a82e6da2 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 5 Aug 2021 11:06:35 +0100 Subject: [PATCH 13/37] Change the way rigctl response is built --- rigctld.cpp | 161 +++++++++++++++++++++++++++++++++++++--------------- rigctld.h | 1 - 2 files changed, 116 insertions(+), 46 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 384b3c9..7336c80 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -83,10 +83,12 @@ void rigCtlClient::socketReadyRead() static QString sep = " "; static int num = 0; bool longReply = false; - unsigned char responseCode = 0; + char responseCode = 0; + QStringList response; + bool setCommand = false; if (commandBuffer.endsWith('\n')) { - qDebug(logRigCtlD()) << sessionId << "command received" << commandBuffer; + qInfo(logRigCtlD()) << sessionId << "command received" << commandBuffer; commandBuffer.chop(1); // Remove \n character if (commandBuffer.endsWith('\r')) { @@ -129,24 +131,51 @@ void rigCtlClient::socketReadyRead() if (command[0] == 0xf0 || command[0]=="chk_vfo") { - sendData(QString("%1\n").arg(rigState->currentVfo)); + response.append(QString("%1").arg(rigState->currentVfo)); } else if (command[0] == "dump_state") { // Currently send "fake" state information until I can work out what is required! - sendData(QString("1\n1\n0\n150000.000000 1500000000.000000 0x1ff -1 -1 0x16000003 0xf\n0 0 0 0 0 0 0\n0 0 0 0 0 0 0\n0x1ff 1\n0x1ff 0\n0 0\n0x1e 2400\n0x2 500\n0x1 8000\n0x1 2400\n0x20 15000\n0x20 8000\n0x40 230000\n0 0\n9990\n9990\n10000\n0\n10\n10 20 30\n0x3effffff\n0x3effffff\n0x7fffffff\n0x7fffffff\n0x7fffffff\n0x7fffffff\ndone\n")); + response.append("1"); + response.append("1"); + response.append("0"); + response.append("150000.000000 1500000000.000000 0x1ff -1 -1 0x16000003 0xf"); + response.append("0 0 0 0 0 0 0"); + response.append("0x1ff 1"); + response.append("0 0"); + response.append("0x1e 2400"); + response.append("0x2 500"); + response.append("0x1 8000"); + response.append("0x1 2400"); + response.append("0x20 15000"); + response.append("0x20 8000"); + response.append("0x20 230000"); + response.append("0 0"); + response.append("9900"); + response.append("9900"); + response.append("10000"); + response.append("0"); + response.append("10 20 30"); + response.append("0x3effffff"); + response.append("0x7fffffff"); + response.append("0x7fffffff"); + response.append("0x7fffffff"); + response.append("0x7fffffff"); + response.append("done"); + } else if (command[0] == "f" || command[0] == "get_freq") { if (rigState->currentVfo == 0) { - sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz)); + response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); } else { - sendData(QString("%1\n").arg(rigState->vfoBFreq.Hz)); + response.append(QString("%1").arg(rigState->vfoBFreq.Hz)); } } else if (command[0] == "F" || command[0] == "set_freq") { + setCommand = true; if (command.length()>1) { freqt freq; @@ -154,63 +183,93 @@ void rigCtlClient::socketReadyRead() double newFreq = command[1].toDouble(&ok); if (ok) { freq.Hz = static_cast(newFreq); + qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); + emit parent->setFrequency(freq); } - qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); - emit parent->setFrequency(freq); } - sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "1" || command[0] == "dump_caps") { - dumpCaps(sep); + response.append(QString("Caps dump for model: %1").arg(rigCaps.modelID)); + response.append(QString("Model Name:\t%1").arg(rigCaps.modelName)); + response.append(QString("Mfg Name:\tIcom")); + response.append(QString("Backend version:\t0.1")); + response.append(QString("Backend copyright:\t2021")); + if (rigCaps.hasTransmit) { + response.append(QString("Rig type:\tTransceiver")); + } + else + { + response.append(QString("Rig type:\tReceiver")); + } + if (rigCaps.hasPTTCommand) { + response.append(QString("PTT type:\tRig capable")); + } + response.append(QString("DCD type:\tRig capable")); + response.append(QString("Port type:\tNetwork link")); } else if (command[0] == "t" || command[0] == "get_ptt") { - sendData(QString("%1\n").arg(rigState->ptt)); + if (rigCaps.hasPTTCommand) { + response.append(QString("%1").arg(rigState->ptt)); + } + else + { + responseCode = -1; + } } else if (command[0] == "T" || command[0] == "set_ptt") { - if (command.length()>1 && command[1] == "0") { - emit parent->setPTT(false); + if (rigCaps.hasPTTCommand) { + if (command.length() > 1 && command[1] == "0") { + emit parent->setPTT(false); + } + else { + emit parent->setPTT(true); + } } - else { - emit parent->setPTT(true); + else + { + responseCode = -1; } - sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "v" || command[0] == "get_vfo") { if (rigState->currentVfo == 0) { - sendData(QString("%1\n").arg("VFOA")); + response.append("VFOA"); } else { - sendData(QString("%1\n").arg("VFOB")); + response.append("VFOB"); } } else if (command[0] == "V" || command[0] == "set_vfo") { - qDebug(logRigCtlD()) << QString("Got VFO command: %1").arg(command[1]); - if (command.length() > 1 && command[1] == "VFOB") { + setCommand = true; + if (command.length() > 1 && command[1] == "?") { + response.append("VFOA"); + response.append("VFOB"); + } + else if (command.length() > 1 && command[1] == "VFOB") { emit parent->setVFO(1); } else { emit parent->setVFO(0); } - sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "s" || command[0] == "get_split_vfo") { - sendData(QString("%1\n").arg(rigState->splitEnabled)); + response.append(QString("%1").arg(rigState->splitEnabled)); if (rigState->currentVfo == 0) { - sendData(QString("%1\n").arg("VFOB")); + response.append(QString("%1").arg("VFOB")); } else { - sendData(QString("%1\n").arg("VFOA")); + response.append(QString("%1").arg("VFOA")); } } else if (command[0] == "S" || command[0] == "set_split_vfo") { + setCommand = true; if (command.length() > 1 && command[1] == "1") { emit parent->setSplit(1); @@ -218,7 +277,21 @@ void rigCtlClient::socketReadyRead() else { emit parent->setSplit(0); } - sendData(QString("RPRT %1\n").arg(responseCode)); + } + else if (command[0] == "\xf3" || command[0] == "get_vfo_info") + { + if (longReply) { + response.append(QString("Freq: %1").arg(rigState->vfoAFreq.Hz)); + response.append(QString("Mode: %1").arg(getMode(rigState->mode, rigState->datamode))); + response.append(QString("Width: %1").arg(getFilter(rigState->mode, rigState->filter))); + response.append(QString("Split: %1").arg(rigState->splitEnabled)); + response.append(QString("SatMode: %1").arg(0)); // Need to get satmode + } + else { + response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); + response.append(QString("%1").arg(getMode(rigState->mode, rigState->datamode))); + response.append(QString("%1").arg(getFilter(rigState->mode, rigState->filter))); + } } else if (command[0] == "i" || command[0] == "get_split_freq") { @@ -231,7 +304,7 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "I" || command[0] == "set_split_freq") { - sendData(QString("RPRT %1\n").arg(responseCode)); + setCommand = true; } else if (command[0] == "m" || command[0] == "get_mode") { @@ -241,11 +314,11 @@ void rigCtlClient::socketReadyRead() else { sendData(QString("%1\n%2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter))); } - sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "M" || command[0] == "set_mode") { // Set mode + setCommand = true; if (command.length() > 2) { qInfo(logRigCtlD()) << "setting mode: " << getMode(command[1]) << command[1] << "width" << command[2]; @@ -261,15 +334,26 @@ void rigCtlClient::socketReadyRead() emit parent->setDataMode(true, width); } else { - emit parent->setDataMode(false, 0x01); + emit parent->setDataMode(false, width); } } - sendData(QString("RPRT %1\n").arg(responseCode)); } else if (command[0] == "s" || command[0] == "get_split_vfo") { - sendData(QString("0\nVFOA\n")); + response.append(QString("0")); + response.append(QString("VFOA")); } + + if (setCommand == true || responseCode != 0) { + response.append(QString("RPRT %1").arg(responseCode)); + } + + for (QString str : response) + { + sendData(QString("%1%2").arg(str).arg(sep)); + } + sendData(QString("\n")); + commandBuffer.clear(); sep = " "; num = 0; @@ -290,7 +374,7 @@ void rigCtlClient::closeSocket() void rigCtlClient::sendData(QString data) { - qDebug(logRigCtlD()) << "Sending:" << data; + qInfo(logRigCtlD()) << "Sending:" << data; if (socket != Q_NULLPTR && socket->isValid() && socket->isOpen()) { socket->write(data.toLatin1()); @@ -301,19 +385,6 @@ void rigCtlClient::sendData(QString data) } } -void rigCtlClient::dumpCaps(QString sep) -{ - sendData(QString("Caps dump for model: %1%2").arg(rigCaps.modelID).arg(sep)); - sendData(QString("Model Name:\t%1%2").arg(rigCaps.modelName).arg(sep)); - sendData(QString("Mfg Name:\tIcom%1").arg(sep)); - sendData(QString("Backend version:\t0.1%1").arg(sep)); - sendData(QString("Backend copyright:\t2021%1").arg(sep)); - sendData(QString("Rig type:\tTransceiver%1").arg(sep)); - sendData(QString("PTT type:\tRig capable%1").arg(sep)); - sendData(QString("DCD type:\tRig capable%1").arg(sep)); - sendData(QString("Port type:\tNetwork link%1").arg(sep)); - sendData(QString("\n")); -} QString rigCtlClient::getFilter(unsigned char mode, unsigned char filter) { @@ -377,7 +448,7 @@ QString rigCtlClient::getMode(unsigned char mode, bool datamode) { QString ret; if (datamode) { - return ret="PKT"; + ret="PKT"; } switch (mode) { diff --git a/rigctld.h b/rigctld.h index 917091f..9f7160c 100644 --- a/rigctld.h +++ b/rigctld.h @@ -70,7 +70,6 @@ protected: QString commandBuffer; private: - void dumpCaps(QString sep); rigCapabilities rigCaps; rigStateStruct* rigState = Q_NULLPTR; rigCtlD* parent; From 273132de8938a651d2c887a05bd4c456c68e0950 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 5 Aug 2021 11:29:20 +0100 Subject: [PATCH 14/37] More fixes to rigctld --- rigctld.cpp | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 7336c80..7ccf4f1 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -80,7 +80,7 @@ void rigCtlClient::socketReadyRead() { QByteArray data = socket->readAll(); commandBuffer.append(data); - static QString sep = " "; + QString sep = "\n"; static int num = 0; bool longReply = false; char responseCode = 0; @@ -129,19 +129,21 @@ void rigCtlClient::socketReadyRead() } QStringList command = commandBuffer.mid(num).split(" "); - if (command[0] == 0xf0 || command[0]=="chk_vfo") + if (command[0] == 0xf0 || command[0] == "chk_vfo") { response.append(QString("%1").arg(rigState->currentVfo)); } else if (command[0] == "dump_state") - { + { // Currently send "fake" state information until I can work out what is required! response.append("1"); response.append("1"); response.append("0"); response.append("150000.000000 1500000000.000000 0x1ff -1 -1 0x16000003 0xf"); response.append("0 0 0 0 0 0 0"); + response.append("0 0 0 0 0 0 0"); response.append("0x1ff 1"); + response.append("0x1ff 0"); response.append("0 0"); response.append("0x1e 2400"); response.append("0x2 500"); @@ -149,14 +151,16 @@ void rigCtlClient::socketReadyRead() response.append("0x1 2400"); response.append("0x20 15000"); response.append("0x20 8000"); - response.append("0x20 230000"); + response.append("0x40 230000"); response.append("0 0"); response.append("9900"); response.append("9900"); response.append("10000"); response.append("0"); + response.append("10"); response.append("10 20 30"); response.append("0x3effffff"); + response.append("0x3effffff"); response.append("0x7fffffff"); response.append("0x7fffffff"); response.append("0x7fffffff"); @@ -176,7 +180,7 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "F" || command[0] == "set_freq") { setCommand = true; - if (command.length()>1) + if (command.length() > 1) { freqt freq; bool ok; @@ -204,11 +208,11 @@ void rigCtlClient::socketReadyRead() } if (rigCaps.hasPTTCommand) { response.append(QString("PTT type:\tRig capable")); - } + } response.append(QString("DCD type:\tRig capable")); response.append(QString("Port type:\tNetwork link")); } - else if (command[0] == "t" || command[0] == "get_ptt") + else if (command[0] == "t" || command[0] == "get_ptt") { if (rigCaps.hasPTTCommand) { response.append(QString("%1").arg(rigState->ptt)); @@ -218,8 +222,9 @@ void rigCtlClient::socketReadyRead() responseCode = -1; } } - else if (command[0] == "T" || command[0] == "set_ptt") + else if (command[0] == "T" || command[0] == "set_ptt") { + setCommand = true; if (rigCaps.hasPTTCommand) { if (command.length() > 1 && command[1] == "0") { emit parent->setPTT(false); @@ -278,7 +283,7 @@ void rigCtlClient::socketReadyRead() emit parent->setSplit(0); } } - else if (command[0] == "\xf3" || command[0] == "get_vfo_info") + else if (command[0] == "\xf3" || command[0] == "get_vfo_info") { if (longReply) { response.append(QString("Freq: %1").arg(rigState->vfoAFreq.Hz)); @@ -326,33 +331,41 @@ void rigCtlClient::socketReadyRead() if (width != -1 && width <= 1800) width = 2; - else + else width = 1; emit parent->setMode(getMode(command[1]), width); if (command[1].mid(0, 3) == "PKT") { emit parent->setDataMode(true, width); - } + } else { emit parent->setDataMode(false, width); } } } - else if (command[0] == "s" || command[0] == "get_split_vfo") + else if (command[0] == "s" || command[0] == "get_split_vfo") { response.append(QString("0")); response.append(QString("VFOA")); } if (setCommand == true || responseCode != 0) { - response.append(QString("RPRT %1").arg(responseCode)); + if (responseCode == 0) { + response.append(QString("RPRT 0")); + } + else { + response.append(QString("RPRT %1").arg(responseCode)); + } } for (QString str : response) { sendData(QString("%1%2").arg(str).arg(sep)); } - sendData(QString("\n")); + + if (sep != "\n") { + sendData(QString("\n")); + } commandBuffer.clear(); sep = " "; From e091ed52541a5e7fa2eefb1d2339dfc6b0dae629 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 5 Aug 2021 13:52:06 +0100 Subject: [PATCH 15/37] Support for more rigctld commands --- rigctld.cpp | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 7ccf4f1..79b7d52 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -88,7 +88,7 @@ void rigCtlClient::socketReadyRead() bool setCommand = false; if (commandBuffer.endsWith('\n')) { - qInfo(logRigCtlD()) << sessionId << "command received" << commandBuffer; + qDebug(logRigCtlD()) << sessionId << "command received" << commandBuffer; commandBuffer.chop(1); // Remove \n character if (commandBuffer.endsWith('\r')) { @@ -110,6 +110,7 @@ void rigCtlClient::socketReadyRead() } else if (commandBuffer[num] == "+") { + longReply = true; sep = "\n"; num++; } @@ -125,7 +126,6 @@ void rigCtlClient::socketReadyRead() if (commandBuffer[num] == "\\") { num++; - longReply = true; } QStringList command = commandBuffer.mid(num).split(" "); @@ -187,7 +187,7 @@ void rigCtlClient::socketReadyRead() double newFreq = command[1].toDouble(&ok); if (ok) { freq.Hz = static_cast(newFreq); - qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); + qDebug(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); emit parent->setFrequency(freq); } } @@ -251,10 +251,14 @@ void rigCtlClient::socketReadyRead() { setCommand = true; if (command.length() > 1 && command[1] == "?") { + response.append("set_vfo: ?"); response.append("VFOA"); response.append("VFOB"); + response.append("Sub"); + response.append("Main"); + response.append("MEM"); } - else if (command.length() > 1 && command[1] == "VFOB") { + else if (command.length() > 1 && (command[1] == "VFOB" || command[1] == "Sub")) { emit parent->setVFO(1); } else { @@ -286,14 +290,26 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "\xf3" || command[0] == "get_vfo_info") { if (longReply) { - response.append(QString("Freq: %1").arg(rigState->vfoAFreq.Hz)); + //response.append(QString("set_vfo: %1").arg(command[1])); + + if (command[1] == "VFOB") { + response.append(QString("Freq: %1").arg(rigState->vfoBFreq.Hz)); + } + else { + response.append(QString("Freq: %1").arg(rigState->vfoAFreq.Hz)); + } response.append(QString("Mode: %1").arg(getMode(rigState->mode, rigState->datamode))); response.append(QString("Width: %1").arg(getFilter(rigState->mode, rigState->filter))); response.append(QString("Split: %1").arg(rigState->splitEnabled)); response.append(QString("SatMode: %1").arg(0)); // Need to get satmode } else { - response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); + if (command[1] == "VFOB") { + response.append(QString("%1").arg(rigState->vfoBFreq.Hz)); + } + else { + response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); + } response.append(QString("%1").arg(getMode(rigState->mode, rigState->datamode))); response.append(QString("%1").arg(getFilter(rigState->mode, rigState->filter))); } @@ -326,7 +342,7 @@ void rigCtlClient::socketReadyRead() setCommand = true; if (command.length() > 2) { - qInfo(logRigCtlD()) << "setting mode: " << getMode(command[1]) << command[1] << "width" << command[2]; + qDebug(logRigCtlD()) << "setting mode: " << getMode(command[1]) << command[1] << "width" << command[2]; int width = command[2].toInt(); if (width != -1 && width <= 1800) @@ -349,7 +365,16 @@ void rigCtlClient::socketReadyRead() response.append(QString("VFOA")); } - if (setCommand == true || responseCode != 0) { + if (longReply) { + if (command.length() == 2) + sendData(QString("%1: %2%3").arg(command[0]).arg(command[1]).arg(sep)); + if (command.length() == 3) + sendData(QString("%1: %2 %3%4").arg(command[0]).arg(command[1]).arg(command[2]).arg(sep)); + if (command.length() == 4) + sendData(QString("%1: %2 %3 %4%5").arg(command[0]).arg(command[1]).arg(command[2]).arg(command[3]).arg(sep)); + } + + if (setCommand || responseCode != 0 || longReply) { if (responseCode == 0) { response.append(QString("RPRT 0")); } @@ -387,7 +412,7 @@ void rigCtlClient::closeSocket() void rigCtlClient::sendData(QString data) { - qInfo(logRigCtlD()) << "Sending:" << data; + qDebug(logRigCtlD()) << "Sending:" << data; if (socket != Q_NULLPTR && socket->isValid() && socket->isOpen()) { socket->write(data.toLatin1()); From 543b289c99756fe6433a503299aa60639a9a8596 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 5 Aug 2021 14:15:10 +0100 Subject: [PATCH 16/37] Fixes for setting freq/mode --- rigctld.cpp | 64 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 79b7d52..3481de0 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -180,16 +180,24 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "F" || command[0] == "set_freq") { setCommand = true; - if (command.length() > 1) + freqt freq; + bool ok=false; + double newFreq; + QString vfo = "VFOA"; + if (command.length() == 2) { - freqt freq; - bool ok; - double newFreq = command[1].toDouble(&ok); - if (ok) { - freq.Hz = static_cast(newFreq); - qDebug(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); - emit parent->setFrequency(freq); - } + newFreq = command[1].toDouble(&ok); + } + else if (command.length() == 3) // Includes VFO + { + newFreq = command[2].toDouble(&ok); + vfo = command[1]; + } + + if (ok) { + freq.Hz = static_cast(newFreq); + qDebug(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]); + emit parent->setFrequency(freq); } } else if (command[0] == "1" || command[0] == "dump_caps") @@ -340,23 +348,31 @@ void rigCtlClient::socketReadyRead() { // Set mode setCommand = true; - if (command.length() > 2) { + int width = -1; + QString vfo = "VFOA"; + QString mode = "USB"; + if (command.length() == 3) { + width = command[2].toInt(); + mode = command[1]; + } + else if (command.length() == 4) { + width = command[3].toInt(); + mode = command[2]; + vfo = command[1]; + } + qDebug(logRigCtlD()) << "setting mode: VFO:" << vfo << getMode(mode) << mode << "width" << width; - qDebug(logRigCtlD()) << "setting mode: " << getMode(command[1]) << command[1] << "width" << command[2]; - int width = command[2].toInt(); + if (width != -1 && width <= 1800) + width = 2; + else + width = 1; - if (width != -1 && width <= 1800) - width = 2; - else - width = 1; - - emit parent->setMode(getMode(command[1]), width); - if (command[1].mid(0, 3) == "PKT") { - emit parent->setDataMode(true, width); - } - else { - emit parent->setDataMode(false, width); - } + emit parent->setMode(getMode(mode), width); + if (mode.mid(0, 3) == "PKT") { + emit parent->setDataMode(true, width); + } + else { + emit parent->setDataMode(false, width); } } else if (command[0] == "s" || command[0] == "get_split_vfo") From b8345bf77fc3ad13586fe1f75088318f0c75100e Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Thu, 5 Aug 2021 14:45:19 +0100 Subject: [PATCH 17/37] Move rigctld settings in Ui --- wfmain.ui | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/wfmain.ui b/wfmain.ui index d55ba9b..f392fd8 100644 --- a/wfmain.ui +++ b/wfmain.ui @@ -2244,26 +2244,6 @@ - - - - Qt::RightToLeft - - - Enable RigCtld - - - - - - - Port - - - - - - @@ -2430,6 +2410,39 @@ + + + + Qt::RightToLeft + + + Enable RigCtld + + + + + + + Port + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + From a112ee43cbd83ca7416e20442771ecfa3604c33e Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 6 Aug 2021 09:25:08 +0100 Subject: [PATCH 18/37] Add frequency ranges from rigcaps --- rigctld.cpp | 253 ++++++++++++++++++++++++++++++++++++++++++++++++---- rigctld.h | 90 +++++++++++++++++++ 2 files changed, 325 insertions(+), 18 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 3481de0..7480603 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -121,17 +121,24 @@ void rigCtlClient::socketReadyRead() else if (commandBuffer[num].toLower() == "q") { closeSocket(); + return; } if (commandBuffer[num] == "\\") { num++; } + QStringList command = commandBuffer.mid(num).split(" "); if (command[0] == 0xf0 || command[0] == "chk_vfo") { - response.append(QString("%1").arg(rigState->currentVfo)); + QString resp; + if (longReply) { + resp.append(QString("ChkVFO: ")); + } + resp.append(QString("%1").arg(rigState->currentVfo)); + response.append(resp); } else if (command[0] == "dump_state") { @@ -139,8 +146,17 @@ void rigCtlClient::socketReadyRead() response.append("1"); response.append("1"); response.append("0"); - response.append("150000.000000 1500000000.000000 0x1ff -1 -1 0x16000003 0xf"); + for (bandType band : rigCaps.bands) + { + response.append(generateFreqRange(band)); + } response.append("0 0 0 0 0 0 0"); + if (rigCaps.hasTransmit) { + for (bandType band : rigCaps.bands) + { + response.append(generateFreqRange(band)); + } + } response.append("0 0 0 0 0 0 0"); response.append("0x1ff 1"); response.append("0x1ff 0"); @@ -168,21 +184,27 @@ void rigCtlClient::socketReadyRead() response.append("done"); } + else if (command[0] == "f" || command[0] == "get_freq") { + QString resp; + if (longReply) { + resp.append(QString("Frequency: ")); + } if (rigState->currentVfo == 0) { - response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); + resp.append(QString("%1").arg(rigState->vfoAFreq.Hz)); } else { - response.append(QString("%1").arg(rigState->vfoBFreq.Hz)); + resp.append(QString("%1").arg(rigState->vfoBFreq.Hz)); } + response.append(resp); } else if (command[0] == "F" || command[0] == "set_freq") { setCommand = true; freqt freq; bool ok=false; - double newFreq; + double newFreq=0.0f; QString vfo = "VFOA"; if (command.length() == 2) { @@ -223,7 +245,12 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "t" || command[0] == "get_ptt") { if (rigCaps.hasPTTCommand) { - response.append(QString("%1").arg(rigState->ptt)); + QString resp; + if (longReply) { + resp.append(QString("PTT: ")); + } + resp.append(QString("%1").arg(rigState->ptt)); + response.append(resp); } else { @@ -248,12 +275,18 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "v" || command[0] == "get_vfo") { + QString resp; + if (longReply) { + resp.append("VFO: "); + } + if (rigState->currentVfo == 0) { - response.append("VFOA"); + resp.append("VFOA"); } else { - response.append("VFOB"); + resp.append("VFOB"); } + response.append(resp); } else if (command[0] == "V" || command[0] == "set_vfo") { @@ -275,14 +308,26 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "s" || command[0] == "get_split_vfo") { - response.append(QString("%1").arg(rigState->splitEnabled)); - if (rigState->currentVfo == 0) - { - response.append(QString("%1").arg("VFOB")); + if (longReply) { + response.append(QString("Split: %1").arg(rigState->splitEnabled)); } else { - response.append(QString("%1").arg("VFOA")); + response.append(QString("%1").arg(rigState->splitEnabled)); } + + QString resp; + if (longReply) { + resp.append("TX VFO: "); + } + + if (rigState->currentVfo == 0) + { + resp.append(QString("%1").arg("VFOB")); + } + else { + resp.append(QString("%1").arg("VFOA")); + } + response.append(resp); } else if (command[0] == "S" || command[0] == "set_split_vfo") { @@ -325,10 +370,10 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "i" || command[0] == "get_split_freq") { if (rigState->currentVfo == 0) { - sendData(QString("%1\n").arg(rigState->vfoBFreq.Hz)); + response.append(QString("%1").arg(rigState->vfoBFreq.Hz)); } else { - sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz)); + response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); } } else if (command[0] == "I" || command[0] == "set_split_freq") @@ -338,10 +383,12 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "m" || command[0] == "get_mode") { if (longReply) { - sendData(QString("Mode: %1\nPassband: %2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter))); + response.append(QString("Mode: %1").arg(getMode(rigState->mode, rigState->datamode))); + response.append(QString("Passband: %1").arg(getFilter(rigState->mode, rigState->filter))); } else { - sendData(QString("%1\n%2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter))); + response.append(QString("%1").arg(getMode(rigState->mode, rigState->datamode))); + response.append(QString("%1").arg(getFilter(rigState->mode, rigState->filter))); } } else if (command[0] == "M" || command[0] == "set_mode") @@ -380,7 +427,80 @@ void rigCtlClient::socketReadyRead() response.append(QString("0")); response.append(QString("VFOA")); } + else if (command[0] == "j" || command[0] == "get_rit") + { + QString resp; + if (longReply) { + resp.append("RIT: "); + } + resp.append(QString("%1").arg(0)); + response.append(resp); + } + else if (command[0] == "J" || command[0] == "set_rit") + { + setCommand = true; + } + else if (command[0] == "z" || command[0] == "get_zit") + { + QString resp; + if (longReply) { + resp.append("ZIT: "); + } + resp.append(QString("%1").arg(0)); + response.append(resp); + } + else if (command[0] == "Z" || command[0] == "set_zit") + { + setCommand = true; + } + else if (command[0] == "l" || command[0] == "get_level") + { + QString resp; + int value = 0; + if (longReply && command.length() > 1) { + resp.append(QString("%1: ").arg(command[1])); + } + if (command[1] == "STRENGTH") { + value = rigState->sMeter; + if (value > 240) + value = value - 176; + else if (value > 120) + value = value - 120; + else if (value > 90) + value = value - 102; + else if (value > 60) + value = value - 84; + else if (value > 30) + value = value - 66; + else if (value > 10) + value = value - 58; + else if (value > 0) + value = value - 54; + } + resp.append(QString("%1").arg(value)); + response.append(resp); + } + else if (command[0] == "L" || command[0] == "set_level") + { + setCommand = true; + } + else if (command[0] == "u" || command[0] == "get_func") + { + QString resp; + if (longReply && command.length() > 1) { + resp.append(QString("%1: ").arg(command[1])); + } + resp.append(QString("%1").arg(0)); + response.append(resp); + } + else if (command[0] == "R" || command[0] == "set_func") + { + setCommand = true; + } + else { + qInfo(logRigCtlD()) << "Unimplemented command" << commandBuffer; + } if (longReply) { if (command.length() == 2) sendData(QString("%1: %2%3").arg(command[0]).arg(command[1]).arg(sep)); @@ -401,7 +521,8 @@ void rigCtlClient::socketReadyRead() for (QString str : response) { - sendData(QString("%1%2").arg(str).arg(sep)); + if (str != "") + sendData(QString("%1%2").arg(str).arg(sep)); } if (sep != "\n") { @@ -590,3 +711,99 @@ unsigned char rigCtlClient::getMode(QString modeString) { return 0; } +QString rigCtlClient::generateFreqRange(bandType band) +{ + unsigned int lowFreq = 0; + unsigned int highFreq = 0; + switch (band) { + case band2200m: + lowFreq = 135000; + highFreq = 138000; + break; + case band630m: + lowFreq = 493000; + highFreq = 595000; + break; + case band160m: + lowFreq = 1800000; + highFreq = 2000000; + break; + case band80m: + lowFreq = 3500000; + highFreq = 4000000; + break; + case band60m: + lowFreq = 5250000; + highFreq = 5450000; + break; + case band40m: + lowFreq = 7000000; + highFreq = 7300000; + break; + case band30m: + lowFreq = 10100000; + highFreq = 10150000; + break; + case band20m: + lowFreq = 14000000; + highFreq = 14350000; + break; + case band17m: + lowFreq = 18068000; + highFreq = 18168000; + break; + case band15m: + lowFreq = 21000000; + highFreq = 21450000; + break; + case band12m: + lowFreq = 24890000; + highFreq = 24990000; + break; + case band10m: + lowFreq = 28000000; + highFreq = 29700000; + break; + case band6m: + lowFreq = 50000000; + highFreq = 54000000; + break; + case band4m: + lowFreq = 70000000; + highFreq = 70500000; + break; + case band2m: + lowFreq = 144000000; + highFreq = 148000000; + break; + case band70cm: + lowFreq = 420000000; + highFreq = 450000000; + break; + case band23cm: + lowFreq = 1240000000; + highFreq = 1400000000; + break; + case bandAir: + lowFreq = 108000000; + highFreq = 137000000; + break; + } + quint64 modes=0; + for (mode_info mode : rigCaps.modes) + { + for (int i = 0; mode_str[i].str[0] != '\0'; i++) + { + if (!strcmp(mode.name.toLocal8Bit(), mode_str[i].str)) + { + modes |= mode_str[i].mode; + } + } + } + QString ret = ""; + + if (lowFreq > 0 && highFreq > 0) { + ret = QString("%1 %2 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(modes,0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(0xf,0,16); + } + return ret; +} diff --git a/rigctld.h b/rigctld.h index 9f7160c..96398f4 100644 --- a/rigctld.h +++ b/rigctld.h @@ -1,3 +1,9 @@ +/* This file contains portions of the Hamlib Interface - API header +* Copyright(c) 2000 - 2003 by Frank Singleton +* Copyright(c) 2000 - 2012 by Stephane Fillod +*/ + + #ifndef RIGCTLD_H #define RIGCTLD_H @@ -14,6 +20,89 @@ #include "rigcommander.h" +#define CONSTANT_64BIT_FLAG(BIT) (1ull << (BIT)) + +#define RIG_MODE_NONE 0 /*!< '' -- None */ +#define RIG_MODE_AM CONSTANT_64BIT_FLAG (0) /*!< \c AM -- Amplitude Modulation */ +#define RIG_MODE_CW CONSTANT_64BIT_FLAG (1) /*!< \c CW -- CW "normal" sideband */ +#define RIG_MODE_USB CONSTANT_64BIT_FLAG (2) /*!< \c USB -- Upper Side Band */ +#define RIG_MODE_LSB CONSTANT_64BIT_FLAG (3) /*!< \c LSB -- Lower Side Band */ +#define RIG_MODE_RTTY CONSTANT_64BIT_FLAG (4) /*!< \c RTTY -- Radio Teletype */ +#define RIG_MODE_FM CONSTANT_64BIT_FLAG (5) /*!< \c FM -- "narrow" band FM */ +#define RIG_MODE_WFM CONSTANT_64BIT_FLAG (6) /*!< \c WFM -- broadcast wide FM */ +#define RIG_MODE_CWR CONSTANT_64BIT_FLAG (7) /*!< \c CWR -- CW "reverse" sideband */ +#define RIG_MODE_RTTYR CONSTANT_64BIT_FLAG (8) /*!< \c RTTYR -- RTTY "reverse" sideband */ +#define RIG_MODE_AMS CONSTANT_64BIT_FLAG (9) /*!< \c AMS -- Amplitude Modulation Synchronous */ +#define RIG_MODE_PKTLSB CONSTANT_64BIT_FLAG (10) /*!< \c PKTLSB -- Packet/Digital LSB mode (dedicated port) */ +#define RIG_MODE_PKTUSB CONSTANT_64BIT_FLAG (11) /*!< \c PKTUSB -- Packet/Digital USB mode (dedicated port) */ +#define RIG_MODE_PKTFM CONSTANT_64BIT_FLAG (12) /*!< \c PKTFM -- Packet/Digital FM mode (dedicated port) */ +#define RIG_MODE_ECSSUSB CONSTANT_64BIT_FLAG (13) /*!< \c ECSSUSB -- Exalted Carrier Single Sideband USB */ +#define RIG_MODE_ECSSLSB CONSTANT_64BIT_FLAG (14) /*!< \c ECSSLSB -- Exalted Carrier Single Sideband LSB */ +#define RIG_MODE_FAX CONSTANT_64BIT_FLAG (15) /*!< \c FAX -- Facsimile Mode */ +#define RIG_MODE_SAM CONSTANT_64BIT_FLAG (16) /*!< \c SAM -- Synchronous AM double sideband */ +#define RIG_MODE_SAL CONSTANT_64BIT_FLAG (17) /*!< \c SAL -- Synchronous AM lower sideband */ +#define RIG_MODE_SAH CONSTANT_64BIT_FLAG (18) /*!< \c SAH -- Synchronous AM upper (higher) sideband */ +#define RIG_MODE_DSB CONSTANT_64BIT_FLAG (19) /*!< \c DSB -- Double sideband suppressed carrier */ +#define RIG_MODE_FMN CONSTANT_64BIT_FLAG (21) /*!< \c FMN -- FM Narrow Kenwood ts990s */ +#define RIG_MODE_PKTAM CONSTANT_64BIT_FLAG (22) /*!< \c PKTAM -- Packet/Digital AM mode e.g. IC7300 */ +#define RIG_MODE_P25 CONSTANT_64BIT_FLAG (23) /*!< \c P25 -- APCO/P25 VHF,UHF digital mode IC-R8600 */ +#define RIG_MODE_DSTAR CONSTANT_64BIT_FLAG (24) /*!< \c D-Star -- VHF,UHF digital mode IC-R8600 */ +#define RIG_MODE_DPMR CONSTANT_64BIT_FLAG (25) /*!< \c dPMR -- digital PMR, VHF,UHF digital mode IC-R8600 */ +#define RIG_MODE_NXDNVN CONSTANT_64BIT_FLAG (26) /*!< \c NXDN-VN -- VHF,UHF digital mode IC-R8600 */ +#define RIG_MODE_NXDN_N CONSTANT_64BIT_FLAG (27) /*!< \c NXDN-N -- VHF,UHF digital mode IC-R8600 */ +#define RIG_MODE_DCR CONSTANT_64BIT_FLAG (28) /*!< \c DCR -- VHF,UHF digital mode IC-R8600 */ +#define RIG_MODE_AMN CONSTANT_64BIT_FLAG (29) /*!< \c AM-N -- Narrow band AM mode IC-R30 */ +#define RIG_MODE_PSK CONSTANT_64BIT_FLAG (30) /*!< \c PSK - Kenwood PSK and others */ +#define RIG_MODE_PSKR CONSTANT_64BIT_FLAG (31) /*!< \c PSKR - Kenwood PSKR and others */ +#define RIG_MODE_DD CONSTANT_64BIT_FLAG (32) /*!< \c DD Mode IC-9700 */ +#define RIG_MODE_C4FM CONSTANT_64BIT_FLAG (33) /*!< \c Yaesu C4FM mode */ +#define RIG_MODE_PKTFMN CONSTANT_64BIT_FLAG (34) /*!< \c Yaesu DATA-FM-N */ +#define RIG_MODE_SPEC CONSTANT_64BIT_FLAG (35) /*!< \c Unfiltered as in PowerSDR */ + +static struct +{ + quint64 mode; + const char* str; +} mode_str[] = +{ + { RIG_MODE_AM, "AM" }, + { RIG_MODE_CW, "CW" }, + { RIG_MODE_USB, "USB" }, + { RIG_MODE_LSB, "LSB" }, + { RIG_MODE_RTTY, "RTTY" }, + { RIG_MODE_FM, "FM" }, + { RIG_MODE_WFM, "WFM" }, + { RIG_MODE_CWR, "CWR" }, + { RIG_MODE_RTTYR, "RTTYR" }, + { RIG_MODE_AMS, "AMS" }, + { RIG_MODE_PKTLSB, "PKTLSB" }, + { RIG_MODE_PKTUSB, "PKTUSB" }, + { RIG_MODE_PKTFM, "PKTFM" }, + { RIG_MODE_PKTFMN, "PKTFMN" }, + { RIG_MODE_ECSSUSB, "ECSSUSB" }, + { RIG_MODE_ECSSLSB, "ECSSLSB" }, + { RIG_MODE_FAX, "FAX" }, + { RIG_MODE_SAM, "SAM" }, + { RIG_MODE_SAL, "SAL" }, + { RIG_MODE_SAH, "SAH" }, + { RIG_MODE_DSB, "DSB"}, + { RIG_MODE_FMN, "FMN" }, + { RIG_MODE_PKTAM, "PKTAM"}, + { RIG_MODE_P25, "P25"}, + { RIG_MODE_DSTAR, "D-STAR"}, + { RIG_MODE_DPMR, "DPMR"}, + { RIG_MODE_NXDNVN, "NXDN-VN"}, + { RIG_MODE_NXDN_N, "NXDN-N"}, + { RIG_MODE_DCR, "DCR"}, + { RIG_MODE_AMN, "AMN"}, + { RIG_MODE_PSK, "PSK"}, + { RIG_MODE_PSKR, "PSKR"}, + { RIG_MODE_C4FM, "C4FM"}, + { RIG_MODE_SPEC, "SPEC"}, + { RIG_MODE_NONE, "" }, +}; + + class rigCtlD : public QTcpServer { Q_OBJECT @@ -76,6 +165,7 @@ private: QString getMode(unsigned char mode, bool datamode); unsigned char getMode(QString modeString); QString getFilter(unsigned char mode, unsigned char filter); + QString generateFreqRange(bandType band); }; From 04bd237eb4cfd82fb28f95f461b00a822e91b8b8 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 6 Aug 2021 09:47:32 +0100 Subject: [PATCH 19/37] Fix compile warnings --- rigctld.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rigctld.cpp b/rigctld.cpp index 7480603..18d6ca0 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -788,6 +788,14 @@ QString rigCtlClient::generateFreqRange(bandType band) lowFreq = 108000000; highFreq = 137000000; break; + case bandWFM: + lowFreq = 88000000; + highFreq = 108000000; + break; + case bandGen: + lowFreq = 10000; + highFreq = 30000000; + break; } quint64 modes=0; for (mode_info mode : rigCaps.modes) From 797ed3bc5ec7f56a7e30b7f6d242758bad0083ab Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 6 Aug 2021 12:37:03 +0100 Subject: [PATCH 20/37] Add some levels and other functions --- rigctld.cpp | 110 ++++++++++++++++++++++++++++++++++++++++++++++++---- rigctld.h | 17 ++++++++ wfmain.cpp | 31 ++++++++++++++- 3 files changed, 150 insertions(+), 8 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 18d6ca0..0563af9 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -456,12 +456,12 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "l" || command[0] == "get_level") { QString resp; - int value = 0; + float value = 0; if (longReply && command.length() > 1) { resp.append(QString("%1: ").arg(command[1])); } if (command[1] == "STRENGTH") { - value = rigState->sMeter; + value = (float)rigState->sMeter; if (value > 240) value = value - 176; else if (value > 120) @@ -477,15 +477,96 @@ void rigCtlClient::socketReadyRead() else if (value > 0) value = value - 54; } + else if (command[1] == "AF") { + value = (float)rigState->afGain / 255; + } + else if (command[1] == "RF") { + value = (float)rigState->rfGain / 255; + } + else if (command[1] == "SQL") { + value = (float)rigState->squelch / 255; + } + else if (command[1] == "COMP") { + value = (float)rigState->compLevel / 255; + } + else if (command[1] == "MICGAIN") { + value = (float)rigState->micGain / 255; + emit parent->setMicGain(value); + } + else if (command[1] == "MON") { + value = (float)rigState->monitorLevel / 255; + } + else if (command[1] == "VOXGAIN") { + value = (float)rigState->voxGain / 255; + } + else if (command[1] == "ANTIVOX") { + value = (float)rigState->antiVoxGain / 255; + } + else if (command[1] == "RFPOWER") { + value = (float)rigState->txPower / 255; + } resp.append(QString("%1").arg(value)); response.append(resp); } - else if (command[0] == "L" || command[0] == "set_level") + else if (command[0] == "L" || command[0] == "set_level" && command.length() > 2) { + int value; setCommand = true; + if (command[1] == "AF") { + value = command[2].toFloat() * 255; + emit parent->setAfGain(value); + } + else if (command[1] == "RF") { + value = command[2].toFloat() * 255; + emit parent->setRfGain(value); + } + else if (command[1] == "SQL") { + value = command[2].toFloat() * 255; + emit parent->setSql(value); + } + else if (command[1] == "COMP") { + value = command[2].toFloat() * 255; + emit parent->setCompLevel(value); + } + else if (command[1] == "MICGAIN") { + value = command[2].toFloat() * 255; + emit parent->setMicGain(value); + } + else if (command[1] == "MON") { + value = command[2].toFloat() * 255; + emit parent->setMonitorLevel(value); + } + else if (command[1] == "VOXGAIN") { + value = command[2].toFloat() * 255; + emit parent->setVoxGain(value); + } + else if (command[1] == "ANTIVOX") { + value = command[2].toFloat() * 255; + emit parent->setAntiVoxGain(value); + } + else if (command[1] == "RFPOWER") { + value = command[2].toFloat() * 255; + emit parent->setTxPower(value); + } + + qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; + } else if (command[0] == "u" || command[0] == "get_func") + { + QString resp; + if (longReply && command.length() > 1) { + resp.append(QString("%1: ").arg(command[1])); + } + resp.append(QString("%1").arg(0)); + response.append(resp); + } + else if (command[0] == "R" || command[0] == "set_func") + { + setCommand = true; + } + else if (command[0] == 0x88 || command[0] == "get_powerstat") { QString resp; if (longReply && command.length() > 1) { @@ -493,10 +574,17 @@ void rigCtlClient::socketReadyRead() } resp.append(QString("%1").arg(0)); response.append(resp); - } - else if (command[0] == "R" || command[0] == "set_func") + } + else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat") { - setCommand = true; + setCommand = true; + if (command[1] == "0") + { + emit parent->sendPowerOff(); + } + else { + emit parent->sendPowerOn(); + } } else { qInfo(logRigCtlD()) << "Unimplemented command" << commandBuffer; @@ -802,10 +890,18 @@ QString rigCtlClient::generateFreqRange(bandType band) { for (int i = 0; mode_str[i].str[0] != '\0'; i++) { - if (!strcmp(mode.name.toLocal8Bit(), mode_str[i].str)) + QString curMode = mode.name; + if (!strcmp(curMode.toLocal8Bit(), mode_str[i].str)) { modes |= mode_str[i].mode; } + if (rigCaps.hasDataModes) { + curMode = "PKT" + mode.name; + if (!strcmp(curMode.toLocal8Bit(), mode_str[i].str)) + { + modes |= mode_str[i].mode; + } + } } } QString ret = ""; diff --git a/rigctld.h b/rigctld.h index 96398f4..39e92fb 100644 --- a/rigctld.h +++ b/rigctld.h @@ -126,6 +126,23 @@ signals: void setVFO(unsigned char vfo); void setSplit(unsigned char split); + // Power + void sendPowerOn(); + void sendPowerOff(); + + //Level set + void setRfGain(unsigned char level); + void setAfGain(unsigned char level); + void setSql(unsigned char level); + void setMicGain(unsigned char); + void setCompLevel(unsigned char); + void setTxPower(unsigned char); + void setMonitorLevel(unsigned char); + void setVoxGain(unsigned char); + void setAntiVoxGain(unsigned char); + void setSpectrumRefLevel(int); + + public slots: virtual void incomingConnection(qintptr socketDescriptor); void receiveRigCaps(rigCapabilities caps); diff --git a/wfmain.cpp b/wfmain.cpp index f7ab67e..39b1823 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -296,6 +296,7 @@ void wfmain::rigConnections() connect(this, SIGNAL(getSpectrumRefLevel()), rig, SLOT(getSpectrumRefLevel())); connect(this, SIGNAL(getModInputLevel(rigInput)), rig, SLOT(getModInputLevel(rigInput))); + // Levels: Set: connect(this, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char))); connect(this, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char))); @@ -306,7 +307,7 @@ void wfmain::rigConnections() connect(this, SIGNAL(setVoxGain(unsigned char)), rig, SLOT(setVoxGain(unsigned char))); connect(this, SIGNAL(setAntiVoxGain(unsigned char)), rig, SLOT(setAntiVoxGain(unsigned char))); connect(this, SIGNAL(setSpectrumRefLevel(int)), rig, SLOT(setSpectrumRefLevel(int))); - connect(this, SIGNAL(setModLevel(rigInput,unsigned char)), rig, SLOT(setModInputLevel(rigInput,unsigned char))); + connect(this, SIGNAL(setModLevel(rigInput, unsigned char)), rig, SLOT(setModInputLevel(rigInput, unsigned char))); // Levels: handle return on query: connect(rig, SIGNAL(haveRfGain(unsigned char)), this, SLOT(receiveRfGain(unsigned char))); @@ -403,6 +404,20 @@ void wfmain::makeRig() connect(rigCtl, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char))); connect(rigCtl, SIGNAL(setDataMode(bool, unsigned char)), rig, SLOT(setDataMode(bool, unsigned char))); connect(rigCtl, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool))); + connect(rigCtl, SIGNAL(sendPowerOn()), rig, SLOT(powerOn())); + connect(rigCtl, SIGNAL(sendPowerOff()), rig, SLOT(powerOff())); + + // Levels: Set: + connect(rigCtl, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char))); + connect(rigCtl, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char))); + connect(rigCtl, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char))); + connect(rigCtl, SIGNAL(setTxPower(unsigned char)), rig, SLOT(setTxPower(unsigned char))); + connect(rigCtl, SIGNAL(setMicGain(unsigned char)), rig, SLOT(setMicGain(unsigned char))); + connect(rigCtl, SIGNAL(setMonitorLevel(unsigned char)), rig, SLOT(setMonitorLevel(unsigned char))); + connect(rigCtl, SIGNAL(setVoxGain(unsigned char)), rig, SLOT(setVoxGain(unsigned char))); + connect(rigCtl, SIGNAL(setAntiVoxGain(unsigned char)), rig, SLOT(setAntiVoxGain(unsigned char))); + connect(rigCtl, SIGNAL(setSpectrumRefLevel(int)), rig, SLOT(setSpectrumRefLevel(int))); + } } } @@ -5267,6 +5282,20 @@ void wfmain::on_enableRigctldChk_clicked(bool checked) connect(rigCtl, SIGNAL(setMode(unsigned char, unsigned char)), rig, SLOT(setMode(unsigned char, unsigned char))); connect(rigCtl, SIGNAL(setDataMode(bool, unsigned char)), rig, SLOT(setDataMode(bool, unsigned char))); connect(rigCtl, SIGNAL(setPTT(bool)), rig, SLOT(setPTT(bool))); + connect(rigCtl, SIGNAL(sendPowerOn()), rig, SLOT(powerOn())); + connect(rigCtl, SIGNAL(sendPowerOff()), rig, SLOT(powerOff())); + + // Levels: Set: + connect(rigCtl, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char))); + connect(rigCtl, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char))); + connect(rigCtl, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char))); + connect(rigCtl, SIGNAL(setTxPower(unsigned char)), rig, SLOT(setTxPower(unsigned char))); + connect(rigCtl, SIGNAL(setMicGain(unsigned char)), rig, SLOT(setMicGain(unsigned char))); + connect(rigCtl, SIGNAL(setMonitorLevel(unsigned char)), rig, SLOT(setMonitorLevel(unsigned char))); + connect(rigCtl, SIGNAL(setVoxGain(unsigned char)), rig, SLOT(setVoxGain(unsigned char))); + connect(rigCtl, SIGNAL(setAntiVoxGain(unsigned char)), rig, SLOT(setAntiVoxGain(unsigned char))); + connect(rigCtl, SIGNAL(setSpectrumRefLevel(int)), rig, SLOT(setSpectrumRefLevel(int))); + emit sendRigCaps(rigCaps); emit requestRigState(); } From 6b34d500f32b920c4b670dea5bedd43914fd6ba7 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 6 Aug 2021 12:40:58 +0100 Subject: [PATCH 21/37] Update rigctld.cpp --- rigctld.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rigctld.cpp b/rigctld.cpp index 0563af9..46c04e3 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -572,7 +572,7 @@ void rigCtlClient::socketReadyRead() if (longReply && command.length() > 1) { resp.append(QString("%1: ").arg(command[1])); } - resp.append(QString("%1").arg(0)); + resp.append(QString("%1").arg(1)); // Always reply with ON response.append(resp); } else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat") From a945988671925399b3863ad8a79c8f326d12896a Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 6 Aug 2021 12:50:56 +0100 Subject: [PATCH 22/37] Fix for get_powerstat --- rigctld.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 46c04e3..33b04d4 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -568,12 +568,14 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == 0x88 || command[0] == "get_powerstat") { + /* QString resp; if (longReply && command.length() > 1) { - resp.append(QString("%1: ").arg(command[1])); + resp.append(QString("Power Status: ")); } - resp.append(QString("%1").arg(1)); // Always reply with ON + resp.append(QString("%1").arg(0)); // Always reply with ON response.append(resp); + */ } else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat") { From c4ed4d2de4ebf842a88c9ed67d55ff6b006988e9 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 01:14:41 +0100 Subject: [PATCH 23/37] More rigctl features/fixes --- rigcommander.cpp | 1 + rigcommander.h | 1 + rigctld.cpp | 144 +++++++++++++++++++++++++++++++++++------------ rigctld.h | 5 ++ wfmain.cpp | 6 ++ 5 files changed, 122 insertions(+), 35 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index f6fa8d8..86e8030 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1223,6 +1223,7 @@ void rigCommander::parseCommand() break; case '\x11': emit haveAttenuator((unsigned char)payloadIn.at(1)); + rigState.attenuator = (unsigned char)payloadIn.at(1); break; case '\x12': emit haveAntenna((unsigned char)payloadIn.at(1), (bool)payloadIn.at(2)); diff --git a/rigcommander.h b/rigcommander.h index ebb03f6..7259777 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -75,6 +75,7 @@ struct rigStateStruct { quint16 csql; // Levels unsigned char preamp; + unsigned char attenuator; unsigned char modInput; unsigned char afGain; unsigned char rfGain; diff --git a/rigctld.cpp b/rigctld.cpp index 33b04d4..ddbf85b 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -173,8 +173,38 @@ void rigCtlClient::socketReadyRead() response.append("9900"); response.append("10000"); response.append("0"); - response.append("10"); - response.append("10 20 30"); + QString preamps=""; + if (rigCaps.hasPreamp) { + for (unsigned char pre : rigCaps.preamps) + { + if (pre == 0) + continue; + preamps.append(QString("%1 ").arg(pre*10)); + } + if (preamps.endsWith(" ")) + preamps.chop(1); + } + else { + preamps = "0"; + } + response.append(preamps); + + QString attens = ""; + if (rigCaps.hasAttenuator) { + for (unsigned char att : rigCaps.attenuators) + { + if (att == 0) + continue; + attens.append(QString("%1 ").arg(att,0,16)); + } + if (attens.endsWith(" ")) + attens.chop(1); + } + else { + attens = "0"; + } + response.append(attens); + response.append("0x3effffff"); response.append("0x3effffff"); response.append("0x7fffffff"); @@ -369,12 +399,17 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "i" || command[0] == "get_split_freq") { + QString resp; + if (longReply) { + resp.append("TX VFO: "); + } if (rigState->currentVfo == 0) { - response.append(QString("%1").arg(rigState->vfoBFreq.Hz)); + resp.append(QString("%1").arg(rigState->vfoBFreq.Hz)); } else { - response.append(QString("%1").arg(rigState->vfoAFreq.Hz)); + resp.append(QString("%1").arg(rigState->vfoAFreq.Hz)); } + response.append(resp); } else if (command[0] == "I" || command[0] == "set_split_freq") { @@ -424,18 +459,26 @@ void rigCtlClient::socketReadyRead() } else if (command[0] == "s" || command[0] == "get_split_vfo") { - response.append(QString("0")); - response.append(QString("VFOA")); + if (longReply) { + response.append(QString("Split: 0")); + response.append(QString("TX VFO: VFOA")); + } + else + { + response.append("0"); + response.append("VFOA"); + } + } else if (command[0] == "j" || command[0] == "get_rit") { - QString resp; - if (longReply) { - resp.append("RIT: "); - } - resp.append(QString("%1").arg(0)); - response.append(resp); - } + QString resp; + if (longReply) { + resp.append("RIT: "); + } + resp.append(QString("%1").arg(0)); + response.append(resp); + } else if (command[0] == "J" || command[0] == "set_rit") { setCommand = true; @@ -458,7 +501,7 @@ void rigCtlClient::socketReadyRead() QString resp; float value = 0; if (longReply && command.length() > 1) { - resp.append(QString("%1: ").arg(command[1])); + resp.append("Level Value: "); } if (command[1] == "STRENGTH") { value = (float)rigState->sMeter; @@ -505,6 +548,15 @@ void rigCtlClient::socketReadyRead() else if (command[1] == "RFPOWER") { value = (float)rigState->txPower / 255; } + else if (command[1] == "PREAMP") { + value = (float)rigState->preamp * 10; + qInfo(logRigCtlD()) << "PREAMP:" << command[1] << rigState->preamp << value; + } + else if (command[1] == "ATT") { + value = (float)rigState->attenuator; + qInfo(logRigCtlD()) << "ATT:" << command[1] << rigState->attenuator << value; + } + resp.append(QString("%1").arg(value)); response.append(resp); @@ -516,66 +568,82 @@ void rigCtlClient::socketReadyRead() if (command[1] == "AF") { value = command[2].toFloat() * 255; emit parent->setAfGain(value); + rigState->afGain = (unsigned char)value; } else if (command[1] == "RF") { value = command[2].toFloat() * 255; emit parent->setRfGain(value); + rigState->rfGain = (unsigned char)value; } else if (command[1] == "SQL") { value = command[2].toFloat() * 255; emit parent->setSql(value); + rigState->squelch = (unsigned char)value; } else if (command[1] == "COMP") { value = command[2].toFloat() * 255; emit parent->setCompLevel(value); + rigState->compLevel = (unsigned char)value; } else if (command[1] == "MICGAIN") { value = command[2].toFloat() * 255; emit parent->setMicGain(value); + rigState->micGain = (unsigned char)value; } else if (command[1] == "MON") { value = command[2].toFloat() * 255; emit parent->setMonitorLevel(value); + rigState->monitorLevel = (unsigned char)value; } else if (command[1] == "VOXGAIN") { value = command[2].toFloat() * 255; emit parent->setVoxGain(value); + rigState->voxGain = (unsigned char)value; } else if (command[1] == "ANTIVOX") { value = command[2].toFloat() * 255; emit parent->setAntiVoxGain(value); + rigState->antiVoxGain = (unsigned char)value; } - else if (command[1] == "RFPOWER") { - value = command[2].toFloat() * 255; - emit parent->setTxPower(value); + else if (command[1] == "ATT") { + value = command[2].toFloat(); + emit parent->setAttenuator((unsigned char)value); + rigState->attenuator = (unsigned char)value; } - + else if (command[1] == "PREAMP") { + value = command[2].toFloat()/10; + emit parent->setPreamp((unsigned char)value); + rigState->preamp = (unsigned char)value; + } + qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; } else if (command[0] == "u" || command[0] == "get_func") { - QString resp; - if (longReply && command.length() > 1) { - resp.append(QString("%1: ").arg(command[1])); - } - resp.append(QString("%1").arg(0)); - response.append(resp); + QString resp=""; + if (longReply ) { + resp.append(QString("Func Status: ")); } + resp.append("0"); + response.append(resp); + } else if (command[0] == "R" || command[0] == "set_func") { setCommand = true; + if (command.length()>2) + qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2]; } else if (command[0] == 0x88 || command[0] == "get_powerstat") { - /* + QString resp; if (longReply && command.length() > 1) { resp.append(QString("Power Status: ")); } - resp.append(QString("%1").arg(0)); // Always reply with ON + resp.append(QString("%1").arg(1)); // Always reply with ON response.append(resp); - */ + } else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat") { @@ -887,7 +955,18 @@ QString rigCtlClient::generateFreqRange(bandType band) highFreq = 30000000; break; } - quint64 modes=0; + QString ret = ""; + + if (lowFreq > 0 && highFreq > 0) { + ret = QString("%1 %2 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(getRadioModes(),0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(0xf,0,16); + } + return ret; +} + + +quint64 rigCtlClient::getRadioModes() +{ + quint64 modes = 0; for (mode_info mode : rigCaps.modes) { for (int i = 0; mode_str[i].str[0] != '\0'; i++) @@ -906,10 +985,5 @@ QString rigCtlClient::generateFreqRange(bandType band) } } } - QString ret = ""; - - if (lowFreq > 0 && highFreq > 0) { - ret = QString("%1 %2 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(modes,0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(0xf,0,16); - } - return ret; -} + return modes; +} \ No newline at end of file diff --git a/rigctld.h b/rigctld.h index 39e92fb..665d661 100644 --- a/rigctld.h +++ b/rigctld.h @@ -130,6 +130,10 @@ signals: void sendPowerOn(); void sendPowerOff(); + // Att/preamp + void setAttenuator(unsigned char att); + void setPreamp(unsigned char pre); + //Level set void setRfGain(unsigned char level); void setAfGain(unsigned char level); @@ -183,6 +187,7 @@ private: unsigned char getMode(QString modeString); QString getFilter(unsigned char mode, unsigned char filter); QString generateFreqRange(bandType band); + quint64 getRadioModes(); }; diff --git a/wfmain.cpp b/wfmain.cpp index 39b1823..e6531a3 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -407,6 +407,9 @@ void wfmain::makeRig() connect(rigCtl, SIGNAL(sendPowerOn()), rig, SLOT(powerOn())); connect(rigCtl, SIGNAL(sendPowerOff()), rig, SLOT(powerOff())); + connect(rigCtl, SIGNAL(setAttenuator(unsigned char)), rig, SLOT(setAttenuator(unsigned char))); + connect(rigCtl, SIGNAL(setPreamp(unsigned char)), rig, SLOT(setPreamp(unsigned char))); + // Levels: Set: connect(rigCtl, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char))); connect(rigCtl, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char))); @@ -5285,6 +5288,9 @@ void wfmain::on_enableRigctldChk_clicked(bool checked) connect(rigCtl, SIGNAL(sendPowerOn()), rig, SLOT(powerOn())); connect(rigCtl, SIGNAL(sendPowerOff()), rig, SLOT(powerOff())); + connect(rigCtl, SIGNAL(setAttenuator(unsigned char)), rig, SLOT(setAttenuator(unsigned char))); + connect(rigCtl, SIGNAL(setPreamp(unsigned char)), rig, SLOT(setPreamp(unsigned char))); + // Levels: Set: connect(rigCtl, SIGNAL(setRfGain(unsigned char)), rig, SLOT(setRfGain(unsigned char))); connect(rigCtl, SIGNAL(setAfGain(unsigned char)), rig, SLOT(setAfGain(unsigned char))); From 73e29cd0fd02ae136e1a8179a16e566e5c8c0491 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 01:16:02 +0100 Subject: [PATCH 24/37] Remove some debug logging --- rigctld.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index ddbf85b..0e20980 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -550,11 +550,9 @@ void rigCtlClient::socketReadyRead() } else if (command[1] == "PREAMP") { value = (float)rigState->preamp * 10; - qInfo(logRigCtlD()) << "PREAMP:" << command[1] << rigState->preamp << value; } else if (command[1] == "ATT") { value = (float)rigState->attenuator; - qInfo(logRigCtlD()) << "ATT:" << command[1] << rigState->attenuator << value; } From 9ca39a06769cd515828323a80952764b6812dd3b Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 10:04:16 +0100 Subject: [PATCH 25/37] Fix typo --- rigctld.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 0e20980..2d01570 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -483,16 +483,16 @@ void rigCtlClient::socketReadyRead() { setCommand = true; } - else if (command[0] == "z" || command[0] == "get_zit") + else if (command[0] == "z" || command[0] == "get_xit") { QString resp; if (longReply) { - resp.append("ZIT: "); + resp.append("XIT: "); } resp.append(QString("%1").arg(0)); response.append(resp); } - else if (command[0] == "Z" || command[0] == "set_zit") + else if (command[0] == "Z" || command[0] == "set_xit") { setCommand = true; } From f86aa6e4f62a70cc832010baa32f28bbd1ae0e59 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 11:16:55 +0100 Subject: [PATCH 26/37] Correct lack of parentheses in conditionals --- rigctld.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 2d01570..ae8d72d 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -287,11 +287,11 @@ void rigCtlClient::socketReadyRead() responseCode = -1; } } - else if (command[0] == "T" || command[0] == "set_ptt") + else if (command.length() > 1 & (command[0] == "T" || command[0] == "set_ptt")) { setCommand = true; if (rigCaps.hasPTTCommand) { - if (command.length() > 1 && command[1] == "0") { + if (command[1] == "0") { emit parent->setPTT(false); } else { @@ -318,10 +318,10 @@ void rigCtlClient::socketReadyRead() } response.append(resp); } - else if (command[0] == "V" || command[0] == "set_vfo") + else if (command.length() > 1 && (command[0] == "V" || command[0] == "set_vfo")) { setCommand = true; - if (command.length() > 1 && command[1] == "?") { + if (command[1] == "?") { response.append("set_vfo: ?"); response.append("VFOA"); response.append("VFOB"); @@ -329,7 +329,7 @@ void rigCtlClient::socketReadyRead() response.append("Main"); response.append("MEM"); } - else if (command.length() > 1 && (command[1] == "VFOB" || command[1] == "Sub")) { + else if (command[1] == "VFOB" || command[1] == "Sub") { emit parent->setVFO(1); } else { @@ -359,10 +359,10 @@ void rigCtlClient::socketReadyRead() } response.append(resp); } - else if (command[0] == "S" || command[0] == "set_split_vfo") + else if (command.length() > 1 && (command[0] == "S" || command[0] == "set_split_vfo")) { setCommand = true; - if (command.length() > 1 && command[1] == "1") + if (command[1] == "1") { emit parent->setSplit(1); } @@ -496,11 +496,11 @@ void rigCtlClient::socketReadyRead() { setCommand = true; } - else if (command[0] == "l" || command[0] == "get_level") + else if (command.length() > 1 && (command[0] == "l" || command[0] == "get_level")) { QString resp; float value = 0; - if (longReply && command.length() > 1) { + if (longReply) { resp.append("Level Value: "); } if (command[1] == "STRENGTH") { @@ -559,7 +559,7 @@ void rigCtlClient::socketReadyRead() resp.append(QString("%1").arg(value)); response.append(resp); } - else if (command[0] == "L" || command[0] == "set_level" && command.length() > 2) + else if (command.length() > 2 && (command[0] == "L" || command[0] == "set_level")) { int value; setCommand = true; @@ -632,7 +632,7 @@ void rigCtlClient::socketReadyRead() if (command.length()>2) qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2]; } - else if (command[0] == 0x88 || command[0] == "get_powerstat") + else if (command.length() > 1 && (command[0] == 0x88 || command[0] == "get_powerstat")) { QString resp; @@ -643,7 +643,7 @@ void rigCtlClient::socketReadyRead() response.append(resp); } - else if (command.length() > 1 && command[0] == 0x87 || command[0] == "set_powerstat") + else if (command.length() > 1 && (command[0] == 0x87 || command[0] == "set_powerstat")) { setCommand = true; if (command[1] == "0") From b2b438f0038abab427ac5c870a5864934e83cd33 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 11:20:36 +0100 Subject: [PATCH 27/37] Update rigctld.cpp --- rigctld.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rigctld.cpp b/rigctld.cpp index ae8d72d..d9cd891 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -287,7 +287,7 @@ void rigCtlClient::socketReadyRead() responseCode = -1; } } - else if (command.length() > 1 & (command[0] == "T" || command[0] == "set_ptt")) + else if (command.length() > 1 && (command[0] == "T" || command[0] == "set_ptt")) { setCommand = true; if (rigCaps.hasPTTCommand) { From 84261a49cc76675e5de178a1e030c1803d7ba143 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 13:34:47 +0100 Subject: [PATCH 28/37] Add split/duplex support --- rigcommander.cpp | 7 ++-- rigcommander.h | 6 ++-- rigctld.cpp | 88 ++++++++++++++++++++++++++++++++++++++++-------- rigctld.h | 3 ++ wfmain.cpp | 2 ++ 5 files changed, 88 insertions(+), 18 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 86e8030..30de59b 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -26,7 +26,7 @@ rigCommander::rigCommander() rigState.mode = 0; rigState.ptt = 0; rigState.currentVfo = 0; - rigState.splitEnabled = 0; + rigState.duplex = dmSplitOff; } rigCommander::~rigCommander() @@ -1220,6 +1220,7 @@ void rigCommander::parseCommand() break; case '\x0F': emit haveDuplexMode((duplexMode)(unsigned char)payloadIn[1]); + rigState.duplex = (duplexMode)(unsigned char)payloadIn[1]; break; case '\x11': emit haveAttenuator((unsigned char)payloadIn.at(1)); @@ -1227,6 +1228,8 @@ void rigCommander::parseCommand() break; case '\x12': emit haveAntenna((unsigned char)payloadIn.at(1), (bool)payloadIn.at(2)); + rigState.antenna = (unsigned char)payloadIn.at(1); + rigState.rxAntenna = (bool)payloadIn.at(2); break; case '\x14': // read levels @@ -2291,7 +2294,7 @@ void rigCommander::parsePTT() // PTT on emit havePTTStatus(true); } - rigState.ptt = (unsigned char)payloadIn[2]; + rigState.ptt = (bool)payloadIn[2]; } diff --git a/rigcommander.h b/rigcommander.h index 7259777..1539aa3 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -63,11 +63,13 @@ struct rigStateStruct { freqt vfoAFreq; freqt vfoBFreq; unsigned char currentVfo; - unsigned char ptt; + bool ptt; unsigned char mode; unsigned char filter; - unsigned char splitEnabled; + duplexMode duplex; bool datamode; + unsigned char antenna; + bool rxAntenna; // Tones quint16 ctcss; quint16 tsql; diff --git a/rigctld.cpp b/rigctld.cpp index d9cd891..29b7f64 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -205,6 +205,14 @@ void rigCtlClient::socketReadyRead() } response.append(attens); + response.append("0xffffffffffffffff"); + response.append("0xffffffffffffffff"); + response.append("0xfffffffff7ffffff"); + response.append("0xfffffff083ffffff"); + response.append("0xffffffffffffffff"); + response.append("0xffffffffffffffbf"); + + /* response.append("0x3effffff"); response.append("0x3effffff"); response.append("0x7fffffff"); @@ -212,7 +220,7 @@ void rigCtlClient::socketReadyRead() response.append("0x7fffffff"); response.append("0x7fffffff"); response.append("done"); - + */ } else if (command[0] == "f" || command[0] == "get_freq") @@ -339,10 +347,10 @@ void rigCtlClient::socketReadyRead() else if (command[0] == "s" || command[0] == "get_split_vfo") { if (longReply) { - response.append(QString("Split: %1").arg(rigState->splitEnabled)); + response.append(QString("Split: %1").arg(rigState->duplex)); } else { - response.append(QString("%1").arg(rigState->splitEnabled)); + response.append(QString("%1").arg(rigState->duplex)); } QString resp; @@ -364,10 +372,12 @@ void rigCtlClient::socketReadyRead() setCommand = true; if (command[1] == "1") { - emit parent->setSplit(1); + emit parent->setDuplexMode(dmSplitOn); + rigState->duplex = dmSplitOn; } else { - emit parent->setSplit(0); + emit parent->setDuplexMode(dmSplitOff); + rigState->duplex = dmSplitOff; } } else if (command[0] == "\xf3" || command[0] == "get_vfo_info") @@ -383,7 +393,7 @@ void rigCtlClient::socketReadyRead() } response.append(QString("Mode: %1").arg(getMode(rigState->mode, rigState->datamode))); response.append(QString("Width: %1").arg(getFilter(rigState->mode, rigState->filter))); - response.append(QString("Split: %1").arg(rigState->splitEnabled)); + response.append(QString("Split: %1").arg(rigState->duplex)); response.append(QString("SatMode: %1").arg(0)); // Need to get satmode } else { @@ -483,18 +493,42 @@ void rigCtlClient::socketReadyRead() { setCommand = true; } + else if (command[0] == "y" || command[0] == "get_ant") + { + qInfo(logRigCtlD()) << "get_ant:"; + + if (command.length() > 1) { + if (longReply) { + response.append(QString("AntCurr: %1").arg(getAntName((unsigned char)command[1].toInt()))); + response.append(QString("Option: %1").arg(0)); + response.append(QString("AntTx: %1").arg(getAntName(rigState->antenna))); + response.append(QString("AntRx: %1").arg(getAntName(rigState->antenna))); + } + else { + response.append(QString("%1").arg(getAntName((unsigned char)command[1].toInt()))); + response.append(QString("%1").arg(0)); + response.append(QString("%1").arg(getAntName(rigState->antenna))); + response.append(QString("%1").arg(getAntName(rigState->antenna))); + } + } + } + else if (command[0] == "Y" || command[0] == "set_ant") + { + qInfo(logRigCtlD()) << "set_ant:"; + setCommand = true; + } else if (command[0] == "z" || command[0] == "get_xit") { - QString resp; - if (longReply) { - resp.append("XIT: "); - } - resp.append(QString("%1").arg(0)); - response.append(resp); + QString resp; + if (longReply) { + resp.append("XIT: "); + } + resp.append(QString("%1").arg(0)); + response.append(resp); } else if (command[0] == "Z" || command[0] == "set_xit") { - setCommand = true; + setCommand = true; } else if (command.length() > 1 && (command[0] == "l" || command[0] == "get_level")) { @@ -956,11 +990,20 @@ QString rigCtlClient::generateFreqRange(bandType band) QString ret = ""; if (lowFreq > 0 && highFreq > 0) { - ret = QString("%1 %2 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(getRadioModes(),0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(0xf,0,16); + ret = QString("%1 %2 0x%3 %4 %5 0x%6 0x%7").arg(lowFreq).arg(highFreq).arg(getRadioModes(),0,16).arg(-1).arg(-1).arg(0x16000003,0,16).arg(getAntennas(),0,16); } return ret; } +unsigned char rigCtlClient::getAntennas() +{ + unsigned char ant=0; + for (unsigned char i : rigCaps.antennas) + { + ant |= 1< Date: Sat, 7 Aug 2021 17:31:55 +0100 Subject: [PATCH 29/37] Fix to make wsjt-x work again! --- rigctld.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rigctld.cpp b/rigctld.cpp index 29b7f64..9db4629 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -204,23 +204,24 @@ void rigCtlClient::socketReadyRead() attens = "0"; } response.append(attens); - + + response.append("0xffffffffffffffff"); response.append("0xffffffffffffffff"); response.append("0xfffffffff7ffffff"); response.append("0xfffffff083ffffff"); response.append("0xffffffffffffffff"); response.append("0xffffffffffffffbf"); - - /* + + /* response.append("0x3effffff"); response.append("0x3effffff"); response.append("0x7fffffff"); response.append("0x7fffffff"); response.append("0x7fffffff"); response.append("0x7fffffff"); + */ response.append("done"); - */ } else if (command[0] == "f" || command[0] == "get_freq") From 3a2db789a2abf0e7645a5db11b10224fbc156409 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sat, 7 Aug 2021 18:34:34 +0100 Subject: [PATCH 30/37] Add ritctl model to rigCaps --- rigcommander.cpp | 18 ++++++++++++++++++ rigctld.cpp | 2 +- rigidentities.h | 3 +-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index 30de59b..e20b7aa 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -2858,6 +2858,7 @@ void rigCommander::determineRigCaps() switch(model){ case model7300: rigCaps.modelName = QString("IC-7300"); + rigCaps.rigctlModel = 3073; rigCaps.hasSpectrum = true; rigCaps.spectSeqMax = 11; rigCaps.spectAmpMax = 160; @@ -2881,6 +2882,7 @@ void rigCommander::determineRigCaps() break; case modelR8600: rigCaps.modelName = QString("IC-R8600"); + rigCaps.rigctlModel = 3079; rigCaps.hasSpectrum = true; rigCaps.spectSeqMax = 11; rigCaps.spectAmpMax = 160; @@ -2915,6 +2917,7 @@ void rigCommander::determineRigCaps() break; case model9700: rigCaps.modelName = QString("IC-9700"); + rigCaps.rigctlModel = 3081; rigCaps.hasSpectrum = true; rigCaps.spectSeqMax = 11; rigCaps.spectAmpMax = 160; @@ -2942,6 +2945,7 @@ void rigCommander::determineRigCaps() break; case model910h: rigCaps.modelName = QString("IC-910H"); + rigCaps.rigctlModel = 3044; rigCaps.hasSpectrum = false; rigCaps.hasLan = false; rigCaps.hasEthernet = false; @@ -2963,6 +2967,7 @@ void rigCommander::determineRigCaps() break; case model7600: rigCaps.modelName = QString("IC-7600"); + rigCaps.rigctlModel = 3063; rigCaps.hasSpectrum = false; rigCaps.inputs.append(inputACC); rigCaps.inputs.append(inputUSB); @@ -2986,6 +2991,7 @@ void rigCommander::determineRigCaps() break; case model7610: rigCaps.modelName = QString("IC-7610"); + rigCaps.rigctlModel = 3078; rigCaps.hasSpectrum = true; rigCaps.spectSeqMax = 15; rigCaps.spectAmpMax = 200; @@ -3016,6 +3022,7 @@ void rigCommander::determineRigCaps() break; case model7850: rigCaps.modelName = QString("IC-785x"); + rigCaps.rigctlModel = 3075; rigCaps.hasSpectrum = true; rigCaps.spectSeqMax = 15; rigCaps.spectAmpMax = 136; @@ -3047,6 +3054,7 @@ void rigCommander::determineRigCaps() break; case model705: rigCaps.modelName = QString("IC-705"); + rigCaps.rigctlModel = 3085; rigCaps.hasSpectrum = true; rigCaps.spectSeqMax = 11; rigCaps.spectAmpMax = 160; @@ -3082,6 +3090,7 @@ void rigCommander::determineRigCaps() break; case model7000: rigCaps.modelName = QString("IC-7000"); + rigCaps.rigctlModel = 3060; rigCaps.hasSpectrum = false; rigCaps.inputs.append(inputACC); rigCaps.hasLan = false; @@ -3103,6 +3112,7 @@ void rigCommander::determineRigCaps() break; case model7410: rigCaps.modelName = QString("IC-7410"); + rigCaps.rigctlModel = 3067; rigCaps.hasSpectrum = false; rigCaps.inputs.append(inputACC); rigCaps.hasLan = false; @@ -3123,6 +3133,7 @@ void rigCommander::determineRigCaps() break; case model7100: rigCaps.modelName = QString("IC-7100"); + rigCaps.rigctlModel = 3070; rigCaps.hasSpectrum = false; rigCaps.inputs.append(inputUSB); rigCaps.inputs.append(inputACC); @@ -3149,6 +3160,7 @@ void rigCommander::determineRigCaps() break; case model7200: rigCaps.modelName = QString("IC-7200"); + rigCaps.rigctlModel = 3061; rigCaps.hasSpectrum = false; rigCaps.inputs.append(inputUSB); rigCaps.inputs.append(inputACC); @@ -3168,6 +3180,7 @@ void rigCommander::determineRigCaps() break; case model7700: rigCaps.modelName = QString("IC-7700"); + rigCaps.rigctlModel = 3062; rigCaps.hasSpectrum = false; rigCaps.inputs.append(inputLAN); //rigCaps.inputs.append(inputSPDIF); @@ -3193,6 +3206,7 @@ void rigCommander::determineRigCaps() break; case model706: rigCaps.modelName = QString("IC-706"); + rigCaps.rigctlModel = 3009; rigCaps.hasSpectrum = false; rigCaps.inputs.clear(); rigCaps.hasLan = false; @@ -3211,6 +3225,7 @@ void rigCommander::determineRigCaps() break; case model718: rigCaps.modelName = QString("IC-718"); + rigCaps.rigctlModel = 3013; rigCaps.hasSpectrum = false; rigCaps.inputs.clear(); rigCaps.hasLan = false; @@ -3233,6 +3248,7 @@ void rigCommander::determineRigCaps() break; case model756pro: rigCaps.modelName = QString("IC-756 Pro"); + rigCaps.rigctlModel = 3027; rigCaps.hasSpectrum = false; rigCaps.inputs.clear(); rigCaps.hasLan = false; @@ -3251,6 +3267,7 @@ void rigCommander::determineRigCaps() break; case model756proii: rigCaps.modelName = QString("IC-756 Pro II"); + rigCaps.rigctlModel = 3027; rigCaps.hasSpectrum = false; rigCaps.inputs.clear(); rigCaps.hasLan = false; @@ -3269,6 +3286,7 @@ void rigCommander::determineRigCaps() break; case model756proiii: rigCaps.modelName = QString("IC-756 Pro III"); + rigCaps.rigctlModel = 3027; rigCaps.hasSpectrum = false; rigCaps.inputs.clear(); rigCaps.hasLan = false; diff --git a/rigctld.cpp b/rigctld.cpp index 9db4629..c16fdec 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -144,7 +144,7 @@ void rigCtlClient::socketReadyRead() { // Currently send "fake" state information until I can work out what is required! response.append("1"); - response.append("1"); + response.append(QString("%1").arg(rigCaps.rigctlModel)); response.append("0"); for (bandType band : rigCaps.bands) { diff --git a/rigidentities.h b/rigidentities.h index 117cfec..bae0609 100644 --- a/rigidentities.h +++ b/rigidentities.h @@ -90,10 +90,9 @@ model_kind determineRadioModel(unsigned char rigID); struct rigCapabilities { model_kind model; - quint8 civ; quint8 modelID; - + int rigctlModel; QString modelName; bool hasLan; // OEM ethernet or wifi connection From 85271c398ee6a30478275576a65b3de0ce0eefba Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 8 Aug 2021 17:14:48 +0100 Subject: [PATCH 31/37] Add proper s-meter calibration --- rigcommander.cpp | 2 +- rigctld.cpp | 112 +++++++++++++++++++++++++++++------------------ rigctld.h | 49 +++++++++++++++++++++ 3 files changed, 119 insertions(+), 44 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index e20b7aa..a36915a 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -1317,7 +1317,7 @@ void rigCommander::parseLevels() unsigned char tens = (payloadIn[3] & 0xf0) >> 4; unsigned char units = (payloadIn[3] & 0x0f); - unsigned char level = (100*hundreds) + (10*tens) + units; + unsigned char level = ((unsigned char)100*hundreds) + (10*tens) + units; //qInfo(logRig()) << "Level is: " << (int)level << " or " << 100.0*level/255.0 << "%"; diff --git a/rigctld.cpp b/rigctld.cpp index c16fdec..784f9cc 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -534,119 +534,113 @@ void rigCtlClient::socketReadyRead() else if (command.length() > 1 && (command[0] == "l" || command[0] == "get_level")) { QString resp; - float value = 0; + int value = 0; if (longReply) { resp.append("Level Value: "); } + if (command[1] == "STRENGTH") { - value = (float)rigState->sMeter; - if (value > 240) - value = value - 176; - else if (value > 120) - value = value - 120; - else if (value > 90) - value = value - 102; - else if (value > 60) - value = value - 84; - else if (value > 30) - value = value - 66; - else if (value > 10) - value = value - 58; - else if (value > 0) - value = value - 54; + if (rigCaps.model == model7610) + value = getCalibratedValue(rigState->sMeter, IC7610_STR_CAL); + else if (rigCaps.model == model7850) + value = getCalibratedValue(rigState->sMeter, IC7850_STR_CAL); + else + value = getCalibratedValue(rigState->sMeter, IC7300_STR_CAL); + qInfo(logRigCtlD()) << "Calibration IN:" << rigState->sMeter << "OUT" << value; + resp.append(QString("%1").arg(value)); } else if (command[1] == "AF") { - value = (float)rigState->afGain / 255; + resp.append(QString("%1").arg((float)rigState->afGain / 255.0)); } else if (command[1] == "RF") { - value = (float)rigState->rfGain / 255; + resp.append(QString("%1").arg((float)rigState->rfGain / 255.0)); } else if (command[1] == "SQL") { - value = (float)rigState->squelch / 255; + resp.append(QString("%1").arg((float)rigState->squelch / 255.0)); } else if (command[1] == "COMP") { - value = (float)rigState->compLevel / 255; + resp.append(QString("%1").arg((float)rigState->compLevel / 255.0)); } else if (command[1] == "MICGAIN") { - value = (float)rigState->micGain / 255; - emit parent->setMicGain(value); + resp.append(QString("%1").arg((float)rigState->micGain / 255.0)); } else if (command[1] == "MON") { - value = (float)rigState->monitorLevel / 255; + resp.append(QString("%1").arg((float)rigState->monitorLevel / 255.0)); } else if (command[1] == "VOXGAIN") { - value = (float)rigState->voxGain / 255; + resp.append(QString("%1").arg((float)rigState->voxGain / 255.0)); } else if (command[1] == "ANTIVOX") { - value = (float)rigState->antiVoxGain / 255; + resp.append(QString("%1").arg((float)rigState->antiVoxGain / 255.0)); } else if (command[1] == "RFPOWER") { - value = (float)rigState->txPower / 255; + resp.append(QString("%1").arg((float)rigState->txPower / 255.0)); } else if (command[1] == "PREAMP") { - value = (float)rigState->preamp * 10; + resp.append(QString("%1").arg((float)rigState->preamp / 255.0)); } else if (command[1] == "ATT") { - value = (float)rigState->attenuator; + resp.append(QString("%1").arg((float)rigState->attenuator / 255.0)); + } + else { + resp.append(QString("%1").arg(value)); } - - resp.append(QString("%1").arg(value)); response.append(resp); } else if (command.length() > 2 && (command[0] == "L" || command[0] == "set_level")) { - int value; + unsigned char value; setCommand = true; if (command[1] == "AF") { value = command[2].toFloat() * 255; emit parent->setAfGain(value); - rigState->afGain = (unsigned char)value; + rigState->afGain = value; } else if (command[1] == "RF") { value = command[2].toFloat() * 255; emit parent->setRfGain(value); - rigState->rfGain = (unsigned char)value; + rigState->rfGain = value; } else if (command[1] == "SQL") { value = command[2].toFloat() * 255; emit parent->setSql(value); - rigState->squelch = (unsigned char)value; + rigState->squelch = value; } else if (command[1] == "COMP") { value = command[2].toFloat() * 255; emit parent->setCompLevel(value); - rigState->compLevel = (unsigned char)value; + rigState->compLevel = value; } else if (command[1] == "MICGAIN") { value = command[2].toFloat() * 255; emit parent->setMicGain(value); - rigState->micGain = (unsigned char)value; + rigState->micGain = value; } else if (command[1] == "MON") { value = command[2].toFloat() * 255; emit parent->setMonitorLevel(value); - rigState->monitorLevel = (unsigned char)value; + rigState->monitorLevel = value; } else if (command[1] == "VOXGAIN") { value = command[2].toFloat() * 255; emit parent->setVoxGain(value); - rigState->voxGain = (unsigned char)value; + rigState->voxGain = value; } else if (command[1] == "ANTIVOX") { value = command[2].toFloat() * 255; emit parent->setAntiVoxGain(value); - rigState->antiVoxGain = (unsigned char)value; + rigState->antiVoxGain = value; } else if (command[1] == "ATT") { value = command[2].toFloat(); - emit parent->setAttenuator((unsigned char)value); - rigState->attenuator = (unsigned char)value; + emit parent->setAttenuator(value); + rigState->attenuator = value; } else if (command[1] == "PREAMP") { value = command[2].toFloat()/10; - emit parent->setPreamp((unsigned char)value); - rigState->preamp = (unsigned char)value; + emit parent->setPreamp(value); + rigState->preamp = value; } qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; @@ -1045,4 +1039,36 @@ QString rigCtlClient::getAntName(unsigned char ant) default: ret = "ANT_UNK"; break; } return ret; +} + +int rigCtlClient::getCalibratedValue(unsigned char meter,cal_table_t cal) { + + int interp; + + int i = 0; + for (i = 0; i < cal.size; i++) { + if (meter < cal.table[i].raw) + { + break; + } + } + + if (i == 0) + { + return cal.table[0].val; + } + else if (i >= cal.size) + { + return cal.table[i - 1].val; + } + else if (cal.table[i].raw == cal.table[i - 1].raw) + { + return cal.table[i].val; + } + + interp = ((cal.table[i].raw - meter) + * (cal.table[i].val - cal.table[i - 1].val)) + / (cal.table[i].raw - cal.table[i - 1].raw); + + return cal.table[i].val - interp; } \ No newline at end of file diff --git a/rigctld.h b/rigctld.h index b7f4ee3..f8f9f8d 100644 --- a/rigctld.h +++ b/rigctld.h @@ -103,6 +103,54 @@ static struct }; +struct cal_table { + int size; /*!< number of plots in the table */ + struct { + int raw; /*!< raw (A/D) value, as returned by \a RIG_LEVEL_RAWSTR */ + int val; /*!< associated value, basically the measured dB value */ + } table[32]; /*!< table of plots */ +}; + +typedef struct cal_table cal_table_t; + +#define IC7610_STR_CAL { 16, \ + { \ + { 0, -54 }, /* S0 */ \ + { 11, -48 }, \ + { 21, -42 }, \ + { 34, -36 }, \ + { 50, -30 }, \ + { 59, -24 }, \ + { 75, -18 }, \ + { 93, -12 }, \ + { 103, -6 }, \ + { 124, 0 }, /* S9 */ \ + { 145, 10 }, \ + { 160, 20 }, \ + { 183, 30 }, \ + { 204, 40 }, \ + { 222, 50 }, \ + { 246, 60 } /* S9+60dB */ \ + } } + +#define IC7850_STR_CAL { 3, \ + { \ + { 0, -54 }, /* S0 */ \ + { 120, 0 }, /* S9 */ \ + { 241, 60 } /* S9+60 */ \ + } } + +#define IC7300_STR_CAL { 7, \ + { \ + { 0, -54 }, \ + { 10, -48 }, \ + { 30, -36 }, \ + { 60, -24 }, \ + { 90, -12 }, \ + { 120, 0 }, \ + { 241, 64 } \ + } } + class rigCtlD : public QTcpServer { Q_OBJECT @@ -191,6 +239,7 @@ private: unsigned char getAntennas(); quint64 getRadioModes(); QString getAntName(unsigned char ant); + int getCalibratedValue(unsigned char meter,cal_table_t cal); }; From 979442de8745f2a4e574e952f513a2d92f5d38e1 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 8 Aug 2021 17:17:12 +0100 Subject: [PATCH 32/37] Remove calibration debugging --- rigctld.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rigctld.cpp b/rigctld.cpp index 784f9cc..00e901e 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -546,7 +546,7 @@ void rigCtlClient::socketReadyRead() value = getCalibratedValue(rigState->sMeter, IC7850_STR_CAL); else value = getCalibratedValue(rigState->sMeter, IC7300_STR_CAL); - qInfo(logRigCtlD()) << "Calibration IN:" << rigState->sMeter << "OUT" << value; + //qInfo(logRigCtlD()) << "Calibration IN:" << rigState->sMeter << "OUT" << value; resp.append(QString("%1").arg(value)); } else if (command[1] == "AF") { From 4d0153741cec679888f0f89bbe44bc2130a7b4ea Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 8 Aug 2021 21:03:22 +0100 Subject: [PATCH 33/37] Fix float warning --- meter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meter.cpp b/meter.cpp index a8d7dd9..07320ad 100644 --- a/meter.cpp +++ b/meter.cpp @@ -311,7 +311,7 @@ void meter::drawScaleCenter(QPainter *qp) void meter::drawScalePo(QPainter *qp) { //From the manual: "0000=0% to 0143=50% to 0213=100%" - float dnPerWatt = 143.0 / 50.0; + float dnPerWatt = 143.0f / 50.0f; qp->setPen(lowTextColor); //qp->setFont(QFont("Arial", fontSize)); @@ -332,7 +332,7 @@ void meter::drawScalePo(QPainter *qp) // Higher scale: i = i - (int)(10*dnPerWatt); // back one tick first. Otherwise i starts at 178. //qDebug() << "meter i: " << i; - dnPerWatt = (213-143.0) / 50.0; // 1.4 dn per watt + dnPerWatt = (213-143.0f) / 50.0f; // 1.4 dn per watt // P=5 here. qp->setPen(Qt::yellow); int k=0; From 953f57267365756c0403fcb477c188dc078a61d2 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Sun, 8 Aug 2021 21:09:10 +0100 Subject: [PATCH 34/37] Fake known functions --- rigcommander.cpp | 1 + rigcommander.h | 32 ++++++ rigctld.cpp | 268 +++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 295 insertions(+), 6 deletions(-) diff --git a/rigcommander.cpp b/rigcommander.cpp index a36915a..9c7653d 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -27,6 +27,7 @@ rigCommander::rigCommander() rigState.ptt = 0; rigState.currentVfo = 0; rigState.duplex = dmSplitOff; + } rigCommander::~rigCommander() diff --git a/rigcommander.h b/rigcommander.h index 1539aa3..1de8bc3 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -96,6 +96,38 @@ struct rigStateStruct { unsigned char compMeter; unsigned char voltageMeter; unsigned char currentMeter; + // Functions + bool fagcFunc=false; + bool nbFunc=false; + bool compFunc=false; + bool voxFunc = false; + bool toneFunc = false; + bool tsqlFunc = false; + bool sbkinFunc = false; + bool fbkinFunc = false; + bool anfFunc = false; + bool nrFunc = false; + bool aipFunc = false; + bool apfFunc = false; + bool monFunc = false; + bool mnFunc = false; + bool rfFunc = false; + bool aroFunc = false; + bool muteFunc = false; + bool vscFunc = false; + bool revFunc = false; + bool sqlFunc = false; + bool abmFunc = false; + bool bcFunc = false; + bool mbcFunc = false; + bool ritFunc = false; + bool afcFunc = false; + bool satmodeFunc = false; + bool scopeFunc = false; + bool resumeFunc = false; + bool tburstFunc = false; + bool tunerFunc = false; + bool lockFunc = false; }; class rigCommander : public QObject diff --git a/rigctld.cpp b/rigctld.cpp index 00e901e..ae4a6c3 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -646,19 +646,275 @@ void rigCtlClient::socketReadyRead() qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; } - else if (command[0] == "u" || command[0] == "get_func") + else if (command.length()>1 && (command[0] == "u" || command[0] == "get_func")) { QString resp=""; - if (longReply ) { + bool result = 0; + if (longReply) { resp.append(QString("Func Status: ")); } - resp.append("0"); + + if (command[1] == "FAGC") + { + result=rigState->fagcFunc; + } + else if (command[1] == "NB") + { + result=rigState->nbFunc; + } + else if (command[1] == "COMP") + { + result=rigState->compFunc; + } + else if (command[1] == "VOX") + { + result = rigState->voxFunc; + } + else if (command[1] == "TONE") + { + result = rigState->toneFunc; + } + else if (command[1] == "TSQL") + { + result = rigState->tsqlFunc; + } + else if (command[1] == "SBKIN") + { + result = rigState->sbkinFunc; + } + else if (command[1] == "FBKIN") + { + result = rigState->fbkinFunc; + } + else if (command[1] == "ANF") + { + result = rigState->anfFunc; + } + else if (command[1] == "NR") + { + result = rigState->nrFunc; + } + else if (command[1] == "AIP") + { + result = rigState->aipFunc; + } + else if (command[1] == "APF") + { + result = rigState->apfFunc; + } + else if (command[1] == "MON") + { + result = rigState->monFunc; + } + else if (command[1] == "MN") + { + result = rigState->mnFunc; + } + else if (command[1] == "RF") + { + result = rigState->rfFunc; + } + else if (command[1] == "ARO") + { + result = rigState->aroFunc; + } + else if (command[1] == "MUTE") + { + result = rigState->muteFunc; + } + else if (command[1] == "VSC") + { + result = rigState->vscFunc; + } + else if (command[1] == "REV") + { + result = rigState->revFunc; + } + else if (command[1] == "SQL") + { + result = rigState->sqlFunc; + } + else if (command[1] == "ABM") + { + result = rigState->abmFunc; + } + else if (command[1] == "BC") + { + result = rigState->bcFunc; + } + else if (command[1] == "MBC") + { + result = rigState->mbcFunc; + } + else if (command[1] == "RIT") + { + result = rigState->ritFunc; + } + else if (command[1] == "AFC") + { + result = rigState->afcFunc; + } + else if (command[1] == "SATMODE") + { + result = rigState->satmodeFunc; + } + else if (command[1] == "SCOPE") + { + result = rigState->scopeFunc; + } + else if (command[1] == "RESUME") + { + result = rigState->resumeFunc; + } + else if (command[1] == "TBURST") + { + result = rigState->tburstFunc; + } + else if (command[1] == "TUNER") + { + result = rigState->tunerFunc; + } + else if (command[1] == "LOCK") + { + result = rigState->lockFunc; + } + else { + qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1]; + } + + resp.append(QString("%1").arg(result)); response.append(resp); } - else if (command[0] == "R" || command[0] == "set_func") + else if (command.length() >2 && (command[0] == "U" || command[0] == "set_func")) { - setCommand = true; - if (command.length()>2) + setCommand = true; + if (command[1] == "FAGC") + { + rigState->fagcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "NB") + { + rigState->nbFunc = (bool)command[2].toInt(); + } + else if (command[1] == "COMP") + { + rigState->compFunc = (bool)command[2].toInt(); + } + else if (command[1] == "VOX") + { + rigState->voxFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TONE") + { + rigState->toneFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TSQL") + { + rigState->tsqlFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SBKIN") + { + rigState->sbkinFunc = (bool)command[2].toInt(); + } + else if (command[1] == "FBKIN") + { + rigState->fbkinFunc = (bool)command[2].toInt(); + } + else if (command[1] == "ANF") + { + rigState->anfFunc = (bool)command[2].toInt(); + } + else if (command[1] == "NR") + { + rigState->nrFunc = (bool)command[2].toInt(); + } + else if (command[1] == "AIP") + { + rigState->aipFunc = (bool)command[2].toInt(); + } + else if (command[1] == "APF") + { + rigState->apfFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MON") + { + rigState->monFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MN") + { + rigState->mnFunc = (bool)command[2].toInt(); + } + else if (command[1] == "RF") + { + rigState->rfFunc = (bool)command[2].toInt(); + } + else if (command[1] == "ARO") + { + rigState->aroFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MUTE") + { + rigState->muteFunc = (bool)command[2].toInt(); + } + else if (command[1] == "VSC") + { + rigState->vscFunc = (bool)command[2].toInt(); + } + else if (command[1] == "REV") + { + rigState->revFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SQL") + { + rigState->sqlFunc = (bool)command[2].toInt(); + } + else if (command[1] == "ABM") + { + rigState->abmFunc = (bool)command[2].toInt(); + } + else if (command[1] == "BC") + { + rigState->bcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MBC") + { + rigState->mbcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "RIT") + { + rigState->ritFunc = (bool)command[2].toInt(); + } + else if (command[1] == "AFC") + { + rigState->afcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SATMODE") + { + rigState->satmodeFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SCOPE") + { + rigState->scopeFunc = (bool)command[2].toInt(); + } + else if (command[1] == "RESUME") + { + rigState->resumeFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TBURST") + { + rigState->tburstFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TUNER") + { + rigState->tunerFunc = (bool)command[2].toInt(); + } + else if (command[1] == "LOCK") + { + rigState->lockFunc = (bool)command[2].toInt(); + } + else { + qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1] << command[2]; + } qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2]; } else if (command.length() > 1 && (command[0] == 0x88 || command[0] == "get_powerstat")) From d755d30f83e0b3e484488ea5f6130895c508fcd7 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Mon, 9 Aug 2021 17:37:06 +0100 Subject: [PATCH 35/37] Add constants to make parsing (hopefully) easier --- rigctld.h | 208 +++++++++++++++++++++++++++++++++++++++++++++++++ wfview.vcxproj | 8 +- 2 files changed, 212 insertions(+), 4 deletions(-) diff --git a/rigctld.h b/rigctld.h index f8f9f8d..bf8aea5 100644 --- a/rigctld.h +++ b/rigctld.h @@ -59,6 +59,106 @@ #define RIG_MODE_PKTFMN CONSTANT_64BIT_FLAG (34) /*!< \c Yaesu DATA-FM-N */ #define RIG_MODE_SPEC CONSTANT_64BIT_FLAG (35) /*!< \c Unfiltered as in PowerSDR */ +#define RIG_LEVEL_NONE 0 /*!< '' -- No Level */ +#define RIG_LEVEL_PREAMP CONSTANT_64BIT_FLAG(0) /*!< \c PREAMP -- Preamp, arg int (dB) */ +#define RIG_LEVEL_ATT CONSTANT_64BIT_FLAG(1) /*!< \c ATT -- Attenuator, arg int (dB) */ +#define RIG_LEVEL_VOXDELAY CONSTANT_64BIT_FLAG(2) /*!< \c VOXDELAY -- VOX delay, arg int (tenth of seconds) */ +#define RIG_LEVEL_AF CONSTANT_64BIT_FLAG(3) /*!< \c AF -- Volume, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_RF CONSTANT_64BIT_FLAG(4) /*!< \c RF -- RF gain (not TX power) arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_SQL CONSTANT_64BIT_FLAG(5) /*!< \c SQL -- Squelch, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_IF CONSTANT_64BIT_FLAG(6) /*!< \c IF -- IF, arg int (Hz) */ +#define RIG_LEVEL_APF CONSTANT_64BIT_FLAG(7) /*!< \c APF -- Audio Peak Filter, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_NR CONSTANT_64BIT_FLAG(8) /*!< \c NR -- Noise Reduction, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_PBT_IN CONSTANT_64BIT_FLAG(9) /*!< \c PBT_IN -- Twin PBT (inside) arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_PBT_OUT CONSTANT_64BIT_FLAG(10) /*!< \c PBT_OUT -- Twin PBT (outside) arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_CWPITCH CONSTANT_64BIT_FLAG(11) /*!< \c CWPITCH -- CW pitch, arg int (Hz) */ +#define RIG_LEVEL_RFPOWER CONSTANT_64BIT_FLAG(12) /*!< \c RFPOWER -- RF Power, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_MICGAIN CONSTANT_64BIT_FLAG(13) /*!< \c MICGAIN -- MIC Gain, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_KEYSPD CONSTANT_64BIT_FLAG(14) /*!< \c KEYSPD -- Key Speed, arg int (WPM) */ +#define RIG_LEVEL_NOTCHF CONSTANT_64BIT_FLAG(15) /*!< \c NOTCHF -- Notch Freq., arg int (Hz) */ +#define RIG_LEVEL_COMP CONSTANT_64BIT_FLAG(16) /*!< \c COMP -- Compressor, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_AGC CONSTANT_64BIT_FLAG(17) /*!< \c AGC -- AGC, arg int (see enum agc_level_e) */ +#define RIG_LEVEL_BKINDL CONSTANT_64BIT_FLAG(18) /*!< \c BKINDL -- BKin Delay, arg int (tenth of dots) */ +#define RIG_LEVEL_BALANCE CONSTANT_64BIT_FLAG(19) /*!< \c BAL -- Balance (Dual Watch) arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_METER CONSTANT_64BIT_FLAG(20) /*!< \c METER -- Display meter, arg int (see enum meter_level_e) */ +#define RIG_LEVEL_VOXGAIN CONSTANT_64BIT_FLAG(21) /*!< \c VOXGAIN -- VOX gain level, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_ANTIVOX CONSTANT_64BIT_FLAG(22) /*!< \c ANTIVOX -- anti-VOX level, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_SLOPE_LOW CONSTANT_64BIT_FLAG(23) /*!< \c SLOPE_LOW -- Slope tune, low frequency cut, arg int (Hz) */ +#define RIG_LEVEL_SLOPE_HIGH CONSTANT_64BIT_FLAG(24) /*!< \c SLOPE_HIGH -- Slope tune, high frequency cut, arg int (Hz) */ +#define RIG_LEVEL_BKIN_DLYMS CONSTANT_64BIT_FLAG(25) /*!< \c BKIN_DLYMS -- BKin Delay, arg int Milliseconds */ + +/*!< These are not settable */ +#define RIG_LEVEL_RAWSTR CONSTANT_64BIT_FLAG(26) /*!< \c RAWSTR -- Raw (A/D) value for signal strength, specific to each rig, arg int */ +//#define RIG_LEVEL_SQLSTAT CONSTANT_64BIT_FLAG(27) /*!< \c SQLSTAT -- SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */ +#define RIG_LEVEL_SWR CONSTANT_64BIT_FLAG(28) /*!< \c SWR -- SWR, arg float [0.0 ... infinite] */ +#define RIG_LEVEL_ALC CONSTANT_64BIT_FLAG(29) /*!< \c ALC -- ALC, arg float */ +#define RIG_LEVEL_STRENGTH CONSTANT_64BIT_FLAG(30) /*!< \c STRENGTH -- Effective (calibrated) signal strength relative to S9, arg int (dB) */ + /* RIG_LEVEL_BWC (1<<31) */ /*!< Bandwidth Control, arg int (Hz) */ +#define RIG_LEVEL_RFPOWER_METER CONSTANT_64BIT_FLAG(32) /*!< \c RFPOWER_METER -- RF power output meter, arg float [0.0 ... 1.0] (percentage of maximum power) */ +#define RIG_LEVEL_COMP_METER CONSTANT_64BIT_FLAG(33) /*!< \c COMP_METER -- Audio output level compression meter, arg float (dB) */ +#define RIG_LEVEL_VD_METER CONSTANT_64BIT_FLAG(34) /*!< \c VD_METER -- Input voltage level meter, arg float (V, volts) */ +#define RIG_LEVEL_ID_METER CONSTANT_64BIT_FLAG(35) /*!< \c ID_METER -- Current draw meter, arg float (A, amperes) */ +#define RIG_LEVEL_NOTCHF_RAW CONSTANT_64BIT_FLAG(36) /*!< \c NOTCHF_RAW -- Notch Freq., arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_MONITOR_GAIN CONSTANT_64BIT_FLAG(37) /*!< \c MONITOR_GAIN -- Monitor gain (level for monitoring of transmitted audio) arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_NB CONSTANT_64BIT_FLAG(38) /*!< \c NB -- Noise Blanker level, arg float [0.0 ... 1.0] */ +#define RIG_LEVEL_RFPOWER_METER_WATTS CONSTANT_64BIT_FLAG(39) /*!< \c RFPOWER_METER_WATTS -- RF power output meter, arg float [0.0 ... MAX] (output power in watts) */ +#define RIG_LEVEL_SPECTRUM_MODE CONSTANT_64BIT_FLAG(40) /*!< \c SPECTRUM_MODE -- Spectrum scope mode, arg int (see enum rig_spectrum_mode_e). Supported modes defined in rig caps. */ +#define RIG_LEVEL_SPECTRUM_SPAN CONSTANT_64BIT_FLAG(41) /*!< \c SPECTRUM_SPAN -- Spectrum scope span in center mode, arg int (Hz). Supported spans defined in rig caps. */ +#define RIG_LEVEL_SPECTRUM_EDGE_LOW CONSTANT_64BIT_FLAG(42) /*!< \c SPECTRUM_EDGE_LOW -- Spectrum scope low edge in fixed mode, arg int (Hz) */ +#define RIG_LEVEL_SPECTRUM_EDGE_HIGH CONSTANT_64BIT_FLAG(43) /*!< \c SPECTRUM_EDGE_HIGH -- Spectrum scope high edge in fixed mode, arg int (Hz) */ +#define RIG_LEVEL_SPECTRUM_SPEED CONSTANT_64BIT_FLAG(44) /*!< \c SPECTRUM_SPEED -- Spectrum scope update speed, arg int (highest is fastest, define rig-specific granularity) */ +#define RIG_LEVEL_SPECTRUM_REF CONSTANT_64BIT_FLAG(45) /*!< \c SPECTRUM_REF -- Spectrum scope reference display level, arg float (dB, define rig-specific granularity) */ +#define RIG_LEVEL_SPECTRUM_AVG CONSTANT_64BIT_FLAG(46) /*!< \c SPECTRUM_AVG -- Spectrum scope averaging mode, arg int (see struct rig_spectrum_avg_mode). Supported averaging modes defined in rig caps. */ +#define RIG_LEVEL_SPECTRUM_ATT CONSTANT_64BIT_FLAG(47) /*!< \c SPECTRUM_ATT -- Spectrum scope attenuator, arg int (dB). Supported attenuator values defined in rig caps. */ +#define RIG_LEVEL_TEMP_METER CONSTANT_64BIT_FLAG(48) /*!< \c TEMP_METER -- arg int (C, centigrade) */ + +#define RIG_FUNC_NONE 0 /*!< '' -- No Function */ +#define RIG_FUNC_FAGC CONSTANT_64BIT_FLAG (0) /*!< \c FAGC -- Fast AGC */ +#define RIG_FUNC_NB CONSTANT_64BIT_FLAG (1) /*!< \c NB -- Noise Blanker */ +#define RIG_FUNC_COMP CONSTANT_64BIT_FLAG (2) /*!< \c COMP -- Speech Compression */ +#define RIG_FUNC_VOX CONSTANT_64BIT_FLAG (3) /*!< \c VOX -- Voice Operated Relay */ +#define RIG_FUNC_TONE CONSTANT_64BIT_FLAG (4) /*!< \c TONE -- CTCSS Tone TX */ +#define RIG_FUNC_TSQL CONSTANT_64BIT_FLAG (5) /*!< \c TSQL -- CTCSS Activate/De-activate RX */ +#define RIG_FUNC_SBKIN CONSTANT_64BIT_FLAG (6) /*!< \c SBKIN -- Semi Break-in (CW mode) */ +#define RIG_FUNC_FBKIN CONSTANT_64BIT_FLAG (7) /*!< \c FBKIN -- Full Break-in (CW mode) */ +#define RIG_FUNC_ANF CONSTANT_64BIT_FLAG (8) /*!< \c ANF -- Automatic Notch Filter (DSP) */ +#define RIG_FUNC_NR CONSTANT_64BIT_FLAG (9) /*!< \c NR -- Noise Reduction (DSP) */ +#define RIG_FUNC_AIP CONSTANT_64BIT_FLAG (10) /*!< \c AIP -- RF pre-amp (AIP on Kenwood, IPO on Yaesu, etc.) */ +#define RIG_FUNC_APF CONSTANT_64BIT_FLAG (11) /*!< \c APF -- Auto Passband/Audio Peak Filter */ +#define RIG_FUNC_MON CONSTANT_64BIT_FLAG (12) /*!< \c MON -- Monitor transmitted signal */ +#define RIG_FUNC_MN CONSTANT_64BIT_FLAG (13) /*!< \c MN -- Manual Notch */ +#define RIG_FUNC_RF CONSTANT_64BIT_FLAG (14) /*!< \c RF -- RTTY Filter */ +#define RIG_FUNC_ARO CONSTANT_64BIT_FLAG (15) /*!< \c ARO -- Auto Repeater Offset */ +#define RIG_FUNC_LOCK CONSTANT_64BIT_FLAG (16) /*!< \c LOCK -- Lock */ +#define RIG_FUNC_MUTE CONSTANT_64BIT_FLAG (17) /*!< \c MUTE -- Mute */ +#define RIG_FUNC_VSC CONSTANT_64BIT_FLAG (18) /*!< \c VSC -- Voice Scan Control */ +#define RIG_FUNC_REV CONSTANT_64BIT_FLAG (19) /*!< \c REV -- Reverse transmit and receive frequencies */ +#define RIG_FUNC_SQL CONSTANT_64BIT_FLAG (20) /*!< \c SQL -- Turn Squelch Monitor on/off */ +#define RIG_FUNC_ABM CONSTANT_64BIT_FLAG (21) /*!< \c ABM -- Auto Band Mode */ +#define RIG_FUNC_BC CONSTANT_64BIT_FLAG (22) /*!< \c BC -- Beat Canceller */ +#define RIG_FUNC_MBC CONSTANT_64BIT_FLAG (23) /*!< \c MBC -- Manual Beat Canceller */ +#define RIG_FUNC_RIT CONSTANT_64BIT_FLAG (24) /*!< \c RIT -- Receiver Incremental Tuning */ +#define RIG_FUNC_AFC CONSTANT_64BIT_FLAG (25) /*!< \c AFC -- Auto Frequency Control ON/OFF */ +#define RIG_FUNC_SATMODE CONSTANT_64BIT_FLAG (26) /*!< \c SATMODE -- Satellite mode ON/OFF */ +#define RIG_FUNC_SCOPE CONSTANT_64BIT_FLAG (27) /*!< \c SCOPE -- Simple bandscope ON/OFF */ +#define RIG_FUNC_RESUME CONSTANT_64BIT_FLAG (28) /*!< \c RESUME -- Scan auto-resume */ +#define RIG_FUNC_TBURST CONSTANT_64BIT_FLAG (29) /*!< \c TBURST -- 1750 Hz tone burst */ +#define RIG_FUNC_TUNER CONSTANT_64BIT_FLAG (30) /*!< \c TUNER -- Enable automatic tuner */ +#define RIG_FUNC_XIT CONSTANT_64BIT_FLAG (31) /*!< \c XIT -- Transmitter Incremental Tuning */ +#define RIG_FUNC_NB2 CONSTANT_64BIT_FLAG (32) /*!< \c NB2 -- 2nd Noise Blanker */ +#define RIG_FUNC_CSQL CONSTANT_64BIT_FLAG (33) /*!< \c CSQL -- DCS Squelch setting */ +#define RIG_FUNC_AFLT CONSTANT_64BIT_FLAG (34) /*!< \c AFLT -- AF Filter setting */ +#define RIG_FUNC_ANL CONSTANT_64BIT_FLAG (35) /*!< \c ANL -- Noise limiter setting */ +#define RIG_FUNC_BC2 CONSTANT_64BIT_FLAG (36) /*!< \c BC2 -- 2nd Beat Cancel */ +#define RIG_FUNC_DUAL_WATCH CONSTANT_64BIT_FLAG (37) /*!< \c DUAL_WATCH -- Dual Watch / Sub Receiver */ +#define RIG_FUNC_DIVERSITY CONSTANT_64BIT_FLAG (38) /*!< \c DIVERSITY -- Diversity receive */ +#define RIG_FUNC_DSQL CONSTANT_64BIT_FLAG (39) /*!< \c DSQL -- Digital modes squelch */ +#define RIG_FUNC_SCEN CONSTANT_64BIT_FLAG (40) /*!< \c SCEN -- scrambler/encryption */ +#define RIG_FUNC_SLICE CONSTANT_64BIT_FLAG (41) /*!< \c Rig slice selection -- Flex */ +#define RIG_FUNC_TRANSCEIVE CONSTANT_64BIT_FLAG (42) /*!< \c TRANSCEIVE -- Send radio state changes automatically ON/OFF */ +#define RIG_FUNC_SPECTRUM CONSTANT_64BIT_FLAG (43) /*!< \c SPECTRUM -- Spectrum scope data output ON/OFF */ +#define RIG_FUNC_SPECTRUM_HOLD CONSTANT_64BIT_FLAG (44) /*!< \c SPECTRUM_HOLD -- Pause spectrum scope updates ON/OFF */ + static struct { quint64 mode; @@ -102,6 +202,114 @@ static struct { RIG_MODE_NONE, "" }, }; +static struct +{ + quint64 func; + const char* str; +} rig_func_str[] = +{ + { RIG_FUNC_FAGC, "FAGC" }, + { RIG_FUNC_NB, "NB" }, + { RIG_FUNC_COMP, "COMP" }, + { RIG_FUNC_VOX, "VOX" }, + { RIG_FUNC_TONE, "TONE" }, + { RIG_FUNC_TSQL, "TSQL" }, + { RIG_FUNC_SBKIN, "SBKIN" }, + { RIG_FUNC_FBKIN, "FBKIN" }, + { RIG_FUNC_ANF, "ANF" }, + { RIG_FUNC_NR, "NR" }, + { RIG_FUNC_AIP, "AIP" }, + { RIG_FUNC_APF, "APF" }, + { RIG_FUNC_MON, "MON" }, + { RIG_FUNC_MN, "MN" }, + { RIG_FUNC_RF, "RF" }, + { RIG_FUNC_ARO, "ARO" }, + { RIG_FUNC_LOCK, "LOCK" }, + { RIG_FUNC_MUTE, "MUTE" }, + { RIG_FUNC_VSC, "VSC" }, + { RIG_FUNC_REV, "REV" }, + { RIG_FUNC_SQL, "SQL" }, + { RIG_FUNC_ABM, "ABM" }, + { RIG_FUNC_BC, "BC" }, + { RIG_FUNC_MBC, "MBC" }, + { RIG_FUNC_RIT, "RIT" }, + { RIG_FUNC_AFC, "AFC" }, + { RIG_FUNC_SATMODE, "SATMODE" }, + { RIG_FUNC_SCOPE, "SCOPE" }, + { RIG_FUNC_RESUME, "RESUME" }, + { RIG_FUNC_TBURST, "TBURST" }, + { RIG_FUNC_TUNER, "TUNER" }, + { RIG_FUNC_XIT, "XIT" }, + { RIG_FUNC_NB2, "NB2" }, + { RIG_FUNC_DSQL, "DSQL" }, + { RIG_FUNC_AFLT, "AFLT" }, + { RIG_FUNC_ANL, "ANL" }, + { RIG_FUNC_BC2, "BC2" }, + { RIG_FUNC_DUAL_WATCH, "DUAL_WATCH"}, + { RIG_FUNC_DIVERSITY, "DIVERSITY"}, + { RIG_FUNC_CSQL, "CSQL" }, + { RIG_FUNC_SCEN, "SCEN" }, + { RIG_FUNC_TRANSCEIVE, "TRANSCEIVE" }, + { RIG_FUNC_SPECTRUM, "SPECTRUM" }, + { RIG_FUNC_SPECTRUM_HOLD, "SPECTRUM_HOLD" }, + { RIG_FUNC_NONE, "" }, +}; + +static struct +{ + quint64 level; + const char* str; +} rig_level_str[] = +{ + { RIG_LEVEL_PREAMP, "PREAMP" }, + { RIG_LEVEL_ATT, "ATT" }, + { RIG_LEVEL_VOXDELAY, "VOXDELAY" }, + { RIG_LEVEL_AF, "AF" }, + { RIG_LEVEL_RF, "RF" }, + { RIG_LEVEL_SQL, "SQL" }, + { RIG_LEVEL_IF, "IF" }, + { RIG_LEVEL_APF, "APF" }, + { RIG_LEVEL_NR, "NR" }, + { RIG_LEVEL_PBT_IN, "PBT_IN" }, + { RIG_LEVEL_PBT_OUT, "PBT_OUT" }, + { RIG_LEVEL_CWPITCH, "CWPITCH" }, + { RIG_LEVEL_RFPOWER, "RFPOWER" }, + { RIG_LEVEL_MICGAIN, "MICGAIN" }, + { RIG_LEVEL_KEYSPD, "KEYSPD" }, + { RIG_LEVEL_NOTCHF, "NOTCHF" }, + { RIG_LEVEL_COMP, "COMP" }, + { RIG_LEVEL_AGC, "AGC" }, + { RIG_LEVEL_BKINDL, "BKINDL" }, + { RIG_LEVEL_BALANCE, "BAL" }, + { RIG_LEVEL_METER, "METER" }, + { RIG_LEVEL_VOXGAIN, "VOXGAIN" }, + { RIG_LEVEL_ANTIVOX, "ANTIVOX" }, + { RIG_LEVEL_SLOPE_LOW, "SLOPE_LOW" }, + { RIG_LEVEL_SLOPE_HIGH, "SLOPE_HIGH" }, + { RIG_LEVEL_BKIN_DLYMS, "BKIN_DLYMS" }, + { RIG_LEVEL_RAWSTR, "RAWSTR" }, + { RIG_LEVEL_SWR, "SWR" }, + { RIG_LEVEL_ALC, "ALC" }, + { RIG_LEVEL_STRENGTH, "STRENGTH" }, + { RIG_LEVEL_RFPOWER_METER, "RFPOWER_METER" }, + { RIG_LEVEL_COMP_METER, "COMP_METER" }, + { RIG_LEVEL_VD_METER, "VD_METER" }, + { RIG_LEVEL_ID_METER, "ID_METER" }, + { RIG_LEVEL_NOTCHF_RAW, "NOTCHF_RAW" }, + { RIG_LEVEL_MONITOR_GAIN, "MONITOR_GAIN" }, + { RIG_LEVEL_NB, "NB" }, + { RIG_LEVEL_RFPOWER_METER_WATTS, "RFPOWER_METER_WATTS" }, + { RIG_LEVEL_SPECTRUM_MODE, "SPECTRUM_MODE" }, + { RIG_LEVEL_SPECTRUM_SPAN, "SPECTRUM_SPAN" }, + { RIG_LEVEL_SPECTRUM_EDGE_LOW, "SPECTRUM_EDGE_LOW" }, + { RIG_LEVEL_SPECTRUM_EDGE_HIGH, "SPECTRUM_EDGE_HIGH" }, + { RIG_LEVEL_SPECTRUM_SPEED, "SPECTRUM_SPEED" }, + { RIG_LEVEL_SPECTRUM_REF, "SPECTRUM_REF" }, + { RIG_LEVEL_SPECTRUM_AVG, "SPECTRUM_AVG" }, + { RIG_LEVEL_SPECTRUM_ATT, "SPECTRUM_ATT" }, + { RIG_LEVEL_TEMP_METER, "TEMP_METER" }, + { RIG_LEVEL_NONE, "" }, +}; struct cal_table { int size; /*!< number of plots in the table */ diff --git a/wfview.vcxproj b/wfview.vcxproj index 6d319a1..cd54ddb 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -57,7 +57,7 @@ Sync release\ MaxSpeed - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="eddc5d4";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="953f572";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false MultiThreadedDLL @@ -85,7 +85,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"eddc5d4\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"953f572\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h @@ -99,7 +99,7 @@ Sync debug\ Disabled - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="eddc5d4";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT="953f572";HOST="wfview.org";UNAME="build";%(PreprocessorDefinitions) false MultiThreadedDebugDLL true @@ -124,7 +124,7 @@ 0 - _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"eddc5d4\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) + _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;__WINDOWS_WASAPI__;GITSHORT=\"953f572\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h From 4a7dc5d99e77291810f4f504c74bfda3a9a64019 Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 11 Aug 2021 08:41:45 +0200 Subject: [PATCH 36/37] changelog --- CHANGELOG | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 9a9d6af..0e30950 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,95 @@ # CHANGELOG +- 20210809 + + Add constants to make parsing (hopefully) easier + +- 20210808 + + Fake known functions + + Fix float warning + + Remove calibration debugging + + Add proper s-meter calibration + +- 20210807 + + Add ritctl model to rigCaps + + Fix to make wsjt-x work again! + + Add split/duplex support + + Update rigctld.cpp + + Correct lack of parentheses in conditionals + + Fix typo + + Remove some debug logging + + More rigctl features/fixes + +- 20210806 + + Fix for get_powerstat + + Update rigctld.cpp + + Add some levels and other functions + + Fix compile warnings + + Add frequency ranges from rigcaps + +- 20210806 + + Move rigctld settings in Ui + + Fixes for setting freq/mode + + Support for more rigctld commands + + More fixes to rigctld + + Change the way rigctl response is built + + More rigctld fixes + +- 20210804 + + Add rigctld config to ui and fix some bugs + +- 20210802 + + added derSuessman prefix code + +- 20210801 + + Fix broken 8bit audio + + added derSuessmann additions to have a linux install prefix + + Fedora build/install notes, see merge request eliggett/wfview!4 + +- 20210730 + + Added a little extra logic, also some cross-platform help, to the custom + stylesheet loader. + +- 20210729 + + fix: set the style once + + + added /usr/local to search path for the stylesheet + +- 20210726 + + Fixed error in IC-7410 attenuator spec. + - 20210726 Fix for blank username/password in server From eb637d2029a9a3b3d940e97dec170bdeb5e96d7a Mon Sep 17 00:00:00 2001 From: Roeland Jansen Date: Wed, 11 Aug 2021 08:47:51 +0200 Subject: [PATCH 37/37] WHATSNEW? --- WHATSNEW | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 86c24b5..15bbcbd 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,16 +1,9 @@ -The following highlights are in this dot-release: +The following highlights are in this 1.x-release: + + many changes/mods/updates/enhancements to rigctld + rigctld box added in the UI + build process changed: you can add the install prefix (derSuessmann) + added "do not ask again" for switching off rig and exiting wfview - added IC7700, 718, 7100. (more testing needed) - fixes and improvements to audio - ability to choose between rtaudio and qtmultimedia (default) as compile time option - fixes and lots of improvements at the usb-server end - waterfall length can be adjusted now - no need to restart to change CIV address - seamless changing rigs without restart - started support for older rigs like the 718 - wf display disappears when there is no wf capable rig - IC R8600 support improved - for older rigs added a polling timing box to keep stuff keeping smooth - Local af gain now has anti-log audio pot taper.