Lots of changes/fixes inc rewrite rigctld and move more commands.

rigcreator
Phil Taylor 2023-05-24 19:50:01 +01:00
rodzic 163a58b2ec
commit d800c3a594
23 zmienionych plików z 1555 dodań i 2036 usunięć

Wyświetl plik

@ -70,16 +70,19 @@ void cachingQueue::run()
prio = priorityLowest;
}
counter++;
QMutableMultiMapIterator<queuePriority,queueItem> itt(queue);
auto it = queue.find(prio);
if (it != queue.end())
{
auto item = it.value();
emit haveCommand(item.type, item.command,item.param);
it=queue.erase(it);
while (it.key()==prio)
it++;
it = queue.erase(it);
it = queue.end();
//if (it != queue.end()) {
// while (it != queue.end() && it.key()==prio)
// it++;
//}
// Add it back into the queue
if (item.recurring) {
queue.insert(it,prio,item);
@ -125,6 +128,7 @@ void cachingQueue::add(queuePriority prio ,queueItem item)
} else {
queue.insert(prio, item);
updateCache(false,item.command,item.param);
// Update cache with sent data (will be replaced if found to be invalid.)
if (item.recurring) qInfo() << "adding" << funcString[item.command] << "recurring" << item.recurring << "priority" << prio;
}
}
@ -218,15 +222,24 @@ void cachingQueue::receiveValue(funcs func, QVariant value)
void cachingQueue::updateCache(bool reply, funcs func, QVariant value)
{
/* if (func == funcFreqGet || func == funcFreqTR || func == funcSelectedFreq || func == funcUnselectedFreq)
func = funcVFOFrequency; // This is a composite function.
if (func == funcModeGet || func == funcModeTR || func == funcSelectedMode || func == funcUnselectedMode)
func = funcVFOMode; // This is a composite function. */
// Mutex MUST be locked by the calling function.
auto cv = cache.find(func);
if (cv != cache.end()) {
if (reply) {
cv->reply = QDateTime::currentDateTime();
cv->value = value;
} else {
cv->req = QDateTime::currentDateTime();
}
// If we are sending an actual value, update the cache with it
// Value will be replaced if invalid on next get()
if (value.isValid())
cv->value = value;
return;
}
@ -234,23 +247,33 @@ void cachingQueue::updateCache(bool reply, funcs func, QVariant value)
c.command = func;
if (reply) {
c.reply = QDateTime::currentDateTime();
c.value = value;
} else {
c.req = QDateTime::currentDateTime();
}
// If we are sending an actual value, update the cache with it
// Value will be replaced if invalid on next get()
if (value.isValid())
c.value = value;
cache.insert(func,c);
}
cacheItem cachingQueue::getCache(funcs func)
{
QMutexLocker locker(&mutex);
auto it = cache.find(func);
if (it != cache.end())
{
return it.value();
cacheItem ret;
if (func != funcNone) {
QMutexLocker locker(&mutex);
auto it = cache.find(func);
if (it != cache.end())
ret = cacheItem(*it);
}
return cacheItem();
// If the cache is more than 5-20 seconds old, re-request it as it may be stale (maybe make this a config option?)
// Using priorityhighest WILL slow down the S-Meter when a command intensive client is connected to rigctl
if (func != funcNone && (!ret.value.isValid() || ret.reply.addSecs(QRandomGenerator::global()->bounded(5,20)) <= QDateTime::currentDateTime())) {
//qInfo() << "No (or expired) cache found for" << funcString[func] << "requesting";
add(priorityHighest,func);
}
return ret;
}
//Calling function MUST call unlockMutex() once finished with data

Wyświetl plik

@ -12,6 +12,7 @@
#include <QRect>
#include <QWaitCondition>
#include <QDateTime>
#include <QRandomGenerator>
#include "wfviewtypes.h"
#include "rigidentities.h"

Wyświetl plik

@ -90,7 +90,6 @@ private:
quint8 spectrumDivisionMax;
quint8 spectrumCenterOrFixed;
quint8 spectrumInformation;
quint8 spectrumOutOfRange;
quint8 lastSpectrum = 0;
QTime lastDataReceived;
};

Wyświetl plik

@ -18,6 +18,7 @@ cwSender::cwSender(QWidget *parent) :
ui->statusbar->setToolTipDuration(3000);
this->setToolTipDuration(3000);
connect(ui->textToSendEdit->lineEdit(), &QLineEdit::textEdited, this, &cwSender::textChanged);
queue = cachingQueue::getInstance(this);
}
cwSender::~cwSender()
@ -30,11 +31,11 @@ cwSender::~cwSender()
toneThread = Q_NULLPTR;
tone = Q_NULLPTR;
/* Finally disconnect all connections */
for (auto conn: connections)
{
disconnect(conn);
}
connections.clear();
//for (auto conn: connections)
//{
// disconnect(conn);
//}
//connections.clear();
}
delete ui;
@ -272,22 +273,65 @@ void cwSender::on_sidetoneEnableChk_clicked(bool clicked)
tone->moveToThread(toneThread);
toneThread->start();
connections.append(connect(toneThread, &QThread::finished,
[=]() { tone->deleteLater(); }));
connections.append(connect(this, &cwSender::sendCW,
[=](const QString& text) { tone->send(text); ui->sidetoneEnableChk->setEnabled(false); }));
connections.append(connect(this, &cwSender::setKeySpeed,
[=](const unsigned char& wpm) { tone->setSpeed(wpm); }));
connections.append(connect(this, &cwSender::setDashRatio,
[=](const unsigned char& ratio) { tone->setRatio(ratio); }));
connections.append(connect(this, &cwSender::setPitch,
[=](const unsigned char& pitch) { tone->setFrequency(pitch); }));
connections.append(connect(this, &cwSender::setLevel,
[=](const unsigned char& level) { tone->setLevel(level); }));
connections.append(connect(this, &cwSender::stopCW,
[=]() { tone->stopSending(); }));
connections.append(connect(tone, &cwSidetone::finished,
[=]() { ui->sidetoneEnableChk->setEnabled(true); }));
connect(this,SIGNAL(initTone()),tone,SLOT(init()));
connect(toneThread, &QThread::finished, tone,
[=]() { tone->deleteLater(); });
connect(this, &cwSender::sendCW, tone, [=](const QString& text) {
tone->send(text); ui->sidetoneEnableChk->setEnabled(false);
});
connect(this, &cwSender::sendCW, queue, [=](const QString &cwMessage) {
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(cwMessage)));
});
connect(this, &cwSender::stopCW, queue, [=]() {
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(QChar(0xff))));
});
connect(this, &cwSender::setBreakInMode, queue, [=](const unsigned char &bmode) {
queue->add(priorityImmediate,queueItem(funcBreakIn,QVariant::fromValue<uchar>(bmode)));
});
connect(this, &cwSender::setKeySpeed, queue, [=](const unsigned char& wpm) {
queue->add(priorityImmediate,queueItem(funcKeySpeed,QVariant::fromValue<ushort>(wpm)));
});
connect(this, &cwSender::setDashRatio, queue, [=](const unsigned char& ratio) {
queue->add(priorityImmediate,queueItem(funcDashRatio,QVariant::fromValue<uchar>(ratio)));
});
connect(this, &cwSender::setPitch, queue, [=](const unsigned char& pitch) {
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<ushort>(pitch)));
});
connect(this, &cwSender::getCWSettings, queue, [=]() {
queue->add(priorityImmediate,funcKeySpeed);
queue->add(priorityImmediate,funcBreakIn);
queue->add(priorityImmediate,funcCwPitch);
queue->add(priorityImmediate,funcDashRatio);
});
connect(this, &cwSender::setKeySpeed, tone,
[=](const unsigned char& wpm) { tone->setSpeed(wpm); });
connect(this, &cwSender::setDashRatio, tone,
[=](const unsigned char& ratio) { tone->setRatio(ratio); });
connect(this, &cwSender::setPitch, tone,
[=](const unsigned char& pitch) { tone->setFrequency(pitch); });
connect(this, &cwSender::setLevel, tone,
[=](const unsigned char& level) { tone->setLevel(level); });
connect(this, &cwSender::stopCW, tone,
[=]() { tone->stopSending(); });
connect(tone, &cwSidetone::finished, this,
[=]() { ui->sidetoneEnableChk->setEnabled(true); });
emit initTone();
} else if (!clicked && toneThread != Q_NULLPTR) {
/* disconnect all connections */
@ -295,11 +339,13 @@ void cwSender::on_sidetoneEnableChk_clicked(bool clicked)
toneThread->wait();
toneThread = Q_NULLPTR;
tone = Q_NULLPTR;
/*
for (auto conn: connections)
{
disconnect(conn);
}
connections.clear();
*/
}
}

Wyświetl plik

@ -11,6 +11,7 @@
#include <math.h>
#include "cwsidetone.h"
#include "wfviewtypes.h"
#include "cachingqueue.h"
namespace Ui {
class cwSender;
@ -47,6 +48,7 @@ signals:
void pitchChanged(int val);
void dashChanged(int val);
void wpmChanged(int val);
void initTone();
public slots:
void handleKeySpeed(unsigned char wpm);
@ -114,6 +116,7 @@ private:
QThread* toneThread = Q_NULLPTR;
bool sidetoneWasEnabled=false;
QList<QMetaObject::Connection> connections;
cachingQueue* queue;
};
#endif // CWSENDER_H

Wyświetl plik

@ -10,7 +10,8 @@ cwSidetone::cwSidetone(int level, int speed, int freq, double ratio, QWidget* pa
ratio(ratio)
{
/*
qInfo(logCW()) << "Starting sidetone. Thread=" << QThread::currentThreadId();
/*
* Characters to match Icom table
* Unknown characters will return '?'
*/
@ -68,7 +69,7 @@ cwSidetone::cwSidetone(int level, int speed, int freq, double ratio, QWidget* pa
cwTable[' '] = " ";
init();
//init();
}
cwSidetone::~cwSidetone()
@ -80,6 +81,7 @@ cwSidetone::~cwSidetone()
void cwSidetone::init()
{
qInfo(logCW()) << "Sidetone init() Thread=" << QThread::currentThreadId();
format.setSampleRate(44100);
format.setChannelCount(1);
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))

Wyświetl plik

@ -8,6 +8,7 @@
#include <QtMath>
#include <QMutex>
#include <QMutexLocker>
#include <QThread>
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
#include <QAudioDeviceInfo>
@ -45,8 +46,8 @@ public slots:
void setRatio(unsigned char ratio);
void setLevel(int level);
void stopSending();
private:
void init();
private:
void generateMorse(QString morse);
QByteArray generateData(qint64 len, qint64 freq);

Wyświetl plik

@ -509,7 +509,7 @@ void repeaterSetup::on_rptToneCombo_activated(int tindex)
{
quint16 tone=0;
tone = (quint16)ui->rptToneCombo->itemData(tindex).toUInt();
rptrTone_t rt;
toneInfo rt;
rt.tone = tone;
bool updateSub = ui->setSplitRptrToneChk->isEnabled() && ui->setSplitRptrToneChk->isChecked();
if(ui->toneTone->isChecked())
@ -517,7 +517,7 @@ void repeaterSetup::on_rptToneCombo_activated(int tindex)
emit setTone(rt);
if(updateSub)
{
rt.useSecondaryVFO = true;
//rt.useSecondaryVFO = true;
emit setTone(rt);
}
@ -525,7 +525,7 @@ void repeaterSetup::on_rptToneCombo_activated(int tindex)
emit setTSQL(rt);
if(updateSub)
{
rt.useSecondaryVFO = true;
//rt.useSecondaryVFO = true;
emit setTone(rt);
}
}
@ -533,11 +533,11 @@ void repeaterSetup::on_rptToneCombo_activated(int tindex)
void repeaterSetup::on_rptDTCSCombo_activated(int index)
{
quint16 dcode=0;
bool tinv = ui->rptDTCSInvertTx->isChecked();
bool rinv = ui->rptDTCSInvertRx->isChecked();
dcode = (quint16)ui->rptDTCSCombo->itemData(index).toUInt();
emit setDTCS(dcode, tinv, rinv);
toneInfo tone;
tone.tinv = ui->rptDTCSInvertTx->isChecked();
tone.rinv = ui->rptDTCSInvertRx->isChecked();
tone.tone = (quint16)ui->rptDTCSCombo->itemData(index).toUInt();
emit setDTCS(tone);
}
void repeaterSetup::on_toneNone_clicked()
@ -562,7 +562,7 @@ void repeaterSetup::on_toneTone_clicked()
rptrAccessData rd;
rm = ratrTN;
rd.accessMode = rm;
rptrTone_t rt;
toneInfo rt;
rt.tone = (quint16)ui->rptToneCombo->currentData().toUInt();
emit setRptAccessMode(rd);
emit setTone(rt);
@ -571,8 +571,8 @@ void repeaterSetup::on_toneTone_clicked()
if(updateSub)
{
rd.useSecondaryVFO = true;
rt.useSecondaryVFO = true;
//rd.useSecondaryVFO = true;
//rt.useSecondaryVFO = true;
emit setRptAccessMode(rd);
emit setTone(rt);
}
@ -583,7 +583,7 @@ void repeaterSetup::on_toneTSQL_clicked()
rptAccessTxRx_t rm;
rptrAccessData rd;
rm = ratrTT;
rptrTone_t rt;
toneInfo rt;
rt.tone = (quint16)ui->rptToneCombo->currentData().toUInt();
rd.accessMode = rm;
emit setRptAccessMode(rd);
@ -592,8 +592,8 @@ void repeaterSetup::on_toneTSQL_clicked()
if(updateSub)
{
rd.useSecondaryVFO = true;
rt.useSecondaryVFO = true;
//rd.useSecondaryVFO = true;
//rt.useSecondaryVFO = true;
emit setRptAccessMode(rd);
emit setTone(rt);
}
@ -602,15 +602,14 @@ void repeaterSetup::on_toneTSQL_clicked()
void repeaterSetup::on_toneDTCS_clicked()
{
rptrAccessData rd;
quint16 dcode=0;
rd.accessMode = ratrDD;
emit setRptAccessMode(rd);
bool tinv = ui->rptDTCSInvertTx->isChecked();
bool rinv = ui->rptDTCSInvertRx->isChecked();
dcode = (quint16)ui->rptDTCSCombo->currentData().toUInt();
emit setDTCS(dcode, tinv, rinv);
toneInfo tone;
tone.tinv = ui->rptDTCSInvertTx->isChecked();
tone.rinv = ui->rptDTCSInvertRx->isChecked();
tone.tone = (quint16)ui->rptDTCSCombo->currentData().toUInt();
emit setDTCS(tone);
// TODO: DTCS with subband
}
@ -785,9 +784,9 @@ void repeaterSetup::on_setToneSubVFOBtn_clicked()
// Perhaps not needed
// Set the secondary VFO to the selected tone
// TODO: DTCS
rptrTone_t rt;
toneInfo rt;
rt.tone = (quint16)ui->rptToneCombo->currentData().toUInt();
rt.useSecondaryVFO = true;
//rt.useSecondaryVFO = true;
emit setTone(rt);
}

Wyświetl plik

@ -23,9 +23,9 @@ public:
signals:
void getDuplexMode();
void setDuplexMode(duplexMode_t dm);
void setTone(rptrTone_t tone);
void setTSQL(rptrTone_t tsql);
void setDTCS(quint16 dcode, bool tinv, bool rinv);
void setTone(toneInfo tone);
void setTSQL(toneInfo tsql);
void setDTCS(toneInfo tsql);
void getTone();
void getTSQL();
void getDTCS();

Wyświetl plik

@ -456,7 +456,7 @@ void rigCommander::setSpectrumBounds(double startFreq, double endFreq, unsigned
unsigned char range = 1;
QByteArray payload;
if (getCommand(funcScopeFixedFreq,payload,edgeNumber))
if (getCommand(funcScopeFixedEdgeFreq,payload,edgeNumber))
{
// Each band should be configured with a maximum range, except for the ICR8600 which doesn't really have "bands"
for (bandType band: rigCaps.bands)
@ -480,7 +480,7 @@ void rigCommander::getScopeMode()
// center or fixed
QByteArray payload;
unsigned char cmd = '\x00';
if (getCommand(funcScopeCenterFixed,payload,cmd))
if (getCommand(funcScopeMainMode,payload,cmd))
{
payload.append(cmd);
prepDataAndSend(payload);
@ -491,7 +491,7 @@ void rigCommander::getScopeEdge()
{
QByteArray payload;
unsigned char cmd = '\x00';
if (getCommand(funcScopeEdgeNumber,payload,cmd))
if (getCommand(funcScopeMainEdge,payload,cmd))
{
payload.append(cmd);
prepDataAndSend(payload);
@ -503,7 +503,7 @@ void rigCommander::setScopeEdge(char edge)
// 1 2 or 3 (check command definition)
QByteArray payload;
unsigned char vfo = '\x00';
if (getCommand(funcScopeEdgeNumber,payload,edge))
if (getCommand(funcScopeMainEdge,payload,edge))
{
payload.append(vfo);
payload.append(edge);
@ -519,7 +519,7 @@ void rigCommander::getScopeSpan()
void rigCommander::getScopeSpan(bool isSub)
{
QByteArray payload;
if (getCommand(funcScopeCenterSpan,payload,static_cast<int>(isSub)))
if (getCommand(funcScopeMainSpan,payload,static_cast<int>(isSub)))
{
payload.append(static_cast<unsigned char>(isSub));
prepDataAndSend(payload);
@ -534,7 +534,7 @@ void rigCommander::setScopeSpan(char span)
QByteArray payload;
unsigned char vfo = '\x00';
if (getCommand(funcScopeCenterSpan,payload,span))
if (getCommand(funcScopeMainSpan,payload,span))
{
payload.append(vfo);
payload.append("\x00"); // 10Hz/1Hz
@ -557,7 +557,7 @@ void rigCommander::setspectrumMode_t(spectrumMode_t spectMode)
{
QByteArray payload;
unsigned char vfo = '\x00';
if (getCommand(funcScopeCenterFixed,payload,static_cast<int>(spectMode)))
if (getCommand(funcScopeMainMode,payload,static_cast<int>(spectMode)))
{
payload.append(vfo);
payload.append(static_cast<unsigned char>(spectMode) );
@ -573,7 +573,7 @@ void rigCommander::getSpectrumRefLevel()
void rigCommander::getSpectrumRefLevel(unsigned char mainSub)
{
QByteArray payload;
if (getCommand(funcScopeRef,payload,static_cast<int>(mainSub)))
if (getCommand(funcScopeMainRef,payload,static_cast<int>(mainSub)))
{
payload.append(mainSub);
prepDataAndSend(payload);
@ -585,7 +585,7 @@ void rigCommander::setSpectrumRefLevel(int level)
// -30 to +10
unsigned char vfo = 0x0;
QByteArray payload;
if (getCommand(funcScopeRef,payload,level))
if (getCommand(funcScopeMainRef,payload,level))
{
bool isNegative = false;
if(level < 0)
@ -604,7 +604,7 @@ void rigCommander::setSpectrumRefLevel(int level)
void rigCommander::getSpectrumCenterMode()
{
QByteArray payload;
if (getCommand(funcScopeCenterFixed,payload))
if (getCommand(funcScopeMainMode,payload))
{
prepDataAndSend(payload);
}
@ -613,7 +613,7 @@ void rigCommander::getSpectrumCenterMode()
void rigCommander::getspectrumMode_t()
{
QByteArray payload;
if (getCommand(funcScopeCenterFixed,payload))
if (getCommand(funcScopeMainMode,payload))
{
prepDataAndSend(payload);
}
@ -950,7 +950,7 @@ void rigCommander::setSplit(bool splitEnabled)
void rigCommander::setDuplexMode(duplexMode_t dm)
{
QByteArray payload;
if (getCommand(funcDuplexStatus,payload,static_cast<int>(dm)))
if (getCommand(funcSplitStatus,payload,static_cast<int>(dm)))
{
payload.append(static_cast<unsigned char>(dm));
prepDataAndSend(payload);
@ -964,7 +964,7 @@ void rigCommander::setDuplexMode(duplexMode_t dm)
void rigCommander::getDuplexMode()
{
QByteArray payload;
if (getCommand(funcDuplexStatus,payload))
if (getCommand(funcSplitStatus,payload))
{
prepDataAndSend(payload);
}
@ -1145,17 +1145,17 @@ void rigCommander::getTransmitFrequency()
void rigCommander::setTone(quint16 tone)
{
rptrTone_t t;
toneInfo t;
t.tone = tone;
setTone(t);
}
void rigCommander::setTone(rptrTone_t t)
void rigCommander::setTone(toneInfo t)
{
QByteArray payload;
if (getCommand(funcMainSubPrefix,payload))
{
payload.append(static_cast<unsigned char>(t.useSecondaryVFO));
//payload.append(static_cast<unsigned char>(t.useSecondaryVFO));
}
if (getCommand(funcToneFreq,payload,static_cast<int>(t.tone)))
@ -1167,17 +1167,17 @@ void rigCommander::setTone(rptrTone_t t)
void rigCommander::setTSQL(quint16 t)
{
rptrTone_t tn;
toneInfo tn;
tn.tone = t;
setTSQL(tn);
}
void rigCommander::setTSQL(rptrTone_t t)
void rigCommander::setTSQL(toneInfo t)
{
QByteArray payload;
if (getCommand(funcMainSubPrefix,payload))
{
payload.append(static_cast<unsigned char>(t.useSecondaryVFO));
//payload.append(static_cast<unsigned char>(t.useSecondaryVFO));
}
if (getCommand(funcTSQLFreq,payload,static_cast<int>(t.tone)))
@ -2000,7 +2000,7 @@ void rigCommander::parseCommand()
switch (func)
{
case funcFreqGet:
case funcfreqTR:
case funcFreqTR:
case funcReadTXFreq:
{
value.setValue(parseFrequency());
@ -2075,12 +2075,15 @@ void rigCommander::parseCommand()
value.setValue(parseFrequencyRptOffset(payloadIn));
break;
// These return a single byte that we convert to a uchar (0-99)
case funcSplitStatus:
case funcDuplexStatus:
case funcTuningStep:
case funcAttenuator:
case funcBreakIn: // This is 0,1 or 2
value.setValue(uchar(payloadIn[1]));
break;
// Return a duplexMode_t for split or duplex (same function)
case funcSplitStatus:
value.setValue(duplexMode_t(payloadIn[1]));
break;
case funcAntenna:
{
antennaInfo ant;
@ -2094,6 +2097,8 @@ void rigCommander::parseCommand()
case funcAfGain:
if (udp == Q_NULLPTR) {
value.setValue(bcdHexToUChar(payloadIn[2],payloadIn[3]));
} else {
value.setValue(localVolume);
}
break;
// The following group are 2 bytes converted to uchar (0-255)
@ -2169,7 +2174,11 @@ void rigCommander::parseCommand()
// 0x19 it automatically added.
case funcTransceiverId:
value.setValue(static_cast<uchar>(payloadIn[2]));
model = determineRadioModel(payloadIn[2]); // verify this is the model not the CIV
if (rigList.contains(uchar(payloadIn[2])))
{
this->model = rigList.find(uchar(payloadIn[2])).key();
}
//model = determineRadioModel(payloadIn[2]); // verify this is the model not the CIV
rigCaps.modelID = payloadIn[2];
determineRigCaps();
qInfo(logRig()) << "Have rig ID: " << QString::number(rigCaps.modelID,16);
@ -2265,10 +2274,11 @@ void rigCommander::parseCommand()
break;
ritHz = f.Hz*((payloadIn.at(4)=='\x01')?-1:1);
value.setValue(ritHz);
qInfo() << "Have RIT" << ritHz;
break;
}
// 0x27
case funcScopeWaveData:
case funcScopeMainWaveData:
{
scopeData d;
if (parseSpectrum(d))
@ -2288,37 +2298,37 @@ void rigCommander::parseCommand()
case funcScopeSingleDual:
// This tells us whether we are receiving single or dual scopes
break;
case funcScopeCenterFixed:
case funcScopeMainMode:
// fixed or center
// [1] 0x14
// [2] 0x00
// [3] 0x00 (center), 0x01 (fixed), 0x02, 0x03
value.setValue(static_cast<spectrumMode_t>(uchar(payloadIn[3])));
//emit havespectrumMode_t(static_cast<spectrumMode_t>((unsigned char)payloadIn[3]));
break;
case funcScopeCenterSpan:
case funcScopeMainSpan:
{
freqt f = parseFrequency(payloadIn, 6);
f.VFO = static_cast<selVFO_t>((uchar)payloadIn[2]);
value.setValue(f);
// read span in center mode
// [1] 0x15
// [2] to [8] is spastatic_cast<bool>(payloadIn.at(2)n encoded as a frequency
//emit haveScopeSpan(parseFrequency(payloadIn, 6), static_cast<bool>(payloadIn.at(2)));
foreach (auto s, rigCaps.scopeCenterSpans)
{
if (s.freq == f.Hz)
{
value.setValue(s);
}
}
break;
}
case funcScopeEdgeNumber:
case funcScopeMainEdge:
// read edge mode center in edge mode
// [1] 0x16
// [2] 0x01, 0x02, 0x03: Edge 1,2,3
value.setValue(bcdHexToUChar(payloadIn[2]));
//emit haveScopeEdge((char)payloadIn[2]);
break;
case funcScopeHold:
case funcScopeMainHold:
// Hold status (only 9700?)
value.setValue(static_cast<bool>(payloadIn[2]));
break;
case funcScopeRef:
case funcScopeMainRef:
{
// scope reference level
// [1] 0x19
@ -2335,12 +2345,12 @@ void rigCommander::parseCommand()
value.setValue(ref);
break;
}
case funcScopeSpeed:
case funcScopeMainSpeed:
case funcScopeDuringTX:
case funcScopeCenterType:
case funcScopeVBW:
case funcScopeFixedFreq:
case funcScopeRBW:
case funcScopeMainVBW:
case funcScopeFixedEdgeFreq:
case funcScopeMainRBW:
break;
// 0x28
case funcVoiceTX:
@ -2360,7 +2370,7 @@ void rigCommander::parseCommand()
break;
}
if( (func != funcScopeWaveData) && (payloadIn[00] != '\x15') )
if(func != funcScopeMainWaveData && func != funcScopeSubWaveData && payloadIn[00] != '\x15')
{
// We do not log spectrum and meter data,
// as they tend to clog up any useful logging.
@ -5552,29 +5562,27 @@ bool rigCommander::parseSpectrum(scopeData& d)
if(payloadIn.length() >= 15)
{
d.oor=(bool)payloadIn[16];
if(d.oor != wasOutOfRange)
{
emit haveScopeOutOfRange(d.oor);
wasOutOfRange = d.oor;
return false;
if (d.oor) {
d.data = QByteArray(rigCaps.spectLenMax,'\0');
return true;
}
}
// wave information
spectrumLine.clear();
// For Fixed, and both scroll modes, the following produces correct information:
fStart = parseFrequency(payloadIn, 9);
spectrumStartFreq = fStart.MHzDouble;
d.startFreq = fStart.MHzDouble;
fEnd = parseFrequency(payloadIn, 14);
spectrumEndFreq = fEnd.MHzDouble;
d.endFreq = fEnd.MHzDouble;
if(scopeMode == spectModeCenter)
{
// "center" mode, start is actual center, end is bandwidth.
spectrumStartFreq -= spectrumEndFreq;
spectrumEndFreq = spectrumStartFreq + 2*(spectrumEndFreq);
d.startFreq = spectrumStartFreq;
d.endFreq = spectrumEndFreq;
// emit haveSpectrumCenterSpan(span);
d.startFreq -= d.endFreq;
d.endFreq = d.startFreq + 2*(d.endFreq);
}
if (payloadIn.length() > 400) // Must be a LAN packet.
@ -5582,7 +5590,6 @@ bool rigCommander::parseSpectrum(scopeData& d)
payloadIn.chop(1);
d.data.append(payloadIn.right(payloadIn.length()-17)); // write over the FD, last one doesn't, oh well.
ret = true;
//emit haveSpectrumData(spectrumLine, spectrumStartFreq, spectrumEndFreq);
}
}
else if ((sequence > 1) && (sequence < rigCaps.spectSeqMax))
@ -5880,7 +5887,12 @@ modeInfo rigCommander::parseMode(quint8 mode, quint8 filter)
qInfo(logRig()) << QString("parseMode() Couldn't find a matching mode %0 with filter %1").arg(mode).arg(filter);
cacheItem item = queue->getCache(funcFilterWidth);
if (!item.value.isValid()) {
if (item.value.isValid()) {
mi.pass = item.value.toInt();
}
else
{
/* We haven't got a valid passband from the rig so we
need to create a 'fake' one from default values
@ -6288,11 +6300,13 @@ void rigCommander::setRigID(unsigned char rigID)
// this->civAddr comes from how rigCommander is setup and should be accurate.
this->incomingCIVAddr = this->civAddr;
this->model = determineRadioModel(rigID);
if (rigList.contains(rigID)) this->model = rigID;
rigCaps.modelID = rigID;
rigCaps.model = determineRadioModel(rigID);
rigCaps.model = this->model;
determineRigCaps();
//this->model = determineRadioModel(rigID);
//rigCaps.model = determineRadioModel(rigID);
}
void rigCommander::changeLatency(const quint16 value)
@ -6873,16 +6887,48 @@ void rigCommander::receiveCommand(queueItemType type, funcs func, QVariant value
//qInfo() << "Got command:" << funcString[func];
int val=INT_MIN;
if (value.isValid()) {
val = value.value<int>() & 0xffff;
if (value.isValid() && value.canConvert<int>()) {
// Used to validate payload, otherwise ignore.
val = value.value<int>();
//qInfo(logRig()) << "Got value" << QString(value.typeName());
if (func == funcMemoryContents || func == funcMemoryClear || func == funcMemoryWrite)
{
// Strip out group number from memory for validation purposes.
val = val & 0xffff;
}
}
if (func == funcSelectVFO) {
if (func == funcSendCW)
{
val = value.value<QString>().length();
}
if (func == funcAfGain && value.isValid() && udp != Q_NULLPTR) {
// Ignore the AF Gain command, just queue it for processing
emit haveSetVolume(static_cast<uchar>(value.toInt()));
queue->receiveValue(func,value);
return;
}
// Need to work out what to do with older dual-VFO rigs.
if ((func == funcSelectedFreq || func == funcUnselectedFreq) && !rigCaps.commands.contains(func))
{
if (value.isValid())
func = funcFreqSet;
else
func = funcFreqGet;
} else if ((func == funcSelectedMode || func == funcUnselectedMode) && !rigCaps.commands.contains(func))
{
if (value.isValid())
func = funcModeSet;
else
func = funcModeGet;
} else if (func == funcSelectVFO) {
// Special command
vfo_t vfo = value.value<vfo_t>();
func = (vfo == vfoA)?funcVFOASelect:(vfo == vfoB)?funcVFOBSelect:(vfo == vfoMain)?funcVFOMainSelect:funcVFOSubSelect;
value.clear();
val = INT_MIN;
}
QByteArray payload;
@ -6890,11 +6936,38 @@ void rigCommander::receiveCommand(queueItemType type, funcs func, QVariant value
{
if (value.isValid())
{
if (!strcmp(value.typeName(),"bool"))
{
payload.append(value.value<bool>());
}
if (!strcmp(value.typeName(),"QString"))
{
QString text = value.value<QString>();
if (pttAllowed && func == funcSendCW)
{
QByteArray textData = text.toLocal8Bit();
unsigned char p=0;
for(int c=0; c < textData.length(); c++)
{
p = textData.at(c);
if( ( (p >= 0x30) && (p <= 0x39) ) ||
( (p >= 0x41) && (p <= 0x5A) ) ||
( (p >= 0x61) && (p <= 0x7A) ) ||
(p==0x2F) || (p==0x3F) || (p==0x2E) ||
(p==0x2D) || (p==0x2C) || (p==0x3A) ||
(p==0x27) || (p==0x28) || (p==0x29) ||
(p==0x3D) || (p==0x2B) || (p==0x22) ||
(p==0x40) || (p==0x20) )
{
// Allowed character, continue
} else {
qWarning(logRig()) << "Invalid character detected in CW message at position " << c << ", the character is " << text.at(c);
textData[c] = 0x3F; // "?"
}
}
payload.append(textData);
}
}
else if (!strcmp(value.typeName(),"uchar"))
{
payload.append(bcdEncodeChar(value.value<uchar>()));
@ -6906,6 +6979,25 @@ void rigCommander::receiveCommand(queueItemType type, funcs func, QVariant value
else
payload.append(bcdEncodeInt(value.value<ushort>()));
}
else if (!strcmp(value.typeName(),"short"))
{
// Currently only used for RIT (I think)
bool isNegative = false;
short val = value.value<short>();
qInfo() << "Setting rit to " << val;
if(val < 0)
{
isNegative = true;
val *= -1;
}
freqt f;
QByteArray freqBytes;
f.Hz = val;
freqBytes = makeFreqPayload(f);
freqBytes.truncate(2);
payload.append(freqBytes);
payload.append(QByteArray(1,(char)isNegative));
}
else if (!strcmp(value.typeName(),"uint") && (func == funcMemoryContents || func == funcMemoryMode))
{
// Format is different for all radios!
@ -6949,7 +7041,8 @@ void rigCommander::receiveCommand(queueItemType type, funcs func, QVariant value
else if(!strcmp(value.typeName(),"antennaInfo"))
{
payload.append(value.value<antennaInfo>().antenna);
payload.append(value.value<antennaInfo>().rx);
if (rigCaps.commands.contains(funcRXAntenna))
payload.append(value.value<antennaInfo>().rx);
}
else if(!strcmp(value.typeName(),"rigInput"))
{
@ -6959,16 +7052,55 @@ void rigCommander::receiveCommand(queueItemType type, funcs func, QVariant value
{
payload.append(setMemory(value.value<memoryType>()));
}
else if (!strcmp(value.typeName(),"spectrumBounds"))
{
spectrumBounds s = value.value<spectrumBounds>();
uchar range=1;
for (bandType band: rigCaps.bands)
{
if (band.range != 0.0 && s.start > band.range)
range++;
}
payload.append(range);
payload.append(s.edge);
payload.append(makeFreqPayload(s.start));
payload.append(makeFreqPayload(s.end));
qInfo() << "Bounds" << range << s.edge << s.start << s.end << payload.toHex();
}
else if (!strcmp(value.typeName(),"duplexMode_t"))
{
payload.append(static_cast<uchar>(value.value<duplexMode_t>()));
}
else if (!strcmp(value.typeName(),"spectrumMode_t"))
{
payload.append(static_cast<uchar>(value.value<spectrumMode_t>()));
}
else if (!strcmp(value.typeName(),"centerSpanData"))
{
centerSpanData span = value.value<centerSpanData>();
double freq = double(span.freq/1000000.0);
payload.append(makeFreqPayload(freq));
}
else if (!strcmp(value.typeName(),"toneInfo"))
{
toneInfo t = value.value<toneInfo>();
payload.append(encodeTone(t.tone, t.tinv, t.rinv));
}
else
{
qInfo(logRig()) << "Got unknown value type" << QString(value.typeName());
return;
}
// This was a set command, so queue a get straight after to retrieve the updated value
// will fail on some commands so they would need to be added here:
if (func != funcScopeFixedEdgeFreq && func != funcSpeech)
queue->addUnique(priorityImmediate,func);
}
prepDataAndSend(payload);
}
else
{
qInfo() << "cachingQueue(): unimplemented command" << funcString[func];
qDebug(logRig()) << "cachingQueue(): unimplemented command" << funcString[func];
}
}

Wyświetl plik

@ -153,8 +153,8 @@ public slots:
void getDuplexMode();
void setQuickSplit(bool qsOn);
void getTransmitFrequency();
void setTone(rptrTone_t t);
void setTSQL(rptrTone_t t);
void setTone(toneInfo t);
void setTSQL(toneInfo t);
void setTone(quint16 t);
void setTSQL(quint16 t);
void getTSQL();
@ -315,7 +315,6 @@ signals:
void havespectrumMode_t(spectrumMode_t spectmode);
void haveScopeEdge(char edge);
void haveSpectrumRefLevel(int level);
void haveScopeOutOfRange(bool outOfRange);
// Rig ID:
void haveRigID(rigCapabilities rigCaps);
@ -485,20 +484,19 @@ private:
QByteArray rigData;
QByteArray spectrumLine;
double spectrumStartFreq;
double spectrumEndFreq;
//double spectrumStartFreq;
//double spectrumEndFreq;
struct rigCapabilities rigCaps;
rigstate state;
bool haveRigCaps=false;
model_kind model;
quint8 model = 0; // Was model_kind but that makes no sense when users can create their own rigs!
quint8 spectSeqMax;
quint16 spectAmpMax;
quint16 spectLenMax;
spectrumMode_t oldScopeMode;
bool wasOutOfRange = false;
bool usingNativeLAN; // indicates using OEM LAN connection (705,7610,9700,7850)
bool lookingForRig;

Wyświetl plik

@ -14,13 +14,27 @@ rigCreator::rigCreator(QWidget *parent) :
commandsList = new tableCombobox(createModel(commandsModel, funcString),true,ui->commands);
ui->commands->setItemDelegateForColumn(0, commandsList);
ui->commands->setColumnWidth(0,145);
ui->commands->setColumnWidth(1,125);
ui->commands->setColumnWidth(0,120);
ui->commands->setColumnWidth(1,115);
ui->commands->setColumnWidth(2,50);
ui->commands->setColumnWidth(3,50);
ui->commands->setColumnWidth(4,25);
connect(ui->commands,SIGNAL(rowAdded(int)),this,SLOT(commandRowAdded(int)));
}
void rigCreator::commandRowAdded(int row)
{
if (ui->commands->item(row,4) == NULL) {
// Add checkbox
QTableWidgetItem * item = new QTableWidgetItem();
item->setFlags(Qt::ItemFlag::ItemIsEnabled | Qt::ItemFlag::ItemIsUserCheckable);
item->setCheckState(Qt::Unchecked);
ui->commands->setItem(row,4,item);
}
}
rigCreator::~rigCreator()
{
qInfo() << "Deleting instance of rigCreator()";
@ -77,6 +91,8 @@ void rigCreator::on_loadFile_clicked(bool clicked)
void rigCreator::loadRigFile(QString file)
{
ui->loadFile->setEnabled(false);
ui->defaultRigs->setEnabled(false);
this->currentFile = file;
QSettings* settings = new QSettings(file, QSettings::Format::IniFormat);
@ -127,6 +143,16 @@ void rigCreator::loadRigFile(QString file)
{
settings->setArrayIndex(c);
ui->commands->insertRow(ui->commands->rowCount());
// Add checkbox for row 4 (command 39)
QTableWidgetItem * item = new QTableWidgetItem();
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
if (settings->value("Command39",false).toBool())
item->setCheckState(Qt::Checked);
else
item->setCheckState(Qt::Unchecked);
ui->commands->setItem(c,4,item);
ui->commands->model()->setData(ui->commands->model()->index(c,0),settings->value("Type", "").toString());
ui->commands->model()->setData(ui->commands->model()->index(c,1),settings->value("String", "").toString());
ui->commands->model()->setData(ui->commands->model()->index(c,2),QString::number(settings->value("Min", 0).toInt(),16));

Wyświetl plik

@ -32,12 +32,16 @@ private slots:
void on_defaultRigs_clicked(bool clicked);
void loadRigFile(QString filename);
void saveRigFile(QString filename);
void commandRowAdded(int row);
private:
Ui::rigCreator *ui;
QMenu* context;
tableCombobox* commandsList;
tableCheckbox* command39;
QStandardItemModel* commandsModel;
QStandardItemModel* command36Model;
QStandardItemModel* createModel(QStandardItemModel* model, QString strings[]);
QString currentFile;

Wyświetl plik

@ -161,7 +161,7 @@
<property name="geometry">
<rect>
<x>830</x>
<y>200</y>
<y>230</y>
<width>141</width>
<height>131</height>
</rect>
@ -632,7 +632,7 @@
<number>0</number>
</property>
<property name="columnCount">
<number>4</number>
<number>5</number>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
@ -672,6 +672,11 @@
<string>Max</string>
</property>
</column>
<column>
<property name="text">
<string>29</string>
</property>
</column>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_9">
@ -680,7 +685,7 @@
<x>830</x>
<y>50</y>
<width>141</width>
<height>151</height>
<height>181</height>
</rect>
</property>
<property name="title">
@ -764,6 +769,19 @@
<string>HasFDComms</string>
</property>
</widget>
<widget class="QCheckBox" name="hasCommand29">
<property name="geometry">
<rect>
<x>10</x>
<y>150</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Has Command 29</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_17">
<property name="geometry">
@ -974,9 +992,9 @@
<property name="geometry">
<rect>
<x>770</x>
<y>330</y>
<y>360</y>
<width>191</width>
<height>211</height>
<height>181</height>
</rect>
</property>
<property name="title">
@ -988,7 +1006,7 @@
<x>0</x>
<y>30</y>
<width>191</width>
<height>181</height>
<height>151</height>
</rect>
</property>
<property name="sizePolicy">

Plik diff jest za duży Load Diff

151
rigctld.h
Wyświetl plik

@ -13,6 +13,7 @@
#include <QTcpSocket>
#include <QSet>
#include <QDataStream>
#include <QHash>
#include <map>
#include <vector>
@ -61,105 +62,50 @@
#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 */
struct commandStruct
{
uchar sstr;
const char *str;
funcs func;
char type;
int flags;
const char* arg1;
const char* arg2;
const char* arg3;
const char* arg4;
const char* arg5;
const char* arg6;
};
/*!< 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) */
struct subCommandStruct
{
const char *str;
funcs func;
char type;
};
enum rig_errcode_e {
RIG_OK=0, /*!< No error, operation completed successfully */
RIG_EINVAL, /*!< invalid parameter */
RIG_ECONF, /*!< invalid configuration (serial,..) */
RIG_ENOMEM, /*!< memory shortage */
RIG_ENIMPL, /*!< function not implemented, but will be */
RIG_ETIMEOUT, /*!< communication timed out */
RIG_EIO, /*!< IO error, including open failed */
RIG_EINTERNAL, /*!< Internal Hamlib error, huh! */
RIG_EPROTO, /*!< Protocol error */
RIG_ERJCTED, /*!< Command rejected by the rig */
RIG_ETRUNC, /*!< Command performed, but arg truncated */
RIG_ENAVAIL, /*!< function not available */
RIG_ENTARGET, /*!< VFO not targetable */
RIG_BUSERROR, /*!< Error talking on the bus */
RIG_BUSBUSY, /*!< Collision on the bus */
RIG_EARG, /*!< NULL RIG handle or any invalid pointer parameter in get arg */
RIG_EVFO, /*!< Invalid VFO */
RIG_EDOM /*!< Argument out of domain of func */
};
#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 */
#if 0
@ -366,7 +312,6 @@ signals:
void setAntiVoxGain(quint8);
void setSpectrumRefLevel(int);
public slots:
virtual void incomingConnection(qintptr socketDescriptor);
void receiveRigCaps(rigCapabilities caps);
@ -375,6 +320,7 @@ public slots:
private:
rigstate* rigState = Q_NULLPTR;
};
@ -408,8 +354,8 @@ private:
unsigned long crcTable[256];
unsigned long doCrc(unsigned char* p, size_t n);
void genCrc(unsigned long crcTable[]);
QString getMode(quint8 mode, bool datamode);
quint8 getMode(QString modeString);
QString getMode(modeInfo mode);
bool getMode(QString modeString, modeInfo& mode);
QString getFilter(quint8 mode, quint8 filter);
quint8 getAntennas();
quint64 getRadioModes(QString mode = "");
@ -417,7 +363,10 @@ private:
quint8 antFromName(QString name);
quint8 vfoFromName(QString vfo);
QString getVfoName(quint8 vfo);
int getCommand(QStringList& respone, bool extended, const commandStruct cmd, QStringList params );
int getSubCommand(QStringList& response, bool extended, const commandStruct cmd, const subCommandStruct sub[], QStringList params);
int dumpState(QStringList &response, bool extended);
int dumpCaps(QStringList &response, bool extended);
int getCalibratedValue(quint8 meter,cal_table_t cal);
};

Wyświetl plik

@ -162,7 +162,7 @@ struct genericType {
model_kind determineRadioModel(unsigned char rigID);
struct rigCapabilities {
model_kind model;
quint8 model;
quint8 civ;
quint8 modelID = 0;
QString filename;
@ -220,7 +220,7 @@ struct rigCapabilities {
std::vector <filterType> filters;
std::vector <centerSpanData> scopeCenterSpans;
std::vector <bandType> bands;
std::vector <spanType> spans;
//std::vector <spanType> spans;
std::vector <stepType> steps;
unsigned char bsr[24] = {0};

Wyświetl plik

@ -804,7 +804,7 @@ void usbController::receivePTTStatus(bool on) {
for (auto devIt = devices->begin(); devIt != devices->end(); devIt++)
{
auto dev = &devIt.value();
if (dev->lcd != cmdLCDSpectrum && dev->lcd != cmdLCDWaterfall) {
if (dev->lcd != funcLCDSpectrum && dev->lcd != funcLCDWaterfall) {
if (on && !ptt) {
lastColour = currentColour;
QColor newColor = QColor(255,0,0);
@ -1079,7 +1079,7 @@ void usbController::sendRequest(USBDEVICE *dev, usbFeatureType feature, int val,
}
if (text != "**REMOVE**") {
dev->knobValues[val].lastChanged = QDateTime::currentMSecsSinceEpoch();
if (dev->lcd != cmdLCDSpectrum && dev->lcd != cmdLCDWaterfall)
if (dev->lcd != funcLCDSpectrum && dev->lcd != funcLCDWaterfall)
QTimer::singleShot(2000, this, [=]() { sendRequest(dev,usbFeatureType::featureGraph,val,"**REMOVE**",Q_NULLPTR,&dev->color); });
}
@ -1585,38 +1585,38 @@ void usbController::loadCommands()
int num = 0;
// Important commands at the top!
commands.append(COMMAND(num++, "None", commandAny, cmdNone, (quint8)0x0));
commands.append(COMMAND(num++, "PTT On", commandButton, funcTransceiverStatus, funcTransceiverStatus, (quint8)0x1));
commands.append(COMMAND(num++, "PTT Off", commandButton, funcTransceiverStatus, funcTransceiverStatus, (quint8)0x0));
commands.append(COMMAND(num++, "VFOA", commandKnob, funcFreqSet, funcFreqSet, (quint8)0x0));
commands.append(COMMAND(num++, "VFOB", commandKnob, funcFreqSet, funcFreqSet, (quint8)0x1));
commands.append(COMMAND(num++, "Freq Down", commandButton, funcFreqSet, funcFreqSet, (int)-1));
commands.append(COMMAND(num++, "Freq Up", commandButton, funcFreqSet, funcFreqSet, (int)1));
commands.append(COMMAND(num++, "PTT Off", commandButton, funcTransceiverStatus, funcTransceiverStatus, (quint8)0x0));
commands.append(COMMAND(num++, "PTT Toggle", commandButton, funcTransceiverStatus, funcTransceiverStatus, (quint8)0x0));
commands.append(COMMAND(num++, "PTT On", commandButton, funcTransceiverStatus, (quint8)0x1));
commands.append(COMMAND(num++, "PTT Off", commandButton, funcTransceiverStatus, (quint8)0x0));
commands.append(COMMAND(num++, "VFOA", commandKnob, funcSelectedFreq, (quint8)0x0));
commands.append(COMMAND(num++, "VFOB", commandKnob, funcUnselectedFreq, (quint8)0x1));
commands.append(COMMAND(num++, "Freq Down", commandButton, funcSelectedFreq,(int)-1));
commands.append(COMMAND(num++, "Freq Up", commandButton, funcSelectedFreq, (int)1));
commands.append(COMMAND(num++, "PTT Off", commandButton, funcTransceiverStatus, (quint8)0x0));
commands.append(COMMAND(num++, "PTT Toggle", commandButton, funcTransceiverStatus, (quint8)0x0));
commands.append(COMMAND(num++, "Span/Step", commandKnob, funcSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "Tune", commandButton, funcTunerStatus, (quint8)0x0));
commands.append(COMMAND(num++, "Span/Step", commandButton, funcSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "Step+", commandButton, funcTuningStep, 100));
commands.append(COMMAND(num++, "Step-", commandButton, funcTuningStep, -100));
commands.append(COMMAND(num++, "Span+", commandButton, funcScopeCenterSpan, 100));
commands.append(COMMAND(num++, "Span-", commandButton, funcScopeCenterSpan, -100));
commands.append(COMMAND(num++, "Span+", commandButton, funcScopeMainSpan, 100));
commands.append(COMMAND(num++, "Span-", commandButton, funcScopeMainSpan, -100));
commands.append(COMMAND(num++, "Modes", commandButton, funcSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "Mode+", commandButton, funcModeSet, 100));
commands.append(COMMAND(num++, "Mode-", commandButton, funcModeSet, -100));
commands.append(COMMAND(num++, "Mode LSB", commandButton, funcModeSet, modeLSB));
commands.append(COMMAND(num++, "Mode USB", commandButton, funcModeSet, modeUSB));
commands.append(COMMAND(num++, "Mode LSBD", commandButton, funcModeSet, modeLSB_D));
commands.append(COMMAND(num++, "Mode USBD", commandButton, funcModeSet, modeUSB_D));
commands.append(COMMAND(num++, "Mode CW", commandButton, funcModeSet, modeCW));
commands.append(COMMAND(num++, "Mode CWR", commandButton, funcModeSet, modeCW_R));
commands.append(COMMAND(num++, "Mode FM", commandButton, funcModeSet, modeFM));
commands.append(COMMAND(num++, "Mode AM", commandButton, funcModeSet, modeAM));
commands.append(COMMAND(num++, "Mode RTTY", commandButton, funcModeSet, modeRTTY));
commands.append(COMMAND(num++, "Mode RTTYR", commandButton, funcModeSet, modeRTTY_R));
commands.append(COMMAND(num++, "Mode PSK", commandButton, funcModeSet, modePSK));
commands.append(COMMAND(num++, "Mode PSKR", commandButton, funcModeSet, modePSK_R));
commands.append(COMMAND(num++, "Mode DV", commandButton, funcModeSet, modeDV));
commands.append(COMMAND(num++, "Mode DD", commandButton, funcModeSet, modeDD));
commands.append(COMMAND(num++, "Mode+", commandButton, funcSelectedMode, 100));
commands.append(COMMAND(num++, "Mode-", commandButton, funcSelectedMode, -100));
commands.append(COMMAND(num++, "Mode LSB", commandButton, funcSelectedMode, modeLSB));
commands.append(COMMAND(num++, "Mode USB", commandButton, funcSelectedMode, modeUSB));
commands.append(COMMAND(num++, "Mode LSBD", commandButton, funcSelectedMode, modeLSB_D));
commands.append(COMMAND(num++, "Mode USBD", commandButton, funcSelectedMode, modeUSB_D));
commands.append(COMMAND(num++, "Mode CW", commandButton, funcSelectedMode, modeCW));
commands.append(COMMAND(num++, "Mode CWR", commandButton, funcSelectedMode, modeCW_R));
commands.append(COMMAND(num++, "Mode FM", commandButton, funcSelectedMode, modeFM));
commands.append(COMMAND(num++, "Mode AM", commandButton, funcSelectedMode, modeAM));
commands.append(COMMAND(num++, "Mode RTTY", commandButton, funcSelectedMode, modeRTTY));
commands.append(COMMAND(num++, "Mode RTTYR", commandButton, funcSelectedMode, modeRTTY_R));
commands.append(COMMAND(num++, "Mode PSK", commandButton, funcSelectedMode, modePSK));
commands.append(COMMAND(num++, "Mode PSKR", commandButton, funcSelectedMode, modePSK_R));
commands.append(COMMAND(num++, "Mode DV", commandButton, funcSelectedMode, modeDV));
commands.append(COMMAND(num++, "Mode DD", commandButton, funcSelectedMode, modeDD));
commands.append(COMMAND(num++, "Bands", commandButton, funcSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "Band+", commandButton, funcBandStackReg, 100));
commands.append(COMMAND(num++, "Band-", commandButton, funcBandStackReg, -100));
@ -1641,19 +1641,19 @@ void usbController::loadCommands()
commands.append(COMMAND(num++, "Band 2200m", commandButton, funcBandStackReg, band2200m));
commands.append(COMMAND(num++, "Band GEN", commandButton, funcBandStackReg, bandGen));
commands.append(COMMAND(num++, "NB/NR", commandButton, funcSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "NR On", commandButton, funcNoiseReduction, cmdGetNR, (quint8)0x01));
commands.append(COMMAND(num++, "NR Off", commandButton, funcNoiseReduction, cmdGetNR, (quint8)0x0));
commands.append(COMMAND(num++, "NB On", commandButton, funcNoiseBlanker, cmdGetNB, (quint8)0x01));
commands.append(COMMAND(num++, "NB Off", commandButton, funcNoiseBlanker, cmdGetNB, (quint8)0x0));
commands.append(COMMAND(num++, "Moni On", commandButton, funcMonitor, cmdGetMonitor, (quint8)0x01));
commands.append(COMMAND(num++, "Moni Off", commandButton, funcMonitor, cmdGetMonitor, (quint8)0x0));
commands.append(COMMAND(num++, "Comp On", commandButton, funcCompressor, cmdGetComp, (quint8)0x01));
commands.append(COMMAND(num++, "Comp Off", commandButton, funcCompressor, cmdGetComp, (quint8)0x0));
commands.append(COMMAND(num++, "Vox On", commandButton, funcVox, cmdGetVox, (quint8)0x01));
commands.append(COMMAND(num++, "Vox Off", commandButton, funcVox, cmdGetVox, (quint8)0x0));
commands.append(COMMAND(num++, "NR On", commandButton, funcNoiseReduction, (quint8)0x01));
commands.append(COMMAND(num++, "NR Off", commandButton, funcNoiseReduction, (quint8)0x0));
commands.append(COMMAND(num++, "NB On", commandButton, funcNoiseBlanker, (quint8)0x01));
commands.append(COMMAND(num++, "NB Off", commandButton, funcNoiseBlanker, (quint8)0x0));
commands.append(COMMAND(num++, "Moni On", commandButton, funcMonitor, (quint8)0x01));
commands.append(COMMAND(num++, "Moni Off", commandButton, funcMonitor, (quint8)0x0));
commands.append(COMMAND(num++, "Comp On", commandButton, funcCompressor, (quint8)0x01));
commands.append(COMMAND(num++, "Comp Off", commandButton, funcCompressor, (quint8)0x0));
commands.append(COMMAND(num++, "Vox On", commandButton, funcVox, (quint8)0x01));
commands.append(COMMAND(num++, "Vox Off", commandButton, funcVox, (quint8)0x0));
commands.append(COMMAND(num++, "Split", commandButton, funcSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "Split On", commandButton, funcQuickSplit, cmdGetDuplexMode, (quint8)0x01));
commands.append(COMMAND(num++, "Split Off", commandButton, funcQuickSplit, cmdGetDuplexMode, (quint8)0x0));
commands.append(COMMAND(num++, "Split On", commandButton, funcQuickSplit, (quint8)0x01));
commands.append(COMMAND(num++, "Split Off", commandButton, funcQuickSplit, (quint8)0x0));
commands.append(COMMAND(num++, "Swap VFO AB", commandButton, funcVFOSwapAB, (quint8)0x0));
commands.append(COMMAND(num++, "Swap VFO MS", commandButton, funcVFOSwapMS, (quint8)0x0));
commands.append(COMMAND(num++, "Scope", commandButton, funcSeparator, (quint8)0x0));
@ -1664,26 +1664,26 @@ void usbController::loadCommands()
commands.append(COMMAND(num++, "Page Down", commandButton, funcPageDown, (quint8)0x0));
commands.append(COMMAND(num++, "Page Up", commandButton, funcPageUp, (quint8)0x0));
commands.append(COMMAND(num++, "AF Gain", commandKnob, funcAfGain, funcAfGain, (quint8)0xff));
commands.append(COMMAND(num++, "RF Gain", commandKnob, funcRfGain, funcRfGain, (quint8)0xff));
commands.append(COMMAND(num++, "TX Power", commandKnob, funcRFPower, funcRFPower, (quint8)0xff));
commands.append(COMMAND(num++, "Mic Gain", commandKnob, funcMicGain, funcMicGain, (quint8)0xff));
commands.append(COMMAND(num++, "Mod Level", commandKnob, funcDATAOffMod, funcDATAOffMod, (quint8)0xff));
commands.append(COMMAND(num++, "Data Mod", commandKnob, funcDATAOffMod, funcDATAOffMod, (quint8)0xff));
commands.append(COMMAND(num++, "Squelch", commandKnob, funcSquelch, funcSquelch, (quint8)0xff));
commands.append(COMMAND(num++, "Monitor", commandKnob, funcMonitorGain, funcMonitorGain, (quint8)0xff));
commands.append(COMMAND(num++, "Compressor", commandKnob, funcCompressorLevel, funcCompressorLevel, (quint8)0xff));
commands.append(COMMAND(num++, "Vox Level", commandKnob, funcVoxGain, funcVoxGain, (quint8)0xff));
commands.append(COMMAND(num++, "Anti-Vox", commandKnob, funcAntiVoxGain, funcAntiVoxGain, (quint8)0xff));
commands.append(COMMAND(num++, "NB Level", commandKnob, funcNBLevel, funcNBLevel, (quint8)0xff));
commands.append(COMMAND(num++, "NR Level", commandKnob, funcNRLevel, funcNRLevel, (quint8)0xff));
commands.append(COMMAND(num++, "AF Gain", commandKnob, funcAfGain, (quint8)0xff));
commands.append(COMMAND(num++, "RF Gain", commandKnob, funcRfGain, (quint8)0xff));
commands.append(COMMAND(num++, "TX Power", commandKnob, funcRFPower, (quint8)0xff));
commands.append(COMMAND(num++, "Mic Gain", commandKnob, funcMicGain, (quint8)0xff));
commands.append(COMMAND(num++, "Mod Level", commandKnob, funcDATAOffMod, (quint8)0xff));
commands.append(COMMAND(num++, "Data Mod", commandKnob, funcDATAOffMod, (quint8)0xff));
commands.append(COMMAND(num++, "Squelch", commandKnob, funcSquelch, (quint8)0xff));
commands.append(COMMAND(num++, "Monitor", commandKnob, funcMonitorGain, (quint8)0xff));
commands.append(COMMAND(num++, "Compressor", commandKnob, funcCompressorLevel, (quint8)0xff));
commands.append(COMMAND(num++, "Vox Level", commandKnob, funcVoxGain, (quint8)0xff));
commands.append(COMMAND(num++, "Anti-Vox", commandKnob, funcAntiVoxGain, (quint8)0xff));
commands.append(COMMAND(num++, "NB Level", commandKnob, funcNBLevel, (quint8)0xff));
commands.append(COMMAND(num++, "NR Level", commandKnob, funcNRLevel, (quint8)0xff));
commands.append(COMMAND(num++, "Span/Step", commandKnob, cmdSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "IF Shift", commandKnob, funcIFShift, funcIFShift, (quint8)0xff));
commands.append(COMMAND(num++, "In PBT", commandKnob, funcPBTInner, funcPBTInner, (quint8)0xff));
commands.append(COMMAND(num++, "Out PBT", commandKnob, funcPBTOuter, funcPBTOuter, (quint8)0xff));
commands.append(COMMAND(num++, "IF Shift", commandKnob, funcIFShift, (quint8)0xff));
commands.append(COMMAND(num++, "In PBT", commandKnob, funcPBTInner, (quint8)0xff));
commands.append(COMMAND(num++, "Out PBT", commandKnob, funcPBTOuter, (quint8)0xff));
commands.append(COMMAND(num++, "Span/Step", commandKnob, cmdSeparator, (quint8)0x0));
commands.append(COMMAND(num++, "CW Pitch", commandKnob, funcCwPitch, funcCwPitch, (quint8)0xff));
commands.append(COMMAND(num++, "CW Speed", commandKnob, funcKeySpeed, funcKeySpeed, (quint8)0xff));
commands.append(COMMAND(num++, "CW Pitch", commandKnob, funcCwPitch, (quint8)0xff));
commands.append(COMMAND(num++, "CW Speed", commandKnob, funcKeySpeed, (quint8)0xff));
}
@ -1831,7 +1831,7 @@ void usbController::receiveLevel(cmds cmd, unsigned char level)
auto dev = &devIt.value();
auto kb = std::find_if(knobList->begin(), knobList->end(), [dev, cmd](const KNOB& k)
{ return (k.command && dev->connected && k.path == dev->path && k.page == dev->currentPage && k.command->getCommand == cmd);});
{ return (k.command && dev->connected && k.path == dev->path && k.page == dev->currentPage && k.command->command == cmd);});
if (kb != knobList->end() && kb->num < dev->knobValues.size()) {
// qInfo(logUsbControl()) << "Received value:" << level << "for knob" << kb->num;
// Set both current and previous knobvalue to the received value
@ -1839,7 +1839,7 @@ void usbController::receiveLevel(cmds cmd, unsigned char level)
dev->knobValues[kb->num].previous = level/dev->sensitivity;
}
auto bt = std::find_if(buttonList->begin(), buttonList->end(), [dev, cmd](const BUTTON& b)
{ return (b.onCommand && dev->connected && b.path == dev->path && b.page == dev->currentPage && b.onCommand->getCommand == cmd && b.led != 0 && b.led <= dev->type.leds);});
{ return (b.onCommand && dev->connected && b.path == dev->path && b.page == dev->currentPage && b.onCommand->command == cmd && b.led != 0 && b.led <= dev->type.leds);});
if (bt != buttonList->end()) {
// qInfo(logUsbControl()) << "Received value:" << level << "for led" << bt->led;
QTimer::singleShot(0, this, [=]() { sendRequest(dev,usbFeatureType::featureLEDControl,bt->led,QString("%1").arg(level)); });

Wyświetl plik

@ -144,8 +144,6 @@ struct COMMAND {
index(index), text(text), cmdType(cmdType), command(command), value(value) {}
COMMAND(int index, QString text, usbCommandType cmdType, int command, unsigned char suffix) :
index(index), text(text), cmdType(cmdType), command(command), suffix(suffix) {}
COMMAND(int index, QString text, usbCommandType cmdType, int command, int getCommand, unsigned char suffix) :
index(index), text(text), cmdType(cmdType), command(command), getCommand(getCommand), suffix(suffix) {}
COMMAND(int index, QString text, usbCommandType cmdType, int command, availableBands band) :
index(index), text(text), cmdType(cmdType), command(command), band(band) {}
COMMAND(int index, QString text, usbCommandType cmdType, int command, rigMode_t mode) :
@ -155,7 +153,6 @@ struct COMMAND {
QString text;
usbCommandType cmdType = commandButton;
int command=funcNone;
int getCommand=funcNone;
unsigned char suffix=0x0;
int value=0;
availableBands band=bandGen;

Wyświetl plik

@ -64,7 +64,6 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode
qRegisterMetaType<spectrumMode_t>();
qRegisterMetaType<freqt>();
qRegisterMetaType<vfo_t>();
qRegisterMetaType<rptrTone_t>();
qRegisterMetaType<modeInfo>();
qRegisterMetaType<rigMode_t>();
qRegisterMetaType<audioPacket>();
@ -467,14 +466,6 @@ void wfmain::rigConnections()
//connect(this, SIGNAL(setCWBreakMode(unsigned char)), rig, SLOT(setBreakIn(unsigned char)));
//connect(this, SIGNAL(getCWBreakMode()), rig, SLOT(getBreakIn()));
connect(this->rig, &rigCommander::haveKeySpeed,
[=](const unsigned char& wpm) { cw->handleKeySpeed(wpm); });
connect(this->rig, &rigCommander::haveDashRatio,
[=](const unsigned char& ratio) { cw->handleDashRatio(ratio); });
connect(this->rig, &rigCommander::haveCwPitch,
[=](const unsigned char& speed) { cw->handlePitch(speed); });
connect(this->rig, &rigCommander::haveCWBreakMode,
[=](const unsigned char &bm) { cw->handleBreakInMode(bm);});
//connect(rig, SIGNAL(haveBandStackReg(freqt,char,char,bool)), this, SLOT(receiveBandStackReg(freqt,char,char,bool)));
//connect(this, SIGNAL(setRitEnable(bool)), rig, SLOT(setRitEnable(bool)));
@ -505,9 +496,9 @@ void wfmain::rigConnections()
//connect(rig, SIGNAL(haveMonitor(bool)), this, SLOT(receiveMonitor(bool)));
// Repeater, duplex, and split:
connect(rpt, SIGNAL(getDuplexMode()), rig, SLOT(getDuplexMode()));
connect(rpt, SIGNAL(setDuplexMode(duplexMode_t)), rig, SLOT(setDuplexMode(duplexMode_t)));
connect(rig, SIGNAL(haveDuplexMode(duplexMode_t)), rpt, SLOT(receiveDuplexMode(duplexMode_t)));
//connect(rpt, SIGNAL(getDuplexMode()), rig, SLOT(getDuplexMode()));
//connect(rpt, SIGNAL(setDuplexMode(duplexMode_t)), rig, SLOT(setDuplexMode(duplexMode_t)));
//connect(rig, SIGNAL(haveDuplexMode(duplexMode_t)), rpt, SLOT(receiveDuplexMode(duplexMode_t)));
//connect(this, SIGNAL(getRptDuplexOffset()), rig, SLOT(getRptDuplexOffset()));
connect(rig, SIGNAL(haveRptOffsetFrequency(freqt)), rpt, SLOT(handleRptOffsetFrequency(freqt)));
@ -520,16 +511,24 @@ void wfmain::rigConnections()
//connect(this, SIGNAL(clearMemory(quint32)), rig, SLOT(clearMemory(quint32)));
//connect(this, SIGNAL(recallMemory(quint32)), rig, SLOT(recallMemory(quint32)));
// These are the current tone frequency or DCS code selected:
connect(rpt, SIGNAL(getTone()), rig, SLOT(getTone()));
connect(rpt, SIGNAL(getTSQL()), rig, SLOT(getTSQL()));
connect(rpt, SIGNAL(getDTCS()), rig, SLOT(getDTCS()));
connect(this->rpt, &repeaterSetup::setDuplexMode, this->rig,
[=](const duplexMode_t &t) { queue->add(priorityImmediate,queueItem(funcSplitStatus,QVariant::fromValue<duplexMode_t>(t),false));});
connect(this->rpt, &repeaterSetup::setTone, this->rig,
[=](const rptrTone_t &t) { queue->add(priorityImmediate,queueItem(funcToneFreq,QVariant::fromValue<rptrTone_t>(t),false));});
connect(this->rpt, &repeaterSetup::getTone, this->rig,
[=]() { queue->add(priorityImmediate,funcRepeaterTone);});
connect(this->rpt, &repeaterSetup::setTSQL, this->rig,
[=](const rptrTone_t &t) { queue->add(priorityImmediate,queueItem(funcTSQLFreq,QVariant::fromValue<rptrTone_t>(t),false));});
[=](const toneInfo& t) { queue->add(priorityImmediate,queueItem(funcTSQLFreq,QVariant::fromValue<toneInfo>(t),false));});
connect(this->rpt, &repeaterSetup::getTSQL, this->rig,
[=]() { queue->add(priorityImmediate,funcRepeaterTSQL);});
connect(this->rpt, &repeaterSetup::setDTCS, this->rig,
[=](const toneInfo& t) { queue->add(priorityImmediate,queueItem(funcRepeaterDTCS,QVariant::fromValue<toneInfo>(t),false));});
connect(this->rpt, &repeaterSetup::getDTCS, this->rig,
[=]() { queue->add(priorityImmediate,funcRepeaterDTCS);});
connect(this->rpt, &repeaterSetup::getRptAccessMode, this->rig,
[=]() {
@ -551,12 +550,6 @@ void wfmain::rigConnections()
queue->add(priorityImmediate,queueItem(funcToneSquelchType,QVariant::fromValue<rptrAccessData>(rd),false));
});
connect(rig, SIGNAL(haveTone(quint16)), rpt, SLOT(handleTone(quint16)));
connect(rig, SIGNAL(haveTSQL(quint16)), rpt, SLOT(handleTSQL(quint16)));
connect(rig, SIGNAL(haveDTCS(quint16,bool,bool)), rpt, SLOT(handleDTCS(quint16,bool,bool)));
connect(rig, SIGNAL(haveRptAccessMode(rptAccessTxRx_t)), rpt, SLOT(handleRptAccessMode(rptAccessTxRx_t)));
connect(this->rig, &rigCommander::haveDuplexMode, this->rpt,
[=](const duplexMode_t &dm) {
if(dm==dmSplitOn)
@ -565,23 +558,27 @@ void wfmain::rigConnections()
this->splitModeEnabled = false;
});
//connect(this, SIGNAL(getToneEnabled()), rig, SLOT(getToneEnabled()));
//connect(this, SIGNAL(getTSQLEnabled()), rig, SLOT(getToneSqlEnabled()));
connect(this->rpt, &repeaterSetup::setTransmitFrequency, this->rig,
[=](const freqt &transmitFreq) { queue->add(priorityImmediate,queueItem(funcFreqSet,QVariant::fromValue<freqt>(transmitFreq),false));});
connect(this->rpt, &repeaterSetup::setTransmitMode, this->rig,
[=](const modeInfo &transmitMode) { queue->add(priorityImmediate,queueItem(funcModeSet,QVariant::fromValue<modeInfo>(transmitMode),false));});
connect(this->rpt, &repeaterSetup::selectVFO, this->rig,
[=](const vfo_t &v) { queue->add(priorityImmediate,queueItem(funcSelectVFO,QVariant::fromValue<vfo_t>(v),false));});
connect(this->rpt, &repeaterSetup::equalizeVFOsAB, this->rig,
[=]() { queue->add(priorityImmediate,funcVFOEqualAB);});
connect(this->rpt, &repeaterSetup::equalizeVFOsMS, this->rig,
[=]() { queue->add(priorityImmediate,funcVFOEqualMS);});
connect(this->rpt, &repeaterSetup::swapVFOs, this->rig,
[=]() { queue->add(priorityImmediate,funcVFOSwapMS);});
connect(this->rpt, &repeaterSetup::setRptDuplexOffset, this->rig,
[=](const freqt &fOffset) { queue->add(priorityImmediate,queueItem(funcSendFreqOffset,QVariant::fromValue<freqt>(fOffset),false));});
connect(this->rpt, &repeaterSetup::getRptDuplexOffset, this->rig,
[=]() { queue->add(priorityImmediate,funcReadFreqOffset);});
@ -596,7 +593,6 @@ void wfmain::rigConnections()
connect(rig, SIGNAL(haveSpectrumData(QByteArray, double, double)), this, SLOT(receiveSpectrumData(QByteArray, double, double)));
connect(rig, SIGNAL(havespectrumMode_t(spectrumMode_t)), this, SLOT(receivespectrumMode_t(spectrumMode_t)));
connect(rig, SIGNAL(haveScopeOutOfRange(bool)), this, SLOT(handleScopeOutOfRange(bool)));
connect(this, SIGNAL(setScopeMode(spectrumMode_t)), rig, SLOT(setspectrumMode_t(spectrumMode_t)));
connect(this, SIGNAL(getScopeMode()), rig, SLOT(getScopeMode()));
@ -1011,21 +1007,21 @@ void wfmain::setupPlots()
freqIndicatorLine->setAntialiased(true);
freqIndicatorLine->setPen(QPen(Qt::blue));
/*
text = new QCPItemText(plot);
text->setAntialiased(true);
text->setColor(QColor(Qt::red));
text->setText("TEST");
text->position->setCoords(14.195, rigCaps.spectAmpMax);
text->setFont(QFont(font().family(), 12));
*/
oorIndicator = new QCPItemText(plot);
oorIndicator->setVisible(false);
oorIndicator->setAntialiased(true);
oorIndicator->setPen(QPen(Qt::red));
oorIndicator->setBrush(QBrush(Qt::red));
oorIndicator->setFont(QFont(font().family(), 14));
oorIndicator->setPositionAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
oorIndicator->position->setType(QCPItemPosition::ptAxisRectRatio); // Positioned relative to the current plot rect
oorIndicator->setText("SCOPE OUT OF RANGE");
ui->plot->addGraph(); // primary
ui->plot->addGraph(0, 0); // secondary, peaks, same axis as first.
ui->plot->addLayer( "Top Layer", ui->plot->layer("main"));
ui->plot->graph(0)->setLayer("Top Layer");
ui->waterfall->addGraph();
colorMap = new QCPColorMap(wf->xAxis, wf->yAxis);
@ -1053,6 +1049,7 @@ void wfmain::setupPlots()
pbtIndicator->topLeft->setCoords(0.5, 0);
pbtIndicator->bottomRight->setCoords(0.5, 160);
// Plot user interaction
connect(plot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handlePlotDoubleClick(QMouseEvent*)));
connect(wf, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handleWFDoubleClick(QMouseEvent*)));
@ -1135,9 +1132,9 @@ void wfmain::setupMainUI()
spans << "2.5k" << "5.0k" << "10k" << "25k";
spans << "50k" << "100k" << "250k" << "500k";
ui->scopeBWCombo->insertItems(0, spans);
//spans << "2.5k" << "5.0k" << "10k" << "25k";
//spans << "50k" << "100k" << "250k" << "500k";
//ui->scopeBWCombo->insertItems(0, spans);
edges << "1" << "2" << "3" << "4";
ui->scopeEdgeCombo->insertItems(0, edges);
@ -1257,36 +1254,6 @@ void wfmain::setupMainUI()
queue->add(priorityImmediate,queueItem(funcPBTInner,QVariant::fromValue<short>(passbandHz)));
});
connect(this->cw, &cwSender::sendCW, this, [=](const QString &cwMessage) {
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<QString>(cwMessage)));
});
connect(this->cw, &cwSender::stopCW, this, [=]() {
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<uchar>(0xff)));
});
connect(this->cw, &cwSender::setBreakInMode, this, [=](const unsigned char &bmode) {
queue->add(priorityImmediate,queueItem(funcBreakIn,QVariant::fromValue<uchar>(bmode)));
});
connect(this->cw, &cwSender::setKeySpeed, this, [=](const unsigned char& wpm) {
queue->add(priorityImmediate,queueItem(funcKeySpeed,QVariant::fromValue<ushort>(wpm)));
});
connect(this->cw, &cwSender::setDashRatio, this, [=](const unsigned char& ratio) {
queue->add(priorityImmediate,queueItem(funcDashRatio,QVariant::fromValue<uchar>(ratio)));
});
connect(this->cw, &cwSender::setPitch, this, [=](const unsigned char& pitch) {
queue->add(priorityImmediate,queueItem(funcSendCW,QVariant::fromValue<ushort>(pitch)));
});
connect(this->cw, &cwSender::getCWSettings, this, [=]() {
queue->add(priorityImmediate,funcKeySpeed);
queue->add(priorityImmediate,funcBreakIn);
queue->add(priorityImmediate,funcCwPitch);
queue->add(priorityImmediate,funcDashRatio);
});
}
void wfmain::prepareSettingsWindow()
@ -1951,7 +1918,7 @@ void wfmain::buttonControl(const COMMAND* cmd)
//Potentially add option to select specific step size?
}
break;
case funcScopeCenterSpan:
case funcScopeMainSpan:
if (cmd->value == 100) {
if (ui->scopeBWCombo->currentIndex() < ui->scopeBWCombo->count()-1)
{
@ -2004,9 +1971,9 @@ void wfmain::buttonControl(const COMMAND* cmd)
break;
}
// Make sure we get status quickly
if (cmd->getCommand != funcNone) {
queue->add(priorityHigh,(funcs)cmd->getCommand);
// Make sure we get status quickly by sending a get command
if (cmd->command != funcNone) {
queue->add(priorityHigh,(funcs)cmd->command);
}
}
@ -3441,7 +3408,7 @@ void wfmain::shortcutF12()
{
// Speak current frequency and mode from the radio
showStatusBarText("Sending speech command to radio.");
emit sayAll();
queue->add(priorityImmediate,queueItem(funcSpeech,QVariant::fromValue(uchar(0U))));
}
void wfmain::shortcutControlT()
@ -3811,17 +3778,17 @@ void wfmain:: getInitialRigState()
queue->add(priorityImmediate,queueItem(funcScopeDataOutput,QVariant::fromValue(quint8(1)),false));
queue->add(priorityImmediate,queueItem(funcScopeOnOff,QVariant::fromValue(quint8(1)),false));
}
queue->add(priorityHigh,funcFilterWidth,false);
queue->add(priorityHigh,funcScopeRef,false);
queue->add(priorityHigh,funcScopeCenterFixed,false);
queue->add(priorityHigh,funcScopeCenterSpan,false);
queue->add(priorityHigh,funcDuplexStatus,false);
}
if (rigCaps.commands.contains(funcFilterWidth))
queue->add(priorityHigh,funcFilterWidth,false);
if (rigCaps.commands.contains(funcSplitStatus))
queue->add(priorityHigh,funcSplitStatus,false);
if(rigCaps.commands.contains(funcTuningStep))
{
queue->add(priorityImmediate,funcTuningStep,false);
}
if(rigCaps.commands.contains(funcRepeaterTone))
{
@ -3830,27 +3797,19 @@ void wfmain:: getInitialRigState()
}
if(rigCaps.commands.contains(funcRepeaterDTCS))
{
queue->add(priorityImmediate,funcRepeaterDTCS,false);
}
if(rigCaps.commands.contains(funcToneSquelchType))
{
queue->add(priorityImmediate,funcToneSquelchType,false);
}
if(rigCaps.commands.contains(funcAntenna))
{
queue->add(priorityImmediate,funcAntenna,false);
}
if(rigCaps.commands.contains(funcAttenuator))
{
queue->add(priorityImmediate,funcAttenuator,false);
}
if(rigCaps.commands.contains(funcPreamp))
{
queue->add(priorityImmediate,funcPreamp,false);
}
if (rigCaps.commands.contains(funcRitStatus))
{
@ -3859,9 +3818,7 @@ void wfmain:: getInitialRigState()
}
if(rigCaps.commands.contains(funcIFShift))
{
queue->add(priorityImmediate,funcIFShift,false);
}
if(rigCaps.commands.contains(funcPBTInner) && rigCaps.commands.contains(funcPBTOuter))
{
@ -3870,9 +3827,7 @@ void wfmain:: getInitialRigState()
}
if(rigCaps.commands.contains(funcTunerStatus))
{
queue->add(priorityImmediate,funcTunerStatus,false);
}
}
@ -4218,7 +4173,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps)
ui->scopeBWCombo->setHidden(false);
for(unsigned int i=0; i < rigCaps.scopeCenterSpans.size(); i++)
{
ui->scopeBWCombo->addItem(rigCaps.scopeCenterSpans.at(i).name, (int)rigCaps.scopeCenterSpans.at(i).cstype);
ui->scopeBWCombo->addItem(rigCaps.scopeCenterSpans.at(i).name, QVariant::fromValue(rigCaps.scopeCenterSpans.at(i)));
}
plot->yAxis->setRange(QCPRange(prefs.plotFloor, prefs.plotCeiling));
colorMap->setDataRange(QCPRange(prefs.plotFloor, prefs.plotCeiling));
@ -4312,8 +4267,8 @@ void wfmain::initPeriodicCommands()
if (rigCaps.commands.contains(funcAntenna))
queue->add(priorityMediumLow,funcAntenna,true);
if (rigCaps.commands.contains(funcDuplexStatus))
queue->add(priorityMediumLow,funcDuplexStatus,true);
if (rigCaps.commands.contains(funcSplitStatus))
queue->add(priorityMediumLow,funcSplitStatus,true);
if(rigCaps.commands.contains(funcToneSquelchType))
queue->add(priorityMediumLow,funcToneSquelchType,true);
@ -4321,6 +4276,11 @@ void wfmain::initPeriodicCommands()
if (rigCaps.commands.contains(funcSMeter))
queue->add(priorityHighest,queueItem(funcSMeter,true));
if (rigCaps.hasSpectrum)
{
queue->add(priorityMediumHigh,queueItem(funcScopeMainMode,true));
queue->add(priorityMediumHigh,queueItem(funcScopeMainSpan,true));
}
}
void wfmain::receiveFreq(freqt freqStruct)
@ -4384,7 +4344,7 @@ void wfmain::changeTxBtn()
void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double endFreq)
void wfmain::receiveSpectrumData(scopeData spectrum)
{
if (ui->scopeEnableWFBtn->checkState()== Qt::PartiallyChecked)
{
@ -4401,9 +4361,9 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e
//QElapsedTimer performanceTimer;
bool updateRange = false;
if((startFreq != oldLowerFreq) || (endFreq != oldUpperFreq))
if((spectrum.startFreq != oldLowerFreq) || (spectrum.endFreq != oldUpperFreq))
{
// If the frequency changed and we were drawing peaks, now is the time to clearn them
// If the frequency changed and we were drawing peaks, now is the time to clean them
if(underlayMode == underlayPeakHold)
{
// TODO: create non-button function to do this
@ -4414,49 +4374,39 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e
preparePlasma();
}
// Inform other threads (cluster) that the frequency range has changed.
emit setFrequencyRange(startFreq, endFreq);
emit setFrequencyRange(spectrum.startFreq, spectrum.endFreq);
}
oldLowerFreq = startFreq;
oldUpperFreq = endFreq;
oldLowerFreq = spectrum.startFreq;
oldUpperFreq = spectrum.endFreq;
//qInfo(logSystem()) << "start: " << startFreq << " end: " << endFreq;
quint16 specLen = spectrum.length();
//qInfo(logSystem()) << "Spectrum data received at UI! Length: " << specLen;
//if( (specLen != 475) || (specLen!=689) )
//qInfo(logSystem()) << "start: " << spectrum.startFreq << " end: " << spectrum.endFreq;
quint16 specLen = spectrum.data.length();
if( specLen != rigCaps.spectLenMax )
{
qDebug(logSystem()) << "-------------------------------------------";
qDebug(logSystem()) << "------ Unusual spectrum received, length: " << specLen;
qDebug(logSystem()) << "------ Expected spectrum length: " << rigCaps.spectLenMax;
qDebug(logSystem()) << "------ This should happen once at most. ";
return; // safe. Using these unusual length things is a problem.
}
QVector <double> x(spectWidth), y(spectWidth), y2(spectWidth);
// TODO: Keep x around unless the frequency range changes. Should save a little time.
for(int i=0; i < spectWidth; i++)
{
x[i] = (i * (endFreq-startFreq)/spectWidth) + startFreq;
x[i] = (i * (spectrum.endFreq-spectrum.startFreq)/spectWidth) + spectrum.startFreq;
}
for(int i=0; i<specLen; i++)
{
//x[i] = (i * (endFreq-startFreq)/specLen) + startFreq;
y[i] = (unsigned char)spectrum.at(i);
y[i] = (unsigned char)spectrum.data.at(i);
if(underlayMode == underlayPeakHold)
{
if((unsigned char)spectrum.at(i) > (unsigned char)spectrumPeaks.at(i))
if((unsigned char)spectrum.data.at(i) > (unsigned char)spectrumPeaks.at(i))
{
spectrumPeaks[i] = spectrum.at(i);
spectrumPeaks[i] = spectrum.data.at(i);
}
y2[i] = (unsigned char)spectrumPeaks.at(i);
}
}
plasmaMutex.lock();
spectrumPlasma.push_front(spectrum);
spectrumPlasma.push_front(spectrum.data);
if(spectrumPlasma.size() > (int)spectrumPlasmaSize)
{
spectrumPlasma.pop_back();
@ -4475,7 +4425,7 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e
plot->graph(0)->setData(x, y, true);
#endif
if((freq.MHzDouble < endFreq) && (freq.MHzDouble > startFreq))
if((freq.MHzDouble < spectrum.endFreq) && (freq.MHzDouble > spectrum.startFreq))
{
freqIndicatorLine->start->setCoords(freq.MHzDouble, 0);
freqIndicatorLine->end->setCoords(freq.MHzDouble, rigCaps.spectAmpMax);
@ -4585,12 +4535,12 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e
if(updateRange)
plot->yAxis->setRange(prefs.plotFloor, prefs.plotCeiling);
plot->xAxis->setRange(startFreq, endFreq);
plot->xAxis->setRange(spectrum.startFreq, spectrum.endFreq);
plot->replot();
if(specLen == spectWidth)
{
wfimage.prepend(spectrum);
wfimage.prepend(spectrum.data);
wfimage.pop_back();
QByteArray wfRow;
// Waterfall:
@ -4633,8 +4583,14 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e
oldPlotFloor = plotFloor;
oldPlotCeiling = plotCeiling;
if (spectrum.oor && !oorIndicator->visible()) {
oorIndicator->setVisible(true);
oorIndicator->position->setCoords(0.5f,0.5f);
//oorIndicator->position->setCoords((oldLowerFreq+oldUpperFreq)/2,ui->topLevelSlider->value() - 20);
qInfo(logSystem()) << "Scope out of range";
} else if (!spectrum.oor && oorIndicator->visible()) {
oorIndicator->setVisible(false);
}
}
}
@ -4687,29 +4643,12 @@ void wfmain::computePlasma()
void wfmain::receivespectrumMode_t(spectrumMode_t spectMode)
{
for (int i = 0; i < ui->spectrumMode_tCombo->count(); i++)
{
if (static_cast<spectrumMode_t>(ui->spectrumMode_tCombo->itemData(i).toInt()) == spectMode)
{
ui->spectrumMode_tCombo->blockSignals(true);
ui->spectrumMode_tCombo->setCurrentIndex(i);
ui->spectrumMode_tCombo->blockSignals(false);
}
}
ui->spectrumMode_tCombo->blockSignals(true);
ui->spectrumMode_tCombo->setCurrentIndex(ui->spectrumMode_tCombo->findData(spectMode));
ui->spectrumMode_tCombo->blockSignals(false);
setUISpectrumControlsToMode(spectMode);
}
void wfmain::handleScopeOutOfRange(bool outOfRange)
{
if(outOfRange)
{
ui->scopeOutOfRangeLabel->setText("OUT OF RANGE");
ui->scopeOutOfRangeLabel->setStyleSheet("QLabel { background-color : red; color : blue; }");
} else {
ui->scopeOutOfRangeLabel->setText("");
ui->scopeOutOfRangeLabel->setStyleSheet("");
}
}
void wfmain::handlePlotDoubleClick(QMouseEvent *me)
{
@ -5171,6 +5110,8 @@ void wfmain::receiveMode(modeInfo mode)
if (!rigCaps.commands.contains(funcSelectedMode))
{
queue->add(priorityImmediate,funcDataModeWithFilter);
} else {
receiveDataModeStatus(mode.data,mode.filter);
}
return; // We have nothing more to process
@ -5350,7 +5291,7 @@ void wfmain::on_fCEbtn_clicked()
void wfmain::on_spectrumMode_tCombo_currentIndexChanged(int index)
{
spectrumMode_t smode = static_cast<spectrumMode_t>(ui->spectrumMode_tCombo->itemData(index).toInt());
emit setScopeMode(smode);
queue->add(priorityImmediate,queueItem(funcScopeMainMode,QVariant::fromValue(smode)));
setUISpectrumControlsToMode(smode);
}
@ -5384,12 +5325,12 @@ void wfmain::on_fEnterBtn_clicked()
void wfmain::on_scopeBWCombo_currentIndexChanged(int index)
{
emit setScopeSpan((char)index);
queue->add(priorityImmediate,queueItem(funcScopeMainSpan,ui->scopeBWCombo->itemData(index)));
}
void wfmain::on_scopeEdgeCombo_currentIndexChanged(int index)
{
emit setScopeEdge((char)index+1);
queue->add(priorityImmediate,queueItem(funcScopeMainEdge,QVariant::fromValue<uchar>(index+1)));
}
void wfmain::changeMode(rigMode_t mode)
@ -5835,21 +5776,15 @@ void wfmain::receiveIFShift(unsigned char level)
void wfmain::on_tuneNowBtn_clicked()
{
queue->addUnique(priorityImmediate,queueItem(funcTunerStatus,QVariant::fromValue<uchar>(2)));
queue->addUnique(priorityImmediate,queueItem(funcTunerStatus,QVariant::fromValue<uchar>(2U)));
showStatusBarText("Starting ATU tuning cycle...");
queue->addUnique(priorityImmediate,funcTunerStatus);
}
void wfmain::on_tuneEnableChk_clicked(bool checked)
{
queue->addUnique(priorityImmediate,queueItem(funcTunerStatus,QVariant::fromValue<uchar>(checked)));
if(checked)
{
showStatusBarText("Turning on ATU");
} else {
showStatusBarText("Turning off ATU");
}
showStatusBarText(QString("Turning %0 ATU").arg(checked?"on":"off"));
}
void wfmain::on_exitBtn_clicked()
@ -6100,12 +6035,11 @@ void wfmain::on_toFixedBtn_clicked()
int edge = QString(item).toInt(&numOk,10);
if(numOk)
{
emit setScopeFixedEdge(oldLowerFreq, oldUpperFreq, edge);
emit setScopeEdge(edge);
ui->scopeEdgeCombo->blockSignals(true);
ui->scopeEdgeCombo->setCurrentIndex(edge-1);
ui->scopeEdgeCombo->blockSignals(false);
queue->add(priorityImmediate,queueItem(funcScopeCenterFixed,QVariant::fromValue<uchar>(1)));
queue->add(priorityImmediate,queueItem(funcScopeFixedEdgeFreq,QVariant::fromValue(spectrumBounds(oldLowerFreq, oldUpperFreq, edge))));
queue->add(priorityImmediate,queueItem(funcScopeMainMode,QVariant::fromValue<uchar>(spectrumMode_t::spectModeFixed)));
}
}
}
@ -6798,14 +6732,12 @@ void wfmain::on_wfthemeCombo_activated(int index)
void wfmain::receivePreamp(unsigned char pre)
{
int preindex = ui->preampSelCombo->findData(pre);
ui->preampSelCombo->setCurrentIndex(preindex);
ui->preampSelCombo->setCurrentIndex(ui->preampSelCombo->findData(pre));
}
void wfmain::receiveAttenuator(unsigned char att)
{
int attindex = ui->attSelCombo->findData(att);
ui->attSelCombo->setCurrentIndex(attindex);
ui->attSelCombo->setCurrentIndex(ui->attSelCombo->findData(att));
}
void wfmain::receiveAntennaSel(unsigned char ant, bool rx)
@ -6816,6 +6748,8 @@ void wfmain::receiveAntennaSel(unsigned char ant, bool rx)
void wfmain::receiveSpectrumSpan(freqt freqspan, bool isSub)
{
if(!isSub)
{
switch((int)(freqspan.MHzDouble * 1000000.0))
@ -8372,7 +8306,8 @@ with a comma between the low and high range.",
if(ok)
{
qDebug(logGui()) << "setting edge to: " << lowFreq << ", " << highFreq << ", edge num: " << ui->scopeEdgeCombo->currentIndex() + 1;
emit setScopeFixedEdge(lowFreq, highFreq, ui->scopeEdgeCombo->currentIndex() + 1);
queue->add(priorityImmediate,queueItem(funcScopeFixedEdgeFreq,
QVariant::fromValue(spectrumBounds(lowFreq, highFreq, ui->scopeEdgeCombo->currentIndex() + 1))));
return;
}
}
@ -8989,7 +8924,7 @@ void wfmain::receiveValue(cacheItem val){
switch (val.command)
{
case funcFreqGet:
case funcfreqTR:
case funcFreqTR:
case funcSelectedFreq:
case funcUnselectedFreq:
{
@ -9023,8 +8958,7 @@ void wfmain::receiveValue(cacheItem val){
case funcReadFreqOffset:
break;
case funcSplitStatus:
break;
case funcDuplexStatus:
rpt->receiveDuplexMode(val.value.value<duplexMode_t>());
break;
case funcTuningStep:
receiveTuningStep(val.value.value<uchar>());
@ -9058,8 +8992,15 @@ void wfmain::receiveValue(cacheItem val){
case funcIFShift:
receiveIFShift(val.value.value<uchar>());
break;
/*
connect(this->rig, &rigCommander::haveDashRatio,
[=](const unsigned char& ratio) { cw->handleDashRatio(ratio); });
connect(this->rig, &rigCommander::haveCWBreakMode,
[=](const unsigned char &bm) { cw->handleBreakInMode(bm);});
*/
case funcCwPitch:
receiveCwPitch(val.value.value<uchar>());
cw->handlePitch(val.value.value<uchar>());
break;
case funcRFPower:
receiveTxPower(val.value.value<uchar>());
@ -9069,6 +9010,7 @@ void wfmain::receiveValue(cacheItem val){
break;
case funcKeySpeed:
// Only used by CW window
cw->handleKeySpeed(val.value.value<uchar>());
break;
case funcNotchFilter:
break;
@ -9140,9 +9082,12 @@ void wfmain::receiveValue(cacheItem val){
break;
case funcRepeaterTone:
break;
rpt->handleRptAccessMode(rptAccessTxRx_t((val.value.value<bool>())?ratrTONEon:ratrTONEoff));
case funcRepeaterTSQL:
rpt->handleRptAccessMode(rptAccessTxRx_t((val.value.value<bool>())?ratrTSQLon:ratrTSQLoff));
break;
case funcRepeaterDTCS:
break;
case funcRepeaterCSQL:
break;
case funcCompressor:
@ -9176,6 +9121,9 @@ void wfmain::receiveValue(cacheItem val){
break;
case funcIPPlus:
break;
case funcBreakIn:
cw->handleBreakInMode(val.value.value<uchar>());
break;
// 0x17 is CW send and 0x18 is power control (no reply)
// 0x19 it automatically added.
case funcTransceiverId:
@ -9224,14 +9172,21 @@ void wfmain::receiveValue(cacheItem val){
receiveModInput(val.value.value<rigInput>(), 3);
break;
case funcDashRatio:
cw->handleDashRatio(val.value.value<uchar>());
break;
// 0x1b register
case funcToneFreq:
rpt->handleTone(val.value.value<toneInfo>().tone);
break;
case funcTSQLFreq:
rpt->handleTSQL(val.value.value<toneInfo>().tone);
break;
case funcDTCSCode:
{
toneInfo t = val.value.value<toneInfo>();
rpt->handleDTCS(t.tone,t.rinv,t.tinv);
break;
}
case funcCSQLCode:
break;
// 0x1c register
@ -9246,10 +9201,9 @@ void wfmain::receiveValue(cacheItem val){
case funcRITFreq:
break;
// 0x27
case funcScopeWaveData:
case funcScopeMainWaveData:
{
scopeData d = val.value.value<scopeData>();
receiveSpectrumData(d.data,d.startFreq,d.endFreq);
receiveSpectrumData(val.value.value<scopeData>());
break;
}
case funcScopeOnOff:
@ -9264,29 +9218,36 @@ void wfmain::receiveValue(cacheItem val){
case funcScopeSingleDual:
// This tells us whether we are receiving single or dual scopes
break;
case funcScopeCenterFixed:
case funcScopeMainMode:
// fixed or center
// [1] 0x14
// [2] 0x00
// [3] 0x00 (center), 0x01 (fixed), 0x02, 0x03
receivespectrumMode_t(val.value.value<spectrumMode_t>());
break;
case funcScopeCenterSpan:
case funcScopeMainSpan:
{
// read span in center mode
// [1] 0x15
// [2] to [8] is spastatic_cast<bool>(payloadIn.at(2)n encoded as a frequency
//emit haveScopeSpan(parseFrequency(payloadIn, 6), static_cast<bool>(payloadIn.at(2)));
// [2] to [8] is encoded as a frequency
centerSpanData d = val.value.value<centerSpanData>();
if (ui->scopeBWCombo->currentIndex() != d.cstype)
{
ui->scopeBWCombo->blockSignals(true);
ui->scopeBWCombo->setCurrentIndex(d.cstype);
ui->scopeBWCombo->blockSignals(false);
}
break;
}
case funcScopeEdgeNumber:
case funcScopeMainEdge:
// read edge mode center in edge mode
// [1] 0x16
// [2] 0x01, 0x02, 0x03: Edge 1,2,3
break;
case funcScopeHold:
case funcScopeMainHold:
// Hold status (only 9700?)
break;
case funcScopeRef:
case funcScopeMainRef:
{
// scope reference level
// [1] 0x19
@ -9296,12 +9257,12 @@ void wfmain::receiveValue(cacheItem val){
// [5] 0x00 = +, 0x01 = -
break;
}
case funcScopeSpeed:
case funcScopeMainSpeed:
case funcScopeDuringTX:
case funcScopeCenterType:
case funcScopeVBW:
case funcScopeFixedFreq:
case funcScopeRBW:
case funcScopeMainVBW:
case funcScopeFixedEdgeFreq:
case funcScopeMainRBW:
break;
// 0x28
case funcVoiceTX:
@ -9314,10 +9275,5 @@ void wfmain::receiveValue(cacheItem val){
qWarning(logSystem()) << "Unhandled command received from rigcommander()" << funcString[val.command] << "Contact support!";
break;
}
}

Wyświetl plik

@ -150,8 +150,8 @@ signals:
void getDTCS();
void getRptAccessMode();
void setRepeaterAccessMode(rptrAccessData rd);
void setTone(rptrTone_t t);
void setTSQL(rptrTone_t t);
void setTone(toneInfo t);
void setTSQL(toneInfo t);
void getToneEnabled();
void getTSQLEnabled();
void setToneEnabled(bool enabled);
@ -351,10 +351,9 @@ private slots:
void receiveCommReady();
void receiveFreq(freqt);
void receiveMode(modeInfo mode);
void receiveSpectrumData(QByteArray spectrum, double startFreq, double endFreq);
void receiveSpectrumData(scopeData data);
void receivespectrumMode_t(spectrumMode_t spectMode);
void receiveSpectrumSpan(freqt freqspan, bool isSub);
void handleScopeOutOfRange(bool outOfRange);
void receivePTTstatus(bool pttOn);
void receiveDataModeStatus(unsigned char data, unsigned char filter);
void receiveBandStackReg(freqt f, char mode, char filter, bool dataOn); // freq, mode, (filter,) datamode
@ -861,6 +860,7 @@ private:
QCPItemLine * freqIndicatorLine;
QCPItemRect* passbandIndicator;
QCPItemRect* pbtIndicator;
QCPItemText* oorIndicator;
void setAppTheme(bool isCustom);
void prepareWf();
void prepareWf(unsigned int wfLength);

Wyświetl plik

@ -18,7 +18,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="mainTab">
<attribute name="title">
@ -117,19 +117,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="scopeOutOfRangeLabel">
<property name="minimumSize">
<size>
<width>5</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="customEdgeBtn">
<property name="toolTip">
@ -3902,7 +3889,7 @@ Please use the &quot;Radio Server&quot; page to select server audio</string>
<rect>
<x>0</x>
<y>0</y>
<width>824</width>
<width>579</width>
<height>254</height>
</rect>
</property>
@ -6009,8 +5996,8 @@ Please use the &quot;Radio Server&quot; page to select server audio</string>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="underlayButtonGroup"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="pollingButtonGroup"/>
<buttongroup name="underlayButtonGroup"/>
</buttongroups>
</ui>

Wyświetl plik

@ -75,11 +75,6 @@ enum vfo_t {
vfoSub = 0xD1
};
struct rptrTone_t {
quint16 tone = 0;
bool useSecondaryVFO = false;
};
enum duplexMode_t {
dmSplitOff=0x00,
dmSplitOn=0x01,
@ -210,14 +205,14 @@ cmdLCDWaterfall, cmdLCDSpectrum, cmdLCDNothing, cmdSeparator
// funcs and funcString MUST match exactly (and NUMFUNCS must be updated)
#define NUMFUNCS 197
#define NUMFUNCS 210
enum funcs { funcNone,
funcfreqTR, funcModeTR, funcBandEdgeFreq, funcFreqGet, funcModeGet, funcFreqSet, // \x00
funcFreqTR, funcModeTR, funcBandEdgeFreq, funcFreqGet, funcModeGet, funcFreqSet, // \x00
funcModeSet, funcVFOSwapAB, funcVFOSwapMS, funcVFOEqualAB, funcVFOEqualMS, funcVFODualWatchOff, // \x06
funcVFODualWatchOn, funcVFODualWatch, funcVFOMainSelect, funcVFOSubSelect, funcVFOASelect, funcVFOBSelect, // \x07
funcVFOBandMS, funcMemoryMode, funcMemoryWrite, funcMemoryToVFO, funcMemoryClear, funcReadFreqOffset,
funcSendFreqOffset, funcScanning, funcSplitStatus, funcDuplexStatus, funcTuningStep, funcAttenuator,
funcSendFreqOffset, funcScanning, funcSplitStatus, funcTuningStep, funcAttenuator,
funcAntenna, funcSpeech, funcAfGain, funcRfGain, funcSquelch, funcAPFLevel,
funcNRLevel, funcIFShift, funcPBTInner, funcPBTOuter, funcCwPitch, funcRFPower,
funcMicGain, funcKeySpeed, funcNotchFilter, funcCompressorLevel, funcBreakInDelay, funcNBLevel,
@ -231,22 +226,23 @@ funcDSPIFFilter, funcNotchWidth, funcSSBBandwidth, funcMainSu
funcToneSquelchType, funcIPPlus, funcSendCW, funcPowerControl, funcTransceiverId, funcFilterWidth,
funcMemoryContents, funcBandStackReg, funcMemoryKeyer, funcIFFilterWidth, funcQuickDualWatch, funcQuickSplit,
funcAutoRepeater, funcTunerStatus, funcTransverter, funcTransverterOffset, funcLockFunction, funcREFAdjust,
funcREFAdjustFine, funcACCAModLevel, funcACCBModLevel, funcUSBModLevel, funcLANModLevel, funcSPDIFModLevel, funcDATAOffMod,
funcDATA1Mod, funcDATA2Mod, funcDATA3Mod, funcCIVTransceive, funcTime, funcDate,
funcUTCOffset, funcCLOCK2, funcCLOCK2UTCOffset, funcCLOCK2Name, funcDashRatio, funcScanSpeed,
funcScanResume, funcRecorderMode, funcRecorderTX, funcRecorderRX, funcRecorderSplit, funcRecorderPTTAuto,
funcRecorderPreRec, funcRXAntConnector, funcAntennaSelectMode, funcNBDepth, funcNBWidth, funcVOXDelay,
funcVOXVoiceDelay, funcAPFType, funcAPFTypeLevel, funcPSKTone, funcRTTYMarkTone, funcDataModeWithFilter,
funcAFMute, funcToneFreq, funcTSQLFreq, funcDTCSCode, funcCSQLCode, funcTransceiverStatus,
funcXFCStatus, funcReadTXFreq, funcCIVOutput, funcReadTXFreqs, funcReadUserTXFreqs, funcUserTXBandEdgeFreq,
funcRITFreq, funcRitStatus, funcRitTXStatus, funcSelectedFreq, funcSelectedMode, funcUnselectedFreq,
funcUnselectedMode, funcScopeWaveData,
funcScopeOnOff, funcScopeDataOutput, funcScopeMainSub, funcScopeSingleDual, funcScopeCenterFixed, funcScopeCenterSpan,
funcScopeEdgeNumber, funcScopeHold, funcScopeRef, funcScopeSpeed, funcScopeDuringTX, funcScopeCenterType,
funcScopeVBW, funcScopeFixedFreq, funcScopeRBW, funcVoiceTX, funcMainSubPrefix, funcAFCSetting,
funcREFAdjustFine, funcACCAModLevel, funcACCBModLevel, funcUSBModLevel, funcLANModLevel, funcSPDIFModLevel,
funcDATAOffMod, funcDATA1Mod, funcDATA2Mod, funcDATA3Mod, funcCIVTransceive, funcTime,
funcDate, funcUTCOffset, funcCLOCK2, funcCLOCK2UTCOffset, funcCLOCK2Name, funcDashRatio,
funcScanSpeed, funcScanResume, funcRecorderMode, funcRecorderTX, funcRecorderRX, funcRecorderSplit,
funcRecorderPTTAuto, funcRecorderPreRec, funcRXAntConnector, funcAntennaSelectMode, funcNBDepth, funcNBWidth,
funcVOXDelay, funcVOXVoiceDelay, funcAPFType, funcAPFTypeLevel, funcPSKTone, funcRTTYMarkTone,
funcDataModeWithFilter, funcAFMute, funcToneFreq, funcTSQLFreq, funcDTCSCode, funcCSQLCode,
funcTransceiverStatus, funcXFCStatus, funcReadTXFreq, funcCIVOutput, funcReadTXFreqs, funcReadUserTXFreqs,
funcUserTXBandEdgeFreq, funcRITFreq, funcRitStatus, funcRitTXStatus, funcSelectedFreq, funcSelectedMode,
funcUnselectedFreq, funcUnselectedMode, funcScopeMainWaveData, funcScopeSubWaveData, funcScopeOnOff, funcScopeDataOutput,
funcScopeMainSub, funcScopeSingleDual, funcScopeMainMode, funcScopeSubMode, funcScopeMainSpan, funcScopeSubSpan,
funcScopeMainEdge, funcScopeSubEdge, funcScopeMainHold, funcScopeSubHold, funcScopeMainRef, funcScopeSubRef,
funcScopeMainSpeed, funcScopeSubSpeed, funcScopeMainVBW, funcScopeSubVBW, funcScopeMainRBW, funcScopeSubRBW,
funcScopeDuringTX, funcScopeCenterType, funcScopeFixedEdgeFreq, funcVoiceTX, funcMainSubPrefix, funcAFCSetting,
funcGPSTXMode, funcSatelliteMemory, funcGPSPosition, funcMemoryGroup, funcSelectVFO, funcSeparator,
funcLCDWaterfall, funcLCDSpectrum, funcLCDNothing, funcPageUp, funcPageDown, funcFA,
funcFB
funcLCDWaterfall, funcLCDSpectrum, funcLCDNothing, funcPageUp, funcPageDown, funcVFOFrequency,
funcVFOMode, funcRigctlFunction, funcRigctlLevel, funcRigctlParam, funcFA, funcFB
};
@ -256,7 +252,7 @@ static QString funcString[] { "None",
"Mode Set", "VFO Swap A/B", "VFO Swap M/S", "VFO Equal AB", "VFO Equal MS", "VFO Dual Watch Off",
"VFO Dual Watch On", "VFO Dual Watch", "VFO Main Select", "VFO Sub Select", "VFO A Select", "VFO B Select",
"VFO Main/Sub Band", "Memory Mode", "Memory Write", "Memory to VFO", "Memory Clear", "Read Freq Offset",
"Send Freq Offset", "Scanning", "Split Operation", "Duplex Operation", "Tuning Step", "Attenuator Status",
"Send Freq Offset", "Scanning", "Split/Duplex", "Tuning Step", "Attenuator Status",
"Antenna", "Speech", "AF Gain", "RF Gain", "Squelch", "APF Level",
"NR Level", "IF Shift", "PBT Inner", "PBT Outer", "CW Pitch", "RF Power",
"Mic Gain", "Key Speed", "Notch Filter", "Compressor Level", "Break-In Delay", "NB Level",
@ -270,26 +266,25 @@ static QString funcString[] { "None",
"Tone Squelch Type", "IP Plus Status", "Send CW", "Power Control", "Transceiver ID", "Filter Width",
"Memory Contents", "Band Stacking Reg", "Memory Keyer", "IF Filter Width", "Quick Dual Watch", "Quick Split",
"Auto Repeater Mode", "Tuner/ATU Status", "Transverter Function", "Transverter Offset", "Lock Function", "REF Adjust",
"REF Adjust Fine", "ACC1 Mod Level", "ACC2 Mod Level", "USB Mod Level", "LAN Mod Level", "SPDIF Mod Level", "Data Off Mod Input",
"DATA1 Mod Input", "DATA2 Mod Input", "DATA3 Mod Input", "CIV Transceive", "System Time", "System Date",
"UTC Offset", "CLOCK2 Setting", "CLOCK2 UTC Offset", "CLOCK 2 Name", "Dash Ratio", "Scanning Speed",
"Scanning Resume", "Recorder Mode", "Recorder TX", "Recorder RX", "Recorder Split", "Recorder PTT Auto",
"Recorder Pre Rec", "RX Ant Connector", "Antenna Select Mode", "NB Depth", "NB Width", "VOX Delay",
"VOX Voice Delay", "APF Type", "APF Type Level", "PSK Tone", "RTTY Mark Tone", "Data Mode Filter",
"AF Mute Status", "Tone Frequency", "TSQL Frequency", "DTCS Code/Polarity", "CSQL Code", "Transceiver Status",
"XFC Status", "Read TX Freq", "CI-V Output", "Read TX Freqs", "Read User TX Freqs", "User TX Band Edge Freq",
"RIT Frequency", "RIT Status", "RIT TX Status", "Selected Freq", "Selected Mode", "Unselected Freq",
"Unselected Mode", "Scope Wave Data",
"Scope On/Off", "Scope Data Output", "Scope Main/Sub", "Scope Single/Dual", "Scope Center Fixed", "Scope Center Span",
"Scope Edge Number", "Scope Hold", "Scope Ref", "Scope Speed", "Scope During TX", "Scope Center Type",
"Scope VBW", "Scope Fixed Freq", "Scope RBW", "Voice TX", "Main/Sub Prefix", "AFC Function",
"REF Adjust Fine", "ACC1 Mod Level", "ACC2 Mod Level", "USB Mod Level", "LAN Mod Level", "SPDIF Mod Level",
"Data Off Mod Input", "DATA1 Mod Input", "DATA2 Mod Input", "DATA3 Mod Input", "CIV Transceive", "System Time",
"System Date", "UTC Offset", "CLOCK2 Setting", "CLOCK2 UTC Offset", "CLOCK 2 Name", "Dash Ratio",
"Scanning Speed", "Scanning Resume", "Recorder Mode", "Recorder TX", "Recorder RX", "Recorder Split",
"Recorder PTT Auto", "Recorder Pre Rec", "RX Ant Connector", "Antenna Select Mode", "NB Depth", "NB Width",
"VOX Delay", "VOX Voice Delay", "APF Type", "APF Type Level", "PSK Tone", "RTTY Mark Tone",
"Data Mode Filter", "AF Mute Status", "Tone Frequency", "TSQL Frequency", "DTCS Code/Polavrity", "CSQL Code",
"Transceiver Status", "XFC Status", "Read TX Freq", "CI-V Output", "Read TX Freqs", "Read User TX Freqs",
"User TX Band Edge Freq","RIT Frequency", "RIT Status", "RIT TX Status", "Selected Freq", "Selected Mode",
"Unselected Freq", "Unselected Mode", "Scope Main Wave Data", "Scope Sub Wave Data", "Scope On/Off", "Scope Data Output",
"Scope Main/Sub", "Scope Single/Dual", "Scope Main Mode", "Scope Sub Mode", "Scope Main Span", "Scope Sub Span",
"Scope Main Edge", "Scope Sub Edge", "Scope Main Hold", "Scope Sub Hold", "Scope Main Ref", "Scope Sub Ref",
"Scope Main Speed", "Scope Sub Speed", "Scope Main VBW", "Scope Sub VBW", "Scope Main RBW", "Scope Sub RBW",
"Scope During TX", "Scope Center Type", "Scope Fixed Edge Freq", "Voice TX", "Main/Sub Prefix", "AFC Function",
"GPS TX Mode", "Satellite Memory", "GPS Position", "Memory Group", "-Select VFO", "-Seperator",
"-LCD Waterfall", "-LCD Spectrum", "-LCD Nothing", "-Page Up", "-Page Down", "Command Error FA",
"Command OK FB"
"-LCD Waterfall", "-LCD Spectrum", "-LCD Nothing", "-Page Up", "-Page Down", "-VFO Frequency",
"-VFO Mode", "-Rigctl Function", "-Rigctl Level", "-Rigctl Param", "Command Error FA", "Command OK FB"
};
struct spanType {
spanType() {}
spanType(int num, QString name, unsigned int freq) : num(num), name(name), freq(freq) {}
@ -321,6 +316,15 @@ struct stepType {
quint64 hz;
};
struct spectrumBounds {
spectrumBounds(){};
spectrumBounds(double start, double end, uchar edge) : start(start), end(end), edge(edge) {};
double start;
double end;
uchar edge;
};
struct errorType {
errorType() : alert(false) {};
errorType(bool alert, QString message) : alert(alert), message(message) {};
@ -408,7 +412,6 @@ Q_DECLARE_METATYPE(rigMode_t)
Q_DECLARE_METATYPE(vfo_t)
Q_DECLARE_METATYPE(duplexMode_t)
Q_DECLARE_METATYPE(rptAccessTxRx_t)
Q_DECLARE_METATYPE(rptrTone_t)
Q_DECLARE_METATYPE(rptrAccessData)
Q_DECLARE_METATYPE(usbFeatureType)
Q_DECLARE_METATYPE(cmds)