kopia lustrzana https://gitlab.com/eliggett/wfview
Rewrite rigstate (again!)
rodzic
9ca9379f88
commit
47b439b741
391
rigcommander.cpp
391
rigcommander.cpp
|
@ -22,11 +22,6 @@
|
|||
|
||||
rigCommander::rigCommander()
|
||||
{
|
||||
state.filter(0,NONE);
|
||||
state.mode(0,NONE);
|
||||
state.ptt(0,NONE);
|
||||
state.currentVfo(0,NONE);
|
||||
state.duplex(dmSplitOff,NONE);
|
||||
}
|
||||
|
||||
rigCommander::~rigCommander()
|
||||
|
@ -143,6 +138,7 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs, aud
|
|||
connect(this, SIGNAL(discoveredRigID(rigCapabilities)), ptty, SLOT(receiveFoundRigID(rigCapabilities)));
|
||||
|
||||
emit haveAfGain(rxSetup.localAFgain);
|
||||
localVolume = rxSetup.localAFgain;
|
||||
}
|
||||
|
||||
// data from the comm port to the program:
|
||||
|
@ -262,7 +258,26 @@ void rigCommander::powerOn()
|
|||
{
|
||||
QByteArray payload;
|
||||
|
||||
for(int i=0; i < 150; i++)
|
||||
int numFE=150;
|
||||
switch (this->rigBaudRate) {
|
||||
case 57600:
|
||||
numFE = 75;
|
||||
break;
|
||||
case 38400:
|
||||
numFE = 50;
|
||||
break;
|
||||
case 19200:
|
||||
numFE = 25;
|
||||
break;
|
||||
case 9600:
|
||||
numFE = 13;
|
||||
break;
|
||||
case 4800:
|
||||
numFE = 7;
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i=0; i < numFE; i++)
|
||||
{
|
||||
payload.append("\xFE");
|
||||
}
|
||||
|
@ -568,12 +583,10 @@ void rigCommander::setFrequency(unsigned char vfo, freqt freq)
|
|||
|
||||
cmdPayload.append(freqPayload);
|
||||
if (vfo == 0) {
|
||||
state.vfoAFreq(freq.Hz,NONE);
|
||||
cmdPayload.prepend('\x00');
|
||||
}
|
||||
else
|
||||
{
|
||||
state.vfoBFreq(freq.Hz,NONE);
|
||||
cmdPayload.prepend(vfo);
|
||||
cmdPayload.prepend('\x25');
|
||||
}
|
||||
|
@ -1233,16 +1246,16 @@ void rigCommander::parseCommand()
|
|||
break;
|
||||
case '\x0F':
|
||||
emit haveDuplexMode((duplexMode)(unsigned char)payloadIn[1]);
|
||||
state.duplex((duplexMode)(unsigned char)payloadIn[1],NONE);
|
||||
state.set(DUPLEX, (duplexMode)(unsigned char)payloadIn[1], false);
|
||||
break;
|
||||
case '\x11':
|
||||
emit haveAttenuator((unsigned char)payloadIn.at(1));
|
||||
state.attenuator((unsigned char)payloadIn.at(1),NONE);
|
||||
state.set(ATTENUATOR, (quint8)payloadIn[1], false);
|
||||
break;
|
||||
case '\x12':
|
||||
emit haveAntenna((unsigned char)payloadIn.at(1), (bool)payloadIn.at(2));
|
||||
state.antenna((unsigned char)payloadIn.at(1),NONE);
|
||||
state.rxAntenna((bool)payloadIn.at(2),NONE);
|
||||
state.set(ANTENNA, (quint8)payloadIn[1], false);
|
||||
state.set(RXANTENNA, (bool)payloadIn[2], false);
|
||||
break;
|
||||
case '\x14':
|
||||
// read levels
|
||||
|
@ -1346,18 +1359,21 @@ void rigCommander::parseLevels()
|
|||
// AF level - ignore if LAN connection.
|
||||
if (udp == Q_NULLPTR) {
|
||||
emit haveAfGain(level);
|
||||
state.afGain(level,NONE);
|
||||
state.set(AFGAIN, level, false);
|
||||
}
|
||||
else {
|
||||
state.set(AFGAIN, localVolume, false);
|
||||
}
|
||||
break;
|
||||
case '\x02':
|
||||
// RX RF Gain
|
||||
emit haveRfGain(level);
|
||||
state.rfGain(level,NONE);
|
||||
state.set(RFGAIN, level, false);
|
||||
break;
|
||||
case '\x03':
|
||||
// Squelch level
|
||||
emit haveSql(level);
|
||||
state.squelch(level,NONE);
|
||||
state.set(SQUELCH, level, false);
|
||||
break;
|
||||
case '\x07':
|
||||
// Twin BPF Inner, or, IF-Shift level
|
||||
|
@ -1376,12 +1392,12 @@ void rigCommander::parseLevels()
|
|||
case '\x0A':
|
||||
// TX RF level
|
||||
emit haveTxPower(level);
|
||||
state.txPower(level,NONE);
|
||||
state.set(TXPOWER, level, false);
|
||||
break;
|
||||
case '\x0B':
|
||||
// Mic Gain
|
||||
emit haveMicGain(level);
|
||||
state.micGain(level,NONE);
|
||||
state.set(MICGAIN, level, false);
|
||||
break;
|
||||
case '\x0C':
|
||||
// CW Keying Speed - ignore for now
|
||||
|
@ -1392,7 +1408,7 @@ void rigCommander::parseLevels()
|
|||
case '\x0E':
|
||||
// compressor level
|
||||
emit haveCompLevel(level);
|
||||
state.compLevel(level,NONE);
|
||||
state.set(COMPLEVEL, level, false);
|
||||
break;
|
||||
case '\x12':
|
||||
// NB level - ignore for now
|
||||
|
@ -1400,17 +1416,17 @@ void rigCommander::parseLevels()
|
|||
case '\x15':
|
||||
// monitor level
|
||||
emit haveMonitorLevel(level);
|
||||
state.monitorLevel(level,NONE);
|
||||
state.set(MONITORLEVEL, level, false);
|
||||
break;
|
||||
case '\x16':
|
||||
// VOX gain
|
||||
emit haveVoxGain(level);
|
||||
state.voxGain(level,NONE);
|
||||
state.set(VOXGAIN, level, false);
|
||||
break;
|
||||
case '\x17':
|
||||
// anti-VOX gain
|
||||
emit haveAntiVoxGain(level);
|
||||
state.antiVoxGain(level,NONE);
|
||||
state.set(ANTIVOXGAIN, level, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1428,42 +1444,42 @@ void rigCommander::parseLevels()
|
|||
case '\x02':
|
||||
// S-Meter
|
||||
emit haveMeter(meterS, level);
|
||||
state.sMeter(level,NONE);
|
||||
state.set(SMETER, level, false);
|
||||
break;
|
||||
case '\x04':
|
||||
// Center (IC-R8600)
|
||||
emit haveMeter(meterCenter, level);
|
||||
state.sMeter(level,NONE);
|
||||
state.set(SMETER, level, false);
|
||||
break;
|
||||
case '\x11':
|
||||
// RF-Power meter
|
||||
emit haveMeter(meterPower, level);
|
||||
state.powerMeter(level,NONE);
|
||||
state.set(POWERMETER, level, false);
|
||||
break;
|
||||
case '\x12':
|
||||
// SWR
|
||||
emit haveMeter(meterSWR, level);
|
||||
state.swrMeter(level,NONE);
|
||||
state.set(SWRMETER, level, false);
|
||||
break;
|
||||
case '\x13':
|
||||
// ALC
|
||||
emit haveMeter(meterALC, level);
|
||||
state.alcMeter(level,NONE);
|
||||
state.set(ALCMETER, level, false);
|
||||
break;
|
||||
case '\x14':
|
||||
// COMP dB reduction
|
||||
emit haveMeter(meterComp, level);
|
||||
state.compMeter(level,NONE);
|
||||
state.set(COMPMETER, level, false);
|
||||
break;
|
||||
case '\x15':
|
||||
// VD (12V)
|
||||
emit haveMeter(meterVoltage, level);
|
||||
state.voltageMeter(level,NONE);
|
||||
state.set(VOLTAGEMETER, level, false);
|
||||
break;
|
||||
case '\x16':
|
||||
// ID
|
||||
emit haveMeter(meterCurrent, level);
|
||||
state.currentMeter(level,NONE);
|
||||
state.set(CURRENTMETER, level, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2094,6 +2110,7 @@ void rigCommander::setAfGain(unsigned char level)
|
|||
}
|
||||
else {
|
||||
emit haveSetVolume(level);
|
||||
localVolume = level;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2370,8 +2387,7 @@ void rigCommander::parsePTT()
|
|||
// PTT on
|
||||
emit havePTTStatus(true);
|
||||
}
|
||||
state.ptt((bool)payloadIn[2],NONE);
|
||||
|
||||
state.set(PTT,(bool)payloadIn[2],false);
|
||||
}
|
||||
|
||||
void rigCommander::parseRegisters1A()
|
||||
|
@ -2400,7 +2416,7 @@ void rigCommander::parseRegisters1A()
|
|||
parseBandStackReg();
|
||||
break;
|
||||
case '\x04':
|
||||
state.agc(payloadIn[02],AGC);
|
||||
state.set(AGC, (quint8)payloadIn[2], false);
|
||||
break;
|
||||
case '\x06':
|
||||
// data mode
|
||||
|
@ -2412,7 +2428,7 @@ void rigCommander::parseRegisters1A()
|
|||
// YY: filter selected, 01 through 03.;
|
||||
// if YY is 00 then XX was also set to 00
|
||||
emit haveDataMode((bool)payloadIn[03]);
|
||||
state.datamode((bool)payloadIn[03],NONE);
|
||||
state.set(DATAMODE, (quint8)payloadIn[3], false);
|
||||
break;
|
||||
case '\x07':
|
||||
// IP+ status
|
||||
|
@ -2434,24 +2450,24 @@ void rigCommander::parseRegister1B()
|
|||
// "Repeater tone"
|
||||
tone = decodeTone(payloadIn);
|
||||
emit haveTone(tone);
|
||||
state.ctcss(tone,NONE);
|
||||
state.set(CTCSS, tone, false);
|
||||
break;
|
||||
case '\x01':
|
||||
// "TSQL tone"
|
||||
tone = decodeTone(payloadIn);
|
||||
emit haveTSQL(tone);
|
||||
state.tsql(tone,NONE);
|
||||
state.set(TSQL, tone, false);
|
||||
break;
|
||||
case '\x02':
|
||||
// DTCS (DCS)
|
||||
tone = decodeTone(payloadIn, tinv, rinv);
|
||||
emit haveDTCS(tone, tinv, rinv);
|
||||
state.dtcs(tone,NONE);
|
||||
state.set(DTCS, tone, false);
|
||||
break;
|
||||
case '\x07':
|
||||
// "CSQL code (DV mode)"
|
||||
tone = decodeTone(payloadIn);
|
||||
state.csql(tone,NONE);
|
||||
state.set(CSQL, tone, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2472,49 +2488,49 @@ void rigCommander::parseRegister16()
|
|||
case '\x02':
|
||||
// Preamp
|
||||
emit havePreamp((unsigned char)payloadIn.at(2));
|
||||
state.preamp((unsigned char)payloadIn.at(2),NONE);
|
||||
state.set(PREAMP, (quint8)payloadIn.at(2), false);
|
||||
break;
|
||||
case '\x22':
|
||||
state.nbFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(NBFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x40':
|
||||
state.nrFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(NRFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x41': // Auto notch
|
||||
state.anfFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(ANFFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x42':
|
||||
state.toneFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(TONEFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x43':
|
||||
state.tsqlFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(TSQLFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\44':
|
||||
state.compFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(COMPFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\45':
|
||||
state.monFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(MONFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\46':
|
||||
state.voxFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(VOXFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
case '\x47':
|
||||
if (payloadIn.at(2) == '\00') {
|
||||
state.fbkinFunc(false, NONE);
|
||||
state.sbkinFunc(false, NONE);
|
||||
state.set(FBKINFUNC, false, false);
|
||||
state.set(SBKINFUNC, false, false);
|
||||
}
|
||||
else if (payloadIn.at(2) == '\01') {
|
||||
state.fbkinFunc(false, NONE);
|
||||
state.sbkinFunc(true, NONE);
|
||||
state.set(FBKINFUNC, false, false);
|
||||
state.set(SBKINFUNC, true, false);
|
||||
|
||||
}
|
||||
else if (payloadIn.at(2) == '\02') {
|
||||
state.fbkinFunc(true, NONE);
|
||||
state.sbkinFunc(false, NONE);
|
||||
state.set(FBKINFUNC, true, false);
|
||||
state.set(SBKINFUNC, false, false);
|
||||
}
|
||||
break;
|
||||
case '\48': // Manual Notch
|
||||
state.mnFunc((bool)payloadIn.at(2), NONE);
|
||||
state.set(MNFUNC, payloadIn.at(2) != 0, false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2820,6 +2836,7 @@ void rigCommander::parseWFData()
|
|||
break;
|
||||
case 0x10:
|
||||
// confirming scope is on
|
||||
state.set(SCOPEFUNC, (bool)payloadIn[2], true);
|
||||
break;
|
||||
case 0x11:
|
||||
// confirming output enabled/disabled of wf data.
|
||||
|
@ -3827,12 +3844,13 @@ void rigCommander::parseFrequency()
|
|||
|
||||
freq.MHzDouble = frequencyMhz;
|
||||
|
||||
if (state.currentVfo() == 0) {
|
||||
state.vfoAFreq(freq.Hz, NONE);
|
||||
if (state.getChar(CURRENTVFO) == 0) {
|
||||
state.set(VFOAFREQ, freq.Hz, false);
|
||||
}
|
||||
else {
|
||||
state.vfoBFreq(freq.Hz, NONE);
|
||||
state.set(VFOBFREQ, freq.Hz, false);
|
||||
}
|
||||
|
||||
emit haveFrequency(freq);
|
||||
}
|
||||
|
||||
|
@ -3911,8 +3929,8 @@ void rigCommander::parseMode()
|
|||
filter = 0;
|
||||
}
|
||||
emit haveMode((unsigned char)payloadIn[01], filter);
|
||||
state.mode((unsigned char)payloadIn[01],NONE);
|
||||
state.filter(filter,NONE);
|
||||
state.set(MODE,(unsigned char)payloadIn[01],false);
|
||||
state.set(FILTER,filter,false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4212,170 +4230,241 @@ void rigCommander::stateUpdated()
|
|||
|
||||
/* VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, DUPLEX, DATAMODE, ANTENNA, RXANTENNA, CTCSS, TSQL, DTCS, CSQL */
|
||||
|
||||
if ((state.updated()) & (1ULL <<(VFOAFREQ))) {
|
||||
// VFO A FREQUENCY IS UPDATED!
|
||||
QMap<stateTypes, value>::iterator i = state.map.begin();
|
||||
while (i != state.map.end()) {
|
||||
if (!i.value()._valid || i.value()._updated)
|
||||
{
|
||||
i.value()._updated = false;
|
||||
i.value()._valid = true; // Set value to valid as we have requested it (even if we haven't had a response)
|
||||
qDebug(logRigCtlD()) << "Got new value:" << i.key() << "=" << i.value()._value;
|
||||
switch (i.key()) {
|
||||
case VFOAFREQ:
|
||||
if (i.value()._valid) {
|
||||
freqt freq;
|
||||
freq.Hz = state.vfoAFreq();
|
||||
freq.Hz = state.getInt64(VFOAFREQ);
|
||||
setFrequency(0, freq);
|
||||
setFrequency(0, freq);
|
||||
setFrequency(0, freq);
|
||||
getFrequency();
|
||||
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(VFOBFREQ))) {
|
||||
// VFO B FREQUENCY IS UPDATED!
|
||||
getFrequency();
|
||||
break;
|
||||
case VFOBFREQ:
|
||||
if (i.value()._valid) {
|
||||
freqt freq;
|
||||
freq.Hz = state.vfoBFreq();
|
||||
freq.Hz = state.getInt64(VFOBFREQ);
|
||||
setFrequency(1, freq);
|
||||
setFrequency(1, freq);
|
||||
setFrequency(1, freq);
|
||||
getFrequency();
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(CURRENTVFO))) {
|
||||
getFrequency();
|
||||
break;
|
||||
case CURRENTVFO:
|
||||
// Work on VFOB - how do we do this?
|
||||
break;
|
||||
case PTT:
|
||||
if (i.value()._valid) {
|
||||
setPTT(state.getBool(PTT));
|
||||
setPTT(state.getBool(PTT));
|
||||
setPTT(state.getBool(PTT));
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(PTT))) {
|
||||
setPTT(state.ptt());
|
||||
setPTT(state.ptt());
|
||||
setPTT(state.ptt());
|
||||
getPTT();
|
||||
break;
|
||||
case MODE:
|
||||
case FILTER:
|
||||
if (i.value()._valid) {
|
||||
setMode(state.getChar(MODE), state.getChar(FILTER));
|
||||
}
|
||||
if (((state.updated()) & (1ULL <<(MODE))) || ((state.updated()) & (1ULL <<(FILTER)))) {
|
||||
setMode(state.mode(),state.filter());
|
||||
getMode();
|
||||
break;
|
||||
case DUPLEX:
|
||||
if (i.value()._valid) {
|
||||
setDuplexMode(state.getDuplex(DUPLEX));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(DUPLEX))) {
|
||||
setDuplexMode(state.duplex());
|
||||
getDuplexMode();
|
||||
break;
|
||||
case DATAMODE:
|
||||
if (i.value()._valid) {
|
||||
setDataMode(state.getBool(DATAMODE), state.getChar(FILTER));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(DATAMODE))) {
|
||||
setDataMode(state.datamode(), state.filter());
|
||||
getDataMode();
|
||||
getDuplexMode();
|
||||
break;
|
||||
case ANTENNA:
|
||||
case RXANTENNA:
|
||||
if (i.value()._valid) {
|
||||
setAntenna(state.getChar(ANTENNA), state.getBool(RXANTENNA));
|
||||
}
|
||||
|
||||
if (((state.updated()) & (1ULL <<(ANTENNA))) || ((state.updated()) & (1ULL <<(RXANTENNA)))) {
|
||||
setAntenna(state.antenna(), state.rxAntenna());
|
||||
getAntenna();
|
||||
break;
|
||||
case CTCSS:
|
||||
if (i.value()._valid) {
|
||||
setTone(state.getChar(CTCSS));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(CTCSS))) {
|
||||
setTone(state.ctcss());
|
||||
getTone();
|
||||
break;
|
||||
case TSQL:
|
||||
if (i.value()._valid) {
|
||||
setTSQL(state.getChar(TSQL));
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(TSQL))) {
|
||||
setTSQL(state.tsql());
|
||||
getTSQL();
|
||||
break;
|
||||
case DTCS:
|
||||
if (i.value()._valid) {
|
||||
setDTCS(state.getChar(DTCS), false, false); // Not sure about this?
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(DTCS))) {
|
||||
setDTCS(state.dtcs(),false,false); // Not sure about this?
|
||||
getDTCS();
|
||||
break;
|
||||
case CSQL:
|
||||
if (i.value()._valid) {
|
||||
setTone(state.getChar(CSQL));
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(CSQL))) { // Not sure about this one?
|
||||
//setTone(state.ctcss());
|
||||
//getTone();
|
||||
getTone();
|
||||
break;
|
||||
case PREAMP:
|
||||
if (i.value()._valid) {
|
||||
setPreamp(state.getChar(PREAMP));
|
||||
}
|
||||
|
||||
/* PREAMP, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, TXPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, VOXGAIN, ANTIVOXGAIN */
|
||||
if ((state.updated()) & (1ULL <<(PREAMP))) {
|
||||
setPreamp(state.preamp());
|
||||
getPreamp();
|
||||
break;
|
||||
case ATTENUATOR:
|
||||
if (i.value()._valid) {
|
||||
setAttenuator(state.getChar(ATTENUATOR));
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(ATTENUATOR))) {
|
||||
setAttenuator(state.attenuator());
|
||||
getAttenuator();
|
||||
break;
|
||||
case AFGAIN:
|
||||
if (i.value()._valid) {
|
||||
setAfGain(state.getChar(AFGAIN));
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(MODINPUT))) {
|
||||
getModInputLevel(rigInput::inputLAN); // Need to fix this!
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(AFGAIN))) {
|
||||
setAfGain(state.afGain());
|
||||
getAfGain();
|
||||
break;
|
||||
case RFGAIN:
|
||||
if (i.value()._valid) {
|
||||
setRfGain(state.getChar(RFGAIN));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(RFGAIN))) {
|
||||
setRfGain(state.rfGain());
|
||||
getRfGain();
|
||||
break;
|
||||
case SQUELCH:
|
||||
if (i.value()._valid) {
|
||||
setSquelch(state.getChar(SQUELCH));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(SQUELCH))) {
|
||||
setSquelch(state.squelch());
|
||||
getSql();
|
||||
break;
|
||||
case TXPOWER:
|
||||
if (i.value()._valid) {
|
||||
setTxPower(state.getChar(TXPOWER));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(TXPOWER))) {
|
||||
setTxPower(state.txPower());
|
||||
getTxLevel();
|
||||
break;
|
||||
case MICGAIN:
|
||||
if (i.value()._valid) {
|
||||
setMicGain(state.getChar(MICGAIN));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(MICGAIN))) {
|
||||
setMicGain(state.micGain());
|
||||
getMicGain();
|
||||
break;
|
||||
case COMPLEVEL:
|
||||
if (i.value()._valid) {
|
||||
setCompLevel(state.getChar(COMPLEVEL));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(COMPLEVEL))) {
|
||||
setCompLevel(state.compLevel());
|
||||
getCompLevel();
|
||||
break;
|
||||
case MONITORLEVEL:
|
||||
if (i.value()._valid) {
|
||||
setMonitorLevel(state.getChar(MONITORLEVEL));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(MONITORLEVEL))) {
|
||||
setMonitorLevel(state.monitorLevel());
|
||||
getMonitorLevel();
|
||||
break;
|
||||
case VOXGAIN:
|
||||
if (i.value()._valid) {
|
||||
setVoxGain(state.getChar(VOXGAIN));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(VOXGAIN))) {
|
||||
setVoxGain(state.voxGain());
|
||||
getVoxGain();
|
||||
break;
|
||||
case ANTIVOXGAIN:
|
||||
if (i.value()._valid) {
|
||||
setAntiVoxGain(state.getChar(ANTIVOXGAIN));
|
||||
}
|
||||
|
||||
if ((state.updated()) & (1ULL <<(ANTIVOXGAIN))) {
|
||||
setAntiVoxGain(state.antiVoxGain());
|
||||
getAntiVoxGain();
|
||||
break;
|
||||
case NBFUNC:
|
||||
if (i.value()._valid) {
|
||||
setNb(state.getBool(NBFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(NBFUNC))) {
|
||||
setNb(state.nbFunc());
|
||||
getNb();
|
||||
break;
|
||||
case NRFUNC:
|
||||
if (i.value()._valid) {
|
||||
setNr(state.getBool(NRFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (NRFUNC))) {
|
||||
setNr(state.nrFunc());
|
||||
getNr();
|
||||
break;
|
||||
case ANFFUNC:
|
||||
if (i.value()._valid) {
|
||||
setAutoNotch(state.getBool(ANFFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (ANFFUNC))) {
|
||||
setAutoNotch(state.anfFunc());
|
||||
getAutoNotch();
|
||||
break;
|
||||
case TONEFUNC:
|
||||
if (i.value()._valid) {
|
||||
setToneEnabled(state.getBool(TONEFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (TONEFUNC))) {
|
||||
setToneEnabled(state.toneFunc());
|
||||
getToneEnabled();
|
||||
break;
|
||||
case TSQLFUNC:
|
||||
if (i.value()._valid) {
|
||||
setToneSql(state.getBool(TSQLFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (TSQLFUNC))) {
|
||||
setToneSql(state.tsqlFunc());
|
||||
getToneSql();
|
||||
break;
|
||||
case COMPFUNC:
|
||||
if (i.value()._valid) {
|
||||
setCompressor(state.getBool(COMPFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (COMPFUNC))) {
|
||||
setCompressor(state.compFunc());
|
||||
getCompressor();
|
||||
break;
|
||||
case MONFUNC:
|
||||
if (i.value()._valid) {
|
||||
setMonitor(state.getBool(MONFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (MONFUNC))) {
|
||||
setMonitor(state.monFunc());
|
||||
getMonitor();
|
||||
break;
|
||||
case VOXFUNC:
|
||||
if (i.value()._valid) {
|
||||
setVox(state.getBool(VOXFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (VOXFUNC))) {
|
||||
setVox(state.voxFunc());
|
||||
getVox();
|
||||
break;
|
||||
case SBKINFUNC:
|
||||
if (i.value()._valid) {
|
||||
setBreakIn(state.getBool(VOXFUNC));
|
||||
}
|
||||
getVox();
|
||||
break;
|
||||
case FBKINFUNC:
|
||||
if (i.value()._valid) {
|
||||
setBreakIn(state.getBool(VOXFUNC) << 1);
|
||||
}
|
||||
if ((state.updated()) & (1ULL <<(FBKINFUNC))) {
|
||||
setBreakIn(state.sbkinFunc()<<1);
|
||||
getBreakIn();
|
||||
break;
|
||||
case MNFUNC:
|
||||
if (i.value()._valid) {
|
||||
setManualNotch(state.getBool(MNFUNC));
|
||||
}
|
||||
if ((state.updated()) & (1ULL << (MNFUNC))) {
|
||||
setManualNotch(state.mnFunc());
|
||||
getManualNotch();
|
||||
break;
|
||||
case SCOPEFUNC:
|
||||
if (i.value()._valid) {
|
||||
if (state.getBool(SCOPEFUNC)) {
|
||||
enableSpectOutput();
|
||||
}
|
||||
else {
|
||||
disableSpectOutput();
|
||||
}
|
||||
}
|
||||
|
||||
state.updated(0);
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
void rigCommander::getDebug()
|
||||
|
|
|
@ -460,6 +460,7 @@ private:
|
|||
QString password;
|
||||
|
||||
QString serialPortError;
|
||||
unsigned char localVolume=0;
|
||||
|
||||
|
||||
};
|
||||
|
|
307
rigctld.cpp
307
rigctld.cpp
|
@ -79,6 +79,7 @@ int rigCtlD::startServer(qint16 port)
|
|||
{
|
||||
qInfo(logRigCtlD()) << "started on port " << port;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -118,6 +119,8 @@ rigCtlClient::rigCtlClient(int socketId, rigCapabilities caps, rigstate* state,
|
|||
connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()), Qt::DirectConnection);
|
||||
connect(parent, SIGNAL(sendData(QString)), this, SLOT(sendData(QString)), Qt::DirectConnection);
|
||||
qInfo(logRigCtlD()) << " session connected: " << sessionId;
|
||||
emit parent->stateUpdated(); // Get the current state.
|
||||
|
||||
}
|
||||
|
||||
void rigCtlClient::socketReadyRead()
|
||||
|
@ -182,15 +185,15 @@ void rigCtlClient::socketReadyRead()
|
|||
if (longReply) {
|
||||
resp.append(QString("ChkVFO: "));
|
||||
}
|
||||
resp.append(QString("%1").arg(rigState->currentVfo()));
|
||||
resp.append(QString("%1").arg(rigState->getChar(CURRENTVFO)));
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "dump_state")
|
||||
{
|
||||
// Currently send "fake" state information until I can work out what is required!
|
||||
response.append("1");
|
||||
response.append("1"); // rigctld protocol version
|
||||
response.append(QString("%1").arg(rigCaps.rigctlModel));
|
||||
response.append("0");
|
||||
response.append("0"); // Print something
|
||||
for (bandType band : rigCaps.bands)
|
||||
{
|
||||
response.append(generateFreqRange(band));
|
||||
|
@ -203,6 +206,7 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
}
|
||||
response.append("0 0 0 0 0 0 0");
|
||||
|
||||
response.append("0x1ff 1");
|
||||
response.append("0x1ff 0");
|
||||
response.append("0 0");
|
||||
|
@ -251,12 +255,21 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append(attens);
|
||||
|
||||
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
|
||||
/*
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xfffffffff7ffffff");
|
||||
response.append("0xfffffff083ffffff");
|
||||
response.append("0xffffffffffffffff");
|
||||
response.append("0xffffffffffffffbf");
|
||||
*/
|
||||
|
||||
/*
|
||||
response.append("0x3effffff");
|
||||
|
@ -275,12 +288,14 @@ void rigCtlClient::socketReadyRead()
|
|||
if (longReply) {
|
||||
resp.append(QString("Frequency: "));
|
||||
}
|
||||
if (rigState->currentVfo()==0) {
|
||||
resp.append(QString("%1").arg(rigState->vfoAFreq()));
|
||||
|
||||
if (rigState->getChar(CURRENTVFO)==0) {
|
||||
resp.append(QString("%1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
else {
|
||||
resp.append(QString("%1").arg(rigState->vfoBFreq()));
|
||||
resp.append(QString("%1").arg(rigState->getInt64(VFOBFREQ)));
|
||||
}
|
||||
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command[0] == "F" || command[0] == "set_freq")
|
||||
|
@ -307,10 +322,10 @@ void rigCtlClient::socketReadyRead()
|
|||
freq.Hz = static_cast<int>(newFreq);
|
||||
qDebug(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]);
|
||||
if (vfo == 0) {
|
||||
rigState->vfoAFreq(freq.Hz, VFOAFREQ);
|
||||
rigState->set(VFOAFREQ, freq.Hz,true);
|
||||
}
|
||||
else {
|
||||
rigState->vfoAFreq(freq.Hz, VFOBFREQ);
|
||||
rigState->set(VFOBFREQ, freq.Hz,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +356,7 @@ void rigCtlClient::socketReadyRead()
|
|||
if (longReply) {
|
||||
resp.append(QString("PTT: "));
|
||||
}
|
||||
resp.append(QString("%1").arg(rigState->ptt()));
|
||||
resp.append(QString("%1").arg(rigState->getBool(PTT)));
|
||||
response.append(resp);
|
||||
}
|
||||
else
|
||||
|
@ -353,26 +368,27 @@ void rigCtlClient::socketReadyRead()
|
|||
{
|
||||
setCommand = true;
|
||||
if (rigCaps.hasPTTCommand) {
|
||||
rigState->ptt(bool(command[1].toInt()), PTT);
|
||||
rigState->set(PTT, (bool)command[1].toInt(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
responseCode = -1;
|
||||
}
|
||||
}
|
||||
else if (command[0] == "v" || command[0] == "get_vfo")
|
||||
else if (command[0] == "v" || command[0] == "v\nv" || command[0] == "get_vfo")
|
||||
{
|
||||
QString resp;
|
||||
if (longReply) {
|
||||
resp.append("VFO: ");
|
||||
}
|
||||
|
||||
if (rigState->currentVfo() == 0) {
|
||||
if (rigState->getChar(CURRENTVFO) == 0) {
|
||||
resp.append("VFOA");
|
||||
}
|
||||
else {
|
||||
resp.append("VFOB");
|
||||
}
|
||||
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command.length() > 1 && (command[0] == "V" || command[0] == "set_vfo"))
|
||||
|
@ -387,19 +403,20 @@ void rigCtlClient::socketReadyRead()
|
|||
response.append("MEM");
|
||||
}
|
||||
else if (command[1] == "VFOB" || command[1] == "Sub") {
|
||||
emit parent->setVFO(1);
|
||||
//emit parent->setVFO(1);
|
||||
}
|
||||
else {
|
||||
emit parent->setVFO(0);
|
||||
//emit parent->setVFO(0);
|
||||
}
|
||||
}
|
||||
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||
{
|
||||
|
||||
if (longReply) {
|
||||
response.append(QString("Split: %1").arg(rigState->duplex()));
|
||||
response.append(QString("Split: %1").arg(rigState->getChar(DUPLEX)));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(rigState->duplex()));
|
||||
response.append(QString("%1").arg(rigState->getChar(DUPLEX)));
|
||||
}
|
||||
|
||||
QString resp;
|
||||
|
@ -407,51 +424,54 @@ void rigCtlClient::socketReadyRead()
|
|||
resp.append("TX VFO: ");
|
||||
}
|
||||
|
||||
if (rigState->currentVfo() == 0)
|
||||
|
||||
if (rigState->getChar(CURRENTVFO) == 0)
|
||||
{
|
||||
resp.append(QString("%1").arg("VFOB"));
|
||||
}
|
||||
else {
|
||||
resp.append(QString("%1").arg("VFOA"));
|
||||
}
|
||||
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command.length() > 1 && (command[0] == "S" || command[0] == "set_split_vfo"))
|
||||
{
|
||||
setCommand = true;
|
||||
|
||||
if (command[1] == "1")
|
||||
{
|
||||
rigState->duplex(dmSplitOn, DUPLEX);
|
||||
rigState->set(DUPLEX, dmSplitOn, true);
|
||||
}
|
||||
else {
|
||||
rigState->duplex(dmSplitOff, DUPLEX);
|
||||
rigState->set(DUPLEX, dmSplitOff, true);
|
||||
}
|
||||
}
|
||||
else if (command[0] == "\xf3" || command[0] == "get_vfo_info")
|
||||
{
|
||||
if (longReply) {
|
||||
//response.append(QString("set_vfo: %1").arg(command[1]));
|
||||
response.append(QString("set_vfo: %1").arg(command[1]));
|
||||
|
||||
if (command[1] == "VFOB") {
|
||||
response.append(QString("Freq: %1").arg(rigState->vfoBFreq()));
|
||||
response.append(QString("Freq: %1").arg(rigState->getInt64(VFOBFREQ)));
|
||||
}
|
||||
else {
|
||||
response.append(QString("Freq: %1").arg(rigState->vfoAFreq()));
|
||||
response.append(QString("Freq: %1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
response.append(QString("Mode: %1").arg(getMode(rigState->mode(), rigState->datamode())));
|
||||
response.append(QString("Width: %1").arg(getFilter(rigState->mode(), rigState->filter())));
|
||||
response.append(QString("Split: %1").arg(rigState->duplex()));
|
||||
response.append(QString("Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("Width: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
response.append(QString("Split: %1").arg(rigState->getDuplex(DUPLEX)));
|
||||
response.append(QString("SatMode: %1").arg(0)); // Need to get satmode
|
||||
}
|
||||
else {
|
||||
if (command[1] == "VFOB") {
|
||||
response.append(QString("%1").arg(rigState->vfoBFreq()));
|
||||
response.append(QString("%1").arg(rigState->getInt64(VFOBFREQ)));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(rigState->vfoAFreq()));
|
||||
response.append(QString("%1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
response.append(QString("%1").arg(getMode(rigState->mode(), rigState->datamode())));
|
||||
response.append(QString("%1").arg(getFilter(rigState->mode(), rigState->filter())));
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
}
|
||||
}
|
||||
else if (command[0] == "i" || command[0] == "get_split_freq")
|
||||
|
@ -460,12 +480,14 @@ void rigCtlClient::socketReadyRead()
|
|||
if (longReply) {
|
||||
resp.append("TX VFO: ");
|
||||
}
|
||||
if (rigState->currentVfo() == 0) {
|
||||
resp.append(QString("%1").arg(rigState->vfoBFreq()));
|
||||
|
||||
if (rigState->getInt64(CURRENTVFO) == 0) {
|
||||
resp.append(QString("%1").arg(rigState->getInt64(VFOBFREQ)));
|
||||
}
|
||||
else {
|
||||
resp.append(QString("%1").arg(rigState->vfoAFreq()));
|
||||
resp.append(QString("%1").arg(rigState->getInt64(VFOAFREQ)));
|
||||
}
|
||||
|
||||
response.append(resp);
|
||||
}
|
||||
else if (command.length() > 1 && (command[0] == "I" || command[0] == "set_split_freq"))
|
||||
|
@ -476,7 +498,7 @@ void rigCtlClient::socketReadyRead()
|
|||
newFreq = command[1].toDouble(&ok);
|
||||
if (ok) {
|
||||
qDebug(logRigCtlD()) << QString("set_split_freq: %1 (%2)").arg(newFreq).arg(command[1]);
|
||||
rigState->vfoBFreq(static_cast<int>(newFreq),VFOBFREQ);
|
||||
rigState->set(VFOBFREQ, static_cast<quint64>(newFreq),false);
|
||||
}
|
||||
}
|
||||
else if (command.length() > 2 && (command[0] == "X" || command[0] == "set_split_mode"))
|
||||
|
@ -487,24 +509,24 @@ void rigCtlClient::socketReadyRead()
|
|||
else if (command.length() > 0 && (command[0] == "x" || command[0] == "get_split_mode"))
|
||||
{
|
||||
if (longReply) {
|
||||
response.append(QString("TX Mode: %1").arg(getMode(rigState->mode(), rigState->datamode())));
|
||||
response.append(QString("TX Passband: %1").arg(getFilter(rigState->mode(), rigState->filter())));
|
||||
response.append(QString("TX Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("TX Passband: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(getMode(rigState->mode(), rigState->datamode())));
|
||||
response.append(QString("%1").arg(getFilter(rigState->mode(), rigState->filter())));
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
}
|
||||
}
|
||||
|
||||
else if (command[0] == "m" || command[0] == "get_mode")
|
||||
{
|
||||
if (longReply) {
|
||||
response.append(QString("Mode: %1").arg(getMode(rigState->mode(), rigState->datamode())));
|
||||
response.append(QString("Passband: %1").arg(getFilter(rigState->mode(), rigState->filter())));
|
||||
response.append(QString("TX Mode: %1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("TX Passband: %1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(getMode(rigState->mode(), rigState->datamode())));
|
||||
response.append(QString("%1").arg(getFilter(rigState->mode(), rigState->filter())));
|
||||
response.append(QString("%1").arg(getMode(rigState->getChar(MODE), rigState->getBool(DATAMODE))));
|
||||
response.append(QString("%1").arg(getFilter(rigState->getChar(MODE), rigState->getChar(FILTER))));
|
||||
}
|
||||
}
|
||||
else if (command[0] == "M" || command[0] == "set_mode")
|
||||
|
@ -530,14 +552,15 @@ void rigCtlClient::socketReadyRead()
|
|||
else
|
||||
width = 1;
|
||||
|
||||
rigState->mode(getMode(mode), MODE);
|
||||
rigState->filter(width, FILTER);
|
||||
rigState->set(MODE,getMode(mode),true);
|
||||
rigState->set(FILTER,(quint8)width, true);
|
||||
if (mode.mid(0, 3) == "PKT") {
|
||||
rigState->datamode(true, DATAMODE);
|
||||
rigState->set(DATAMODE, true, true);
|
||||
}
|
||||
else {
|
||||
rigState->datamode(true, DATAMODE);
|
||||
rigState->set(DATAMODE, false, true);
|
||||
}
|
||||
|
||||
}
|
||||
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||
{
|
||||
|
@ -573,22 +596,22 @@ void rigCtlClient::socketReadyRead()
|
|||
if (longReply) {
|
||||
response.append(QString("AntCurr: %1").arg(getAntName((unsigned char)command[1].toInt())));
|
||||
response.append(QString("Option: %1").arg(0));
|
||||
response.append(QString("AntTx: %1").arg(getAntName(rigState->antenna())));
|
||||
response.append(QString("AntRx: %1").arg(getAntName(rigState->antenna())));
|
||||
response.append(QString("AntTx: %1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
response.append(QString("AntRx: %1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
}
|
||||
else {
|
||||
response.append(QString("%1").arg(getAntName((unsigned char)command[1].toInt())));
|
||||
response.append(QString("%1").arg(0));
|
||||
response.append(QString("%1").arg(getAntName(rigState->antenna())));
|
||||
response.append(QString("%1").arg(getAntName(rigState->antenna())));
|
||||
response.append(QString("%1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
response.append(QString("%1").arg(getAntName(rigState->getChar(ANTENNA))));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (command[0] == "Y" || command[0] == "set_ant")
|
||||
else if (command.length() > 1 && (command[0] == "Y" || command[0] == "set_ant"))
|
||||
{
|
||||
setCommand = true;
|
||||
qInfo(logRigCtlD()) << "set_ant:" << command[1];
|
||||
rigState->antenna(antFromName(command[1]),ANTENNA);
|
||||
rigState->set(ANTENNA,antFromName(command[1]),true);
|
||||
}
|
||||
else if (command[0] == "z" || command[0] == "get_xit")
|
||||
{
|
||||
|
@ -612,47 +635,49 @@ void rigCtlClient::socketReadyRead()
|
|||
}
|
||||
|
||||
if (command[1] == "STRENGTH") {
|
||||
|
||||
if (rigCaps.model == model7610)
|
||||
value = getCalibratedValue(rigState->sMeter(), IC7610_STR_CAL);
|
||||
value = getCalibratedValue(rigState->getChar(SMETER), IC7610_STR_CAL);
|
||||
else if (rigCaps.model == model7850)
|
||||
value = getCalibratedValue(rigState->sMeter(), IC7850_STR_CAL);
|
||||
value = getCalibratedValue(rigState->getChar(SMETER), IC7850_STR_CAL);
|
||||
else
|
||||
value = getCalibratedValue(rigState->sMeter(), IC7300_STR_CAL);
|
||||
value = getCalibratedValue(rigState->getChar(SMETER), IC7300_STR_CAL);
|
||||
//qInfo(logRigCtlD()) << "Calibration IN:" << rigState->sMeter << "OUT" << value;
|
||||
resp.append(QString("%1").arg(value));
|
||||
}
|
||||
|
||||
else if (command[1] == "AF") {
|
||||
resp.append(QString("%1").arg((float)rigState->afGain() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(AFGAIN) / 255.0));
|
||||
}
|
||||
else if (command[1] == "RF") {
|
||||
resp.append(QString("%1").arg((float)rigState->rfGain() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(RFGAIN) / 255.0));
|
||||
}
|
||||
else if (command[1] == "SQL") {
|
||||
resp.append(QString("%1").arg((float)rigState->squelch() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(SQUELCH) / 255.0));
|
||||
}
|
||||
else if (command[1] == "COMP") {
|
||||
resp.append(QString("%1").arg((float)rigState->compLevel() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(COMPLEVEL) / 255.0));
|
||||
}
|
||||
else if (command[1] == "MICGAIN") {
|
||||
resp.append(QString("%1").arg((float)rigState->micGain() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(MICGAIN) / 255.0));
|
||||
}
|
||||
else if (command[1] == "MON") {
|
||||
resp.append(QString("%1").arg((float)rigState->monitorLevel() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(MONITORLEVEL) / 255.0));
|
||||
}
|
||||
else if (command[1] == "VOXGAIN") {
|
||||
resp.append(QString("%1").arg((float)rigState->voxGain() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(VOXGAIN) / 255.0));
|
||||
}
|
||||
else if (command[1] == "ANTIVOX") {
|
||||
resp.append(QString("%1").arg((float)rigState->antiVoxGain() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(ANTIVOXGAIN) / 255.0));
|
||||
}
|
||||
else if (command[1] == "RFPOWER") {
|
||||
resp.append(QString("%1").arg((float)rigState->txPower() / 255.0));
|
||||
resp.append(QString("%1").arg((float)rigState->getChar(TXPOWER) / 255.0));
|
||||
}
|
||||
else if (command[1] == "PREAMP") {
|
||||
resp.append(QString("%1").arg(rigState->preamp()*10));
|
||||
resp.append(QString("%1").arg(rigState->getChar(PREAMP)*10));
|
||||
}
|
||||
else if (command[1] == "ATT") {
|
||||
resp.append(QString("%1").arg(rigState->attenuator()));
|
||||
resp.append(QString("%1").arg(rigState->getChar(ATTENUATOR)));
|
||||
}
|
||||
else {
|
||||
resp.append(QString("%1").arg(value));
|
||||
|
@ -666,47 +691,47 @@ void rigCtlClient::socketReadyRead()
|
|||
setCommand = true;
|
||||
if (command[1] == "AF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->afGain(value,AFGAIN);
|
||||
rigState->set(AFGAIN, value, true);
|
||||
}
|
||||
else if (command[1] == "RF") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->rfGain(value,RFGAIN);
|
||||
rigState->set(RFGAIN, value, true);
|
||||
}
|
||||
else if (command[1] == "SQL") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->squelch(value,SQUELCH);
|
||||
rigState->set(SQUELCH, value, true);
|
||||
}
|
||||
else if (command[1] == "COMP") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->compLevel(value,COMPLEVEL);
|
||||
rigState->set(COMPLEVEL, value, true);
|
||||
}
|
||||
else if (command[1] == "MICGAIN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->micGain(value,MICGAIN);
|
||||
rigState->set(MICGAIN, value, true);
|
||||
}
|
||||
else if (command[1] == "MON") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->monitorLevel(value,MONITORLEVEL);
|
||||
rigState->set(MONITORLEVEL, value, true);
|
||||
}
|
||||
else if (command[1] == "VOXGAIN") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->voxGain(value,VOXGAIN);
|
||||
rigState->set(VOXGAIN, value, true);
|
||||
}
|
||||
else if (command[1] == "ANTIVOX") {
|
||||
value = command[2].toFloat() * 255;
|
||||
rigState->antiVoxGain(value,ANTIVOXGAIN);
|
||||
rigState->set(ANTIVOXGAIN, value, true);
|
||||
}
|
||||
else if (command[1] == "ATT") {
|
||||
value = command[2].toFloat();
|
||||
rigState->attenuator(value,ATTENUATOR);
|
||||
value = command[2].toInt();
|
||||
rigState->set(ATTENUATOR, value, true);
|
||||
}
|
||||
else if (command[1] == "PREAMP") {
|
||||
value = command[2].toFloat() / 10;
|
||||
rigState->preamp(value, PREAMP);
|
||||
rigState->set(PREAMP, value, true);
|
||||
}
|
||||
else if (command[1] == "AGC") {
|
||||
value = command[2].toInt();;
|
||||
rigState->agc(value, AGC);
|
||||
rigState->set(AGC, value, true);
|
||||
}
|
||||
|
||||
qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value;
|
||||
|
@ -719,134 +744,134 @@ void rigCtlClient::socketReadyRead()
|
|||
if (longReply) {
|
||||
resp.append(QString("Func Status: "));
|
||||
}
|
||||
|
||||
if (command[1] == "FAGC")
|
||||
{
|
||||
result=rigState->fagcFunc();
|
||||
result=rigState->getBool(FAGCFUNC);
|
||||
}
|
||||
else if (command[1] == "NB")
|
||||
{
|
||||
result = rigState->nbFunc();
|
||||
result = rigState->getBool(NBFUNC);
|
||||
}
|
||||
else if (command[1] == "COMP")
|
||||
{
|
||||
result=rigState->compFunc();
|
||||
result=rigState->getBool(COMPFUNC);
|
||||
}
|
||||
else if (command[1] == "VOX")
|
||||
{
|
||||
result = rigState->voxFunc();
|
||||
result = rigState->getBool(VOXFUNC);
|
||||
}
|
||||
else if (command[1] == "TONE")
|
||||
{
|
||||
result = rigState->toneFunc();
|
||||
result = rigState->getBool(TONEFUNC);
|
||||
}
|
||||
else if (command[1] == "TSQL")
|
||||
{
|
||||
result = rigState->tsqlFunc();
|
||||
result = rigState->getBool(TSQLFUNC);
|
||||
}
|
||||
else if (command[1] == "SBKIN")
|
||||
{
|
||||
result = rigState->sbkinFunc();
|
||||
result = rigState->getBool(SBKINFUNC);
|
||||
}
|
||||
else if (command[1] == "FBKIN")
|
||||
{
|
||||
result = rigState->fbkinFunc();
|
||||
result = rigState->getBool(FBKINFUNC);
|
||||
}
|
||||
else if (command[1] == "ANF")
|
||||
{
|
||||
result = rigState->anfFunc();
|
||||
result = rigState->getBool (ANFFUNC);
|
||||
}
|
||||
else if (command[1] == "NR")
|
||||
{
|
||||
result = rigState->nrFunc();
|
||||
result = rigState->getBool(NRFUNC);
|
||||
}
|
||||
else if (command[1] == "AIP")
|
||||
{
|
||||
result = rigState->aipFunc();
|
||||
result = rigState->getBool(AIPFUNC);
|
||||
}
|
||||
else if (command[1] == "APF")
|
||||
{
|
||||
result = rigState->apfFunc();
|
||||
result = rigState->getBool(APFFUNC);
|
||||
}
|
||||
else if (command[1] == "MON")
|
||||
{
|
||||
result = rigState->monFunc();
|
||||
result = rigState->getBool(MONFUNC);
|
||||
}
|
||||
else if (command[1] == "MN")
|
||||
{
|
||||
result = rigState->mnFunc();
|
||||
result = rigState->getBool(MNFUNC);
|
||||
}
|
||||
else if (command[1] == "RF")
|
||||
{
|
||||
result = rigState->rfFunc();
|
||||
result = rigState->getBool(RFFUNC);
|
||||
}
|
||||
else if (command[1] == "ARO")
|
||||
{
|
||||
result = rigState->aroFunc();
|
||||
result = rigState->getBool(AROFUNC);
|
||||
}
|
||||
else if (command[1] == "MUTE")
|
||||
{
|
||||
result = rigState->muteFunc();
|
||||
result = rigState->getBool(MUTEFUNC);
|
||||
}
|
||||
else if (command[1] == "VSC")
|
||||
{
|
||||
result = rigState->vscFunc();
|
||||
result = rigState->getBool(VSCFUNC);
|
||||
}
|
||||
else if (command[1] == "REV")
|
||||
{
|
||||
result = rigState->revFunc();
|
||||
result = rigState->getBool(REVFUNC);
|
||||
}
|
||||
else if (command[1] == "SQL")
|
||||
{
|
||||
result = rigState->sqlFunc();
|
||||
result = rigState->getBool(SQLFUNC);
|
||||
}
|
||||
else if (command[1] == "ABM")
|
||||
{
|
||||
result = rigState->abmFunc();
|
||||
result = rigState->getBool(ABMFUNC);
|
||||
}
|
||||
else if (command[1] == "BC")
|
||||
{
|
||||
result = rigState->bcFunc();
|
||||
result = rigState->getBool(BCFUNC);
|
||||
}
|
||||
else if (command[1] == "MBC")
|
||||
{
|
||||
result = rigState->mbcFunc();
|
||||
result = rigState->getBool(MBCFUNC);
|
||||
}
|
||||
else if (command[1] == "RIT")
|
||||
{
|
||||
result = rigState->ritFunc();
|
||||
result = rigState->getBool(RITFUNC);
|
||||
}
|
||||
else if (command[1] == "AFC")
|
||||
{
|
||||
result = rigState->afcFunc();
|
||||
result = rigState->getBool(AFCFUNC);
|
||||
}
|
||||
else if (command[1] == "SATMODE")
|
||||
{
|
||||
result = rigState->satmodeFunc();
|
||||
result = rigState->getBool(SATMODEFUNC);
|
||||
}
|
||||
else if (command[1] == "SCOPE")
|
||||
{
|
||||
result = rigState->scopeFunc();
|
||||
result = rigState->getBool(SCOPEFUNC);
|
||||
}
|
||||
else if (command[1] == "RESUME")
|
||||
{
|
||||
result = rigState->resumeFunc();
|
||||
result = rigState->getBool(RESUMEFUNC);
|
||||
}
|
||||
else if (command[1] == "TBURST")
|
||||
{
|
||||
result = rigState->tburstFunc();
|
||||
result = rigState->getBool(TBURSTFUNC);
|
||||
}
|
||||
else if (command[1] == "TUNER")
|
||||
{
|
||||
result = rigState->tunerFunc();
|
||||
result = rigState->getBool(TUNERFUNC);
|
||||
}
|
||||
else if (command[1] == "LOCK")
|
||||
{
|
||||
result = rigState->lockFunc();
|
||||
result = rigState->getBool(LOCKFUNC);
|
||||
}
|
||||
else {
|
||||
qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1];
|
||||
}
|
||||
|
||||
resp.append(QString("%1").arg(result));
|
||||
response.append(resp);
|
||||
}
|
||||
|
@ -856,127 +881,127 @@ void rigCtlClient::socketReadyRead()
|
|||
|
||||
if (command[1] == "FAGC")
|
||||
{
|
||||
rigState->fagcFunc((bool)command[2].toInt(),FAGCFUNC);
|
||||
rigState->set(FAGCFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "NB")
|
||||
{
|
||||
rigState->nbFunc((bool)command[2].toInt(),NBFUNC);
|
||||
rigState->set(NBFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "COMP")
|
||||
{
|
||||
rigState->compFunc((bool)command[2].toInt(),COMPFUNC);
|
||||
rigState->set(COMPFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "VOX")
|
||||
{
|
||||
rigState->voxFunc((bool)command[2].toInt(),VOXFUNC);
|
||||
rigState->set(VOXFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "TONE")
|
||||
{
|
||||
rigState->toneFunc((bool)command[2].toInt(),TONEFUNC);
|
||||
rigState->set(TONEFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "TSQL")
|
||||
{
|
||||
rigState->tsqlFunc((bool)command[2].toInt(),TSQLFUNC);
|
||||
rigState->set(TSQLFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "SBKIN")
|
||||
{
|
||||
rigState->sbkinFunc((bool)command[2].toInt(),SBKINFUNC);
|
||||
rigState->set(SBKINFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "FBKIN")
|
||||
{
|
||||
rigState->fbkinFunc((bool)command[2].toInt(),FBKINFUNC);
|
||||
rigState->set(FBKINFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "ANF")
|
||||
{
|
||||
rigState->anfFunc((bool)command[2].toInt(),ANFFUNC);
|
||||
rigState->set(ANFFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "NR")
|
||||
{
|
||||
rigState->nrFunc((bool)command[2].toInt(),NRFUNC);
|
||||
rigState->set(NRFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "AIP")
|
||||
{
|
||||
rigState->aipFunc((bool)command[2].toInt(),AIPFUNC);
|
||||
rigState->set(AIPFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "APF")
|
||||
{
|
||||
rigState->apfFunc((bool)command[2].toInt(),APFFUNC);
|
||||
rigState->set(APFFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "MON")
|
||||
{
|
||||
rigState->monFunc((bool)command[2].toInt(),MONFUNC);
|
||||
rigState->set(MONFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "MN")
|
||||
{
|
||||
rigState->mnFunc((bool)command[2].toInt(),MNFUNC);
|
||||
rigState->set(MNFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "RF")
|
||||
{
|
||||
rigState->rfFunc((bool)command[2].toInt(),MONFUNC);
|
||||
rigState->set(RFFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "ARO")
|
||||
{
|
||||
rigState->aroFunc((bool)command[2].toInt(),AROFUNC);
|
||||
rigState->set(AROFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "MUTE")
|
||||
{
|
||||
rigState->muteFunc((bool)command[2].toInt(),MUTEFUNC);
|
||||
rigState->set(MUTEFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "VSC")
|
||||
{
|
||||
rigState->vscFunc((bool)command[2].toInt(),VSCFUNC);
|
||||
rigState->set(VSCFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "REV")
|
||||
{
|
||||
rigState->revFunc((bool)command[2].toInt(),REVFUNC);
|
||||
rigState->set(REVFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "SQL")
|
||||
{
|
||||
rigState->sqlFunc((bool)command[2].toInt(),SQLFUNC);
|
||||
rigState->set(SQLFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "ABM")
|
||||
{
|
||||
rigState->abmFunc((bool)command[2].toInt(),ABMFUNC);
|
||||
rigState->set(ABMFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "BC")
|
||||
{
|
||||
rigState->bcFunc((bool)command[2].toInt(),BCFUNC);
|
||||
rigState->set(BCFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "MBC")
|
||||
{
|
||||
rigState->mbcFunc((bool)command[2].toInt(),MBCFUNC);
|
||||
rigState->set(MBCFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "RIT")
|
||||
{
|
||||
rigState->ritFunc((bool)command[2].toInt(),RITFUNC);
|
||||
rigState->set(RITFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "AFC")
|
||||
{
|
||||
rigState->afcFunc((bool)command[2].toInt(),AFCFUNC);
|
||||
rigState->set(AFCFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "SATMODE")
|
||||
{
|
||||
rigState->satmodeFunc((bool)command[2].toInt(),SATMODEFUNC);
|
||||
rigState->set(SATMODEFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "SCOPE")
|
||||
{
|
||||
rigState->scopeFunc((bool)command[2].toInt(),SCOPEFUNC);
|
||||
rigState->set(SCOPEFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "RESUME")
|
||||
{
|
||||
rigState->resumeFunc((bool)command[2].toInt(),RESUMEFUNC);
|
||||
rigState->set(RESUMEFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "TBURST")
|
||||
{
|
||||
rigState->tburstFunc((bool)command[2].toInt(),TBURSTFUNC);
|
||||
rigState->set(TBURSTFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "TUNER")
|
||||
{
|
||||
rigState->tunerFunc((bool)command[2].toInt(),TUNERFUNC);
|
||||
rigState->set(TUNERFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else if (command[1] == "LOCK")
|
||||
{
|
||||
rigState->lockFunc((bool)command[2].toInt(),LOCKFUNC);
|
||||
rigState->set(LOCKFUNC, (quint8)command[2].toInt(), true);
|
||||
}
|
||||
else {
|
||||
qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1] << command[2];
|
||||
|
@ -984,7 +1009,7 @@ void rigCtlClient::socketReadyRead()
|
|||
|
||||
qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2];
|
||||
}
|
||||
else if (command.length() > 1 && (command[0] == 0x88 || command[0] == "get_powerstat"))
|
||||
else if (command.length() > 0 && (command[0] == 0x88 || command[0] == "get_powerstat"))
|
||||
{
|
||||
|
||||
QString resp;
|
||||
|
|
324
rigstate.h
324
rigstate.h
|
@ -1,8 +1,12 @@
|
|||
#ifndef RIGSTATE_H
|
||||
#define RIGSTATE_H
|
||||
#ifndef RIGSTATEH
|
||||
#define RIGSTATEH
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QDateTime>
|
||||
#include <QVariant>
|
||||
#include <QMap>
|
||||
#include <QCache>
|
||||
|
||||
#include "rigcommander.h"
|
||||
|
||||
|
@ -11,254 +15,100 @@ enum stateTypes { NONE, VFOAFREQ, VFOBFREQ, CURRENTVFO, PTT, MODE, FILTER, DUPLE
|
|||
PREAMP, AGC, ATTENUATOR, MODINPUT, AFGAIN, RFGAIN, SQUELCH, TXPOWER, MICGAIN, COMPLEVEL, MONITORLEVEL, VOXGAIN, ANTIVOXGAIN,
|
||||
FAGCFUNC, NBFUNC, COMPFUNC, VOXFUNC, TONEFUNC, TSQLFUNC, SBKINFUNC, FBKINFUNC, ANFFUNC, NRFUNC, AIPFUNC, APFFUNC, MONFUNC, MNFUNC,RFFUNC,
|
||||
AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC,
|
||||
RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER };
|
||||
NBLEVEL, NBDEPTH, NBWIDTH, NRLEVEL,
|
||||
RESUMEFUNC, TBURSTFUNC, TUNERFUNC, LOCKFUNC, SMETER, POWERMETER, SWRMETER, ALCMETER, COMPMETER, VOLTAGEMETER, CURRENTMETER
|
||||
};
|
||||
|
||||
struct value {
|
||||
quint64 _value=0;
|
||||
bool _valid = false;
|
||||
bool _updated = false;
|
||||
QDateTime _dateUpdated;
|
||||
};
|
||||
|
||||
class rigstate
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
void lock() { _mutex.lock(); return; }
|
||||
void unlock() { _mutex.unlock(); return; }
|
||||
void invalidate(stateTypes s) { map[s]._valid = false; }
|
||||
bool isValid(stateTypes s) { return map[s]._valid; }
|
||||
bool isUpdated(stateTypes s) { return map[s]._updated; }
|
||||
QDateTime whenUpdated(stateTypes s) { return map[s]._dateUpdated; }
|
||||
|
||||
quint64 updated() { return _updated; }
|
||||
void updated(int update) { _mutex.lock(); _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
void set(stateTypes s, quint64 x, bool u) {
|
||||
if (x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
void set(stateTypes s, quint32 x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
void set(stateTypes s, quint16 x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
void set(stateTypes s, quint8 x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
void set(stateTypes s, bool x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
void set(stateTypes s, duplexMode x, bool u) {
|
||||
if ((quint64)x != map[s]._value) {
|
||||
_mutex.lock();
|
||||
map[s]._value = (quint64)x;
|
||||
map[s]._valid = true;
|
||||
map[s]._updated = u;
|
||||
map[s]._dateUpdated = QDateTime::currentDateTime();
|
||||
_mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
quint64 vfoAFreq() { return _vfoAFreq; }
|
||||
void vfoAFreq(quint64 vfoAFreq, int update) { _mutex.lock(); _vfoAFreq = vfoAFreq; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
quint64 vfoBFreq() { return _vfoBFreq; }
|
||||
void vfoBFreq(quint64 vfoBFreq, int update) { _mutex.lock(); _vfoBFreq = vfoBFreq; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
unsigned char currentVfo() { return _currentVfo; }
|
||||
void currentVfo(unsigned char currentVfo, int update) { _mutex.lock(); _currentVfo = currentVfo; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
bool ptt() { return _ptt; }
|
||||
void ptt(bool ptt, int update) { _mutex.lock(); _ptt = ptt; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
unsigned char mode() { return _mode; }
|
||||
void mode(unsigned char mode, int update) { _mutex.lock(); _mode = mode; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
unsigned char filter() { return _filter; }
|
||||
void filter(unsigned char filter, int update) { _mutex.lock(); _filter = filter; _updated |= 1ULL << update; _mutex.unlock();}
|
||||
|
||||
duplexMode duplex() { return _duplex; }
|
||||
void duplex(duplexMode duplex, int update) { _mutex.lock(); _duplex = duplex; _updated |= 1ULL << update; _mutex.unlock();}
|
||||
|
||||
bool datamode() { return _datamode; }
|
||||
void datamode(bool datamode, int update) { _mutex.lock(); _datamode = datamode; _updated |= 1ULL << update; _mutex.unlock();}
|
||||
|
||||
unsigned char antenna() { return _antenna; }
|
||||
void antenna(unsigned char antenna, int update) { _mutex.lock(); _antenna = antenna; _updated |= 1ULL << update; _mutex.unlock();}
|
||||
|
||||
bool rxAntenna() { return _rxAntenna; }
|
||||
void rxAntenna(bool rxAntenna, int update) { _mutex.lock(); _rxAntenna = rxAntenna; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
quint16 ctcss() { return _ctcss; }
|
||||
void ctcss(quint16 ctcss, int update) { _mutex.lock(); _ctcss = ctcss; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
quint16 tsql() { return _tsql; }
|
||||
void tsql(quint16 tsql, int update) { _mutex.lock(); _tsql = tsql; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
quint16 dtcs() { return _dtcs; }
|
||||
void dtcs(quint16 dtcs, int update) { _mutex.lock(); _dtcs = dtcs; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
quint16 csql() { return _csql; }
|
||||
void csql(quint16 csql, int update) { _mutex.lock(); _csql = csql; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
unsigned char preamp() { return _preamp; }
|
||||
void preamp(unsigned char preamp, int update) { _mutex.lock(); _preamp = preamp; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char agc() { return _agc; }
|
||||
void agc(unsigned char agc, int update) { _mutex.lock(); _agc = agc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char attenuator() { return _attenuator; }
|
||||
void attenuator(unsigned char attenuator, int update) { _mutex.lock(); _attenuator = attenuator; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char modInput() { return _modInput; }
|
||||
void modInput(unsigned char modInput, int update) { _mutex.lock(); _modInput = modInput; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char afGain() { return _afGain; }
|
||||
void afGain(unsigned char afGain, int update) { _mutex.lock(); _afGain = afGain; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char rfGain() { return _rfGain; }
|
||||
void rfGain(unsigned char rfGain, int update) { _mutex.lock(); _rfGain = rfGain; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char squelch() { return _squelch; }
|
||||
void squelch(unsigned char squelch, int update) { _mutex.lock(); _squelch = squelch; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char txPower() { return _txPower; }
|
||||
void txPower(unsigned char txPower, int update) { _mutex.lock(); _txPower = txPower; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char micGain() { return _micGain; }
|
||||
void micGain(unsigned char micGain, int update) { _mutex.lock(); _micGain = micGain; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char compLevel() { return _compLevel; }
|
||||
void compLevel(unsigned char compLevel, int update) { _mutex.lock(); _compLevel = compLevel; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char monitorLevel() { return _monitorLevel; }
|
||||
void monitorLevel(unsigned char monitorLevel, int update) { _mutex.lock(); _monitorLevel = monitorLevel; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char voxGain() { return _voxGain; }
|
||||
void voxGain(unsigned char voxGain, int update) { _mutex.lock(); _voxGain = voxGain; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char antiVoxGain() { return _antiVoxGain; }
|
||||
void antiVoxGain(unsigned char antiVoxGain, int update) { _mutex.lock(); _antiVoxGain = antiVoxGain; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char nbLevel() { return _nbLevel; }
|
||||
void nbLevel(unsigned char nbLevel, int update) { _mutex.lock(); _nbLevel = nbLevel; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char nbDepth() { return _nbDepth; }
|
||||
void nbDepth(unsigned char nbDepth, int update) { _mutex.lock(); _nbDepth = nbDepth; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char nbWidth() { return _nbWidth; }
|
||||
void nbWidth(unsigned char nbWidth, int update) { _mutex.lock(); _nbWidth = nbWidth; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char nrLevel() { return _nrLevel; }
|
||||
void nrLevel(unsigned char nrLevel, int update) { _mutex.lock(); _nrLevel = nrLevel; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
unsigned char sMeter() { return _sMeter; }
|
||||
void sMeter(unsigned char sMeter, int update) { _mutex.lock(); _sMeter = sMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char powerMeter() { return _powerMeter; }
|
||||
void powerMeter(unsigned char powerMeter, int update) { _mutex.lock(); _powerMeter = powerMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char swrMeter() { return _swrMeter; }
|
||||
void swrMeter(unsigned char swrMeter, int update) { _mutex.lock(); _swrMeter = swrMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char alcMeter() { return _alcMeter; }
|
||||
void alcMeter(unsigned char alcMeter, int update) { _mutex.lock(); _alcMeter = alcMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char compMeter() { return _compMeter; }
|
||||
void compMeter(unsigned char compMeter, int update) { _mutex.lock(); _compMeter = compMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char voltageMeter() { return _voltageMeter; }
|
||||
void voltageMeter(unsigned char voltageMeter, int update) { _mutex.lock(); _voltageMeter = voltageMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
unsigned char currentMeter() { return _currentMeter; }
|
||||
void currentMeter(unsigned char currentMeter, int update) { _mutex.lock(); _currentMeter = currentMeter; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
/*FAGCFUNC, NBFUNC, COMPFUNC, VOXFUNC, TONEFUNC, TSQLFUNC, SBKINFUNC, FBKINFUNC, ANFFUNC, NRFUNC, AIPFUNC, APFFUNC, MONFUNC, MNFUNC,RFFUNC,
|
||||
*/
|
||||
bool fagcFunc() { return _fagcFunc; }
|
||||
void fagcFunc(bool fagcFunc, int update) { _mutex.lock(); _fagcFunc = fagcFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool nbFunc() { return _nbFunc; }
|
||||
void nbFunc(bool nbFunc, int update) { _mutex.lock(); _nbFunc = nbFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool compFunc() { return _compFunc; }
|
||||
void compFunc(bool compFunc, int update) { _mutex.lock(); _compFunc = compFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool voxFunc() { return _voxFunc; }
|
||||
void voxFunc(bool voxFunc, int update) { _mutex.lock(); _voxFunc = voxFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool toneFunc() { return _toneFunc; }
|
||||
void toneFunc(bool toneFunc, int update) { _mutex.lock(); _toneFunc = toneFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool tsqlFunc() { return _tsqlFunc; }
|
||||
void tsqlFunc(bool tsqlFunc, int update) { _mutex.lock(); _tsqlFunc = tsqlFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool sbkinFunc() { return _sbkinFunc; }
|
||||
void sbkinFunc(bool sbkinFunc, int update) { _mutex.lock(); _sbkinFunc = sbkinFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool fbkinFunc() { return _fbkinFunc; }
|
||||
void fbkinFunc(bool fbkinFunc, int update) { _mutex.lock(); _fbkinFunc = fbkinFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool anfFunc() { return _anfFunc; }
|
||||
void anfFunc(bool anfFunc, int update) { _mutex.lock(); _anfFunc = anfFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool nrFunc() { return _nrFunc; }
|
||||
void nrFunc(bool nrFunc, int update) { _mutex.lock(); _nrFunc = nrFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool aipFunc() { return _aipFunc; }
|
||||
void aipFunc(bool aipFunc, int update) { _mutex.lock(); _aipFunc = aipFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool apfFunc() { return _apfFunc; }
|
||||
void apfFunc(bool apfFunc, int update) { _mutex.lock(); _apfFunc = apfFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool monFunc() { return _monFunc; }
|
||||
void monFunc(bool monFunc, int update) { _mutex.lock(); _monFunc = monFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool mnFunc() { return _mnFunc; }
|
||||
void mnFunc(bool mnFunc, int update) { _mutex.lock(); _mnFunc = mnFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool rfFunc() { return _rfFunc; }
|
||||
void rfFunc(bool rfFunc, int update) { _mutex.lock(); _rfFunc = rfFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
|
||||
/* AROFUNC, MUTEFUNC, VSCFUNC, REVFUNC, SQLFUNC, ABMFUNC, BCFUNC, MBCFUNC, RITFUNC, AFCFUNC, SATMODEFUNC, SCOPEFUNC,
|
||||
RESUMEFUNC, TBURSTFUNC, TUNERFUNC}; */
|
||||
bool aroFunc() { return _aroFunc; }
|
||||
void aroFunc(bool aroFunc, int update) { _mutex.lock(); _aroFunc = aroFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool muteFunc() { return _muteFunc; }
|
||||
void muteFunc(bool muteFunc, int update) { _mutex.lock(); _muteFunc = muteFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool vscFunc() { return _vscFunc; }
|
||||
void vscFunc(bool vscFunc, int update) { _mutex.lock(); _vscFunc = vscFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool revFunc() { return _revFunc; }
|
||||
void revFunc(bool revFunc, int update) { _mutex.lock(); _revFunc = revFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool sqlFunc() { return _sqlFunc; }
|
||||
void sqlFunc(bool sqlFunc, int update) { _mutex.lock(); _sqlFunc = sqlFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool abmFunc() { return _abmFunc; }
|
||||
void abmFunc(bool abmFunc, int update) { _mutex.lock(); _abmFunc = abmFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool bcFunc() { return _bcFunc; }
|
||||
void bcFunc(bool bcFunc, int update) { _mutex.lock(); _bcFunc = bcFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool mbcFunc() { return _mbcFunc; }
|
||||
void mbcFunc(bool mbcFunc, int update) { _mutex.lock(); _mbcFunc = mbcFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool ritFunc() { return _ritFunc; }
|
||||
void ritFunc(bool ritFunc, int update) { _mutex.lock(); _ritFunc = ritFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool afcFunc() { return _afcFunc; }
|
||||
void afcFunc(bool afcFunc, int update) { _mutex.lock(); _afcFunc = afcFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool satmodeFunc() { return _satmodeFunc; }
|
||||
void satmodeFunc(bool satmodeFunc, int update) { _mutex.lock(); _satmodeFunc = satmodeFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool scopeFunc() { return _scopeFunc; }
|
||||
void scopeFunc(bool scopeFunc, int update) { _mutex.lock(); _scopeFunc = scopeFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool resumeFunc() { return _resumeFunc; }
|
||||
void resumeFunc(bool resumeFunc, int update) { _mutex.lock(); _resumeFunc = resumeFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool tburstFunc() { return _tburstFunc; }
|
||||
void tburstFunc(bool tburstFunc, int update) { _mutex.lock(); _tburstFunc = tburstFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool tunerFunc() { return _tunerFunc; }
|
||||
void tunerFunc(bool tunerFunc, int update) { _mutex.lock(); _tunerFunc = tunerFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool lockFunc() { return _lockFunc; }
|
||||
void lockFunc(bool lockFunc, int update) { _mutex.lock(); _lockFunc = lockFunc; _updated |= 1ULL << update; _mutex.unlock(); }
|
||||
bool getBool(stateTypes s) { return map[s]._value != 0; }
|
||||
quint8 getChar(stateTypes s) { return map[s]._value & 0xff; }
|
||||
quint16 getInt16(stateTypes s) { return map[s]._value != 0xffff; }
|
||||
quint32 getInt32(stateTypes s) { return map[s]._value != 0xffffffff; }
|
||||
quint64 getInt64(stateTypes s) { return map[s]._value; }
|
||||
duplexMode getDuplex(stateTypes s) { return(duplexMode)map[s]._value; }
|
||||
QMap<stateTypes, value> map;
|
||||
|
||||
|
||||
private:
|
||||
//std::map<stateTypes, std::unique_ptr<valueBase> > values;
|
||||
QMutex _mutex;
|
||||
quint64 _updated=0;
|
||||
quint64 _vfoAFreq=0;
|
||||
quint64 _vfoBFreq=0;
|
||||
unsigned char _currentVfo=0;
|
||||
bool _ptt=0;
|
||||
unsigned char _mode=0;
|
||||
unsigned char _filter=0;
|
||||
duplexMode _duplex;
|
||||
bool _datamode=0;
|
||||
unsigned char _antenna=0;
|
||||
bool _rxAntenna=0;
|
||||
// Tones
|
||||
quint16 _ctcss;
|
||||
quint16 _tsql;
|
||||
quint16 _dtcs;
|
||||
quint16 _csql;
|
||||
// Levels
|
||||
unsigned char _preamp;
|
||||
unsigned char _agc;
|
||||
unsigned char _attenuator;
|
||||
unsigned char _modInput;
|
||||
unsigned char _afGain;
|
||||
unsigned char _rfGain;
|
||||
unsigned char _squelch;
|
||||
unsigned char _txPower;
|
||||
unsigned char _micGain;
|
||||
unsigned char _compLevel;
|
||||
unsigned char _monitorLevel;
|
||||
unsigned char _voxGain;
|
||||
unsigned char _antiVoxGain;
|
||||
unsigned char _nrLevel;
|
||||
unsigned char _nbLevel;
|
||||
unsigned char _nbDepth;
|
||||
unsigned char _nbWidth;
|
||||
// Meters
|
||||
unsigned char _sMeter;
|
||||
unsigned char _powerMeter;
|
||||
unsigned char _swrMeter;
|
||||
unsigned char _alcMeter;
|
||||
unsigned char _compMeter;
|
||||
unsigned char _voltageMeter;
|
||||
unsigned char _currentMeter;
|
||||
// Functions
|
||||
bool _fagcFunc = false;
|
||||
bool _nbFunc = false;
|
||||
bool _compFunc = false;
|
||||
bool _voxFunc = false;
|
||||
bool _toneFunc = false;
|
||||
bool _tsqlFunc = false;
|
||||
bool _sbkinFunc = false;
|
||||
bool _fbkinFunc = false;
|
||||
bool _anfFunc = false;
|
||||
bool _nrFunc = false;
|
||||
bool _aipFunc = false;
|
||||
bool _apfFunc = false;
|
||||
bool _monFunc = false;
|
||||
bool _mnFunc = false;
|
||||
bool _rfFunc = false;
|
||||
bool _aroFunc = false;
|
||||
bool _muteFunc = false;
|
||||
bool _vscFunc = false;
|
||||
bool _revFunc = false;
|
||||
bool _sqlFunc = false;
|
||||
bool _abmFunc = false;
|
||||
bool _bcFunc = false;
|
||||
bool _mbcFunc = false;
|
||||
bool _ritFunc = false;
|
||||
bool _afcFunc = false;
|
||||
bool _satmodeFunc = false;
|
||||
bool _scopeFunc = false;
|
||||
bool _resumeFunc = false;
|
||||
bool _tburstFunc = false;
|
||||
bool _tunerFunc = false;
|
||||
bool _lockFunc = false;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Ładowanie…
Reference in New Issue