diff --git a/rigcommander.cpp b/rigcommander.cpp index a36915a..9c7653d 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -27,6 +27,7 @@ rigCommander::rigCommander() rigState.ptt = 0; rigState.currentVfo = 0; rigState.duplex = dmSplitOff; + } rigCommander::~rigCommander() diff --git a/rigcommander.h b/rigcommander.h index 1539aa3..1de8bc3 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -96,6 +96,38 @@ struct rigStateStruct { unsigned char compMeter; unsigned char voltageMeter; unsigned char currentMeter; + // Functions + bool fagcFunc=false; + bool nbFunc=false; + bool compFunc=false; + bool voxFunc = false; + bool toneFunc = false; + bool tsqlFunc = false; + bool sbkinFunc = false; + bool fbkinFunc = false; + bool anfFunc = false; + bool nrFunc = false; + bool aipFunc = false; + bool apfFunc = false; + bool monFunc = false; + bool mnFunc = false; + bool rfFunc = false; + bool aroFunc = false; + bool muteFunc = false; + bool vscFunc = false; + bool revFunc = false; + bool sqlFunc = false; + bool abmFunc = false; + bool bcFunc = false; + bool mbcFunc = false; + bool ritFunc = false; + bool afcFunc = false; + bool satmodeFunc = false; + bool scopeFunc = false; + bool resumeFunc = false; + bool tburstFunc = false; + bool tunerFunc = false; + bool lockFunc = false; }; class rigCommander : public QObject diff --git a/rigctld.cpp b/rigctld.cpp index 00e901e..ae4a6c3 100644 --- a/rigctld.cpp +++ b/rigctld.cpp @@ -646,19 +646,275 @@ void rigCtlClient::socketReadyRead() qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2] << value; } - else if (command[0] == "u" || command[0] == "get_func") + else if (command.length()>1 && (command[0] == "u" || command[0] == "get_func")) { QString resp=""; - if (longReply ) { + bool result = 0; + if (longReply) { resp.append(QString("Func Status: ")); } - resp.append("0"); + + if (command[1] == "FAGC") + { + result=rigState->fagcFunc; + } + else if (command[1] == "NB") + { + result=rigState->nbFunc; + } + else if (command[1] == "COMP") + { + result=rigState->compFunc; + } + else if (command[1] == "VOX") + { + result = rigState->voxFunc; + } + else if (command[1] == "TONE") + { + result = rigState->toneFunc; + } + else if (command[1] == "TSQL") + { + result = rigState->tsqlFunc; + } + else if (command[1] == "SBKIN") + { + result = rigState->sbkinFunc; + } + else if (command[1] == "FBKIN") + { + result = rigState->fbkinFunc; + } + else if (command[1] == "ANF") + { + result = rigState->anfFunc; + } + else if (command[1] == "NR") + { + result = rigState->nrFunc; + } + else if (command[1] == "AIP") + { + result = rigState->aipFunc; + } + else if (command[1] == "APF") + { + result = rigState->apfFunc; + } + else if (command[1] == "MON") + { + result = rigState->monFunc; + } + else if (command[1] == "MN") + { + result = rigState->mnFunc; + } + else if (command[1] == "RF") + { + result = rigState->rfFunc; + } + else if (command[1] == "ARO") + { + result = rigState->aroFunc; + } + else if (command[1] == "MUTE") + { + result = rigState->muteFunc; + } + else if (command[1] == "VSC") + { + result = rigState->vscFunc; + } + else if (command[1] == "REV") + { + result = rigState->revFunc; + } + else if (command[1] == "SQL") + { + result = rigState->sqlFunc; + } + else if (command[1] == "ABM") + { + result = rigState->abmFunc; + } + else if (command[1] == "BC") + { + result = rigState->bcFunc; + } + else if (command[1] == "MBC") + { + result = rigState->mbcFunc; + } + else if (command[1] == "RIT") + { + result = rigState->ritFunc; + } + else if (command[1] == "AFC") + { + result = rigState->afcFunc; + } + else if (command[1] == "SATMODE") + { + result = rigState->satmodeFunc; + } + else if (command[1] == "SCOPE") + { + result = rigState->scopeFunc; + } + else if (command[1] == "RESUME") + { + result = rigState->resumeFunc; + } + else if (command[1] == "TBURST") + { + result = rigState->tburstFunc; + } + else if (command[1] == "TUNER") + { + result = rigState->tunerFunc; + } + else if (command[1] == "LOCK") + { + result = rigState->lockFunc; + } + else { + qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1]; + } + + resp.append(QString("%1").arg(result)); response.append(resp); } - else if (command[0] == "R" || command[0] == "set_func") + else if (command.length() >2 && (command[0] == "U" || command[0] == "set_func")) { - setCommand = true; - if (command.length()>2) + setCommand = true; + if (command[1] == "FAGC") + { + rigState->fagcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "NB") + { + rigState->nbFunc = (bool)command[2].toInt(); + } + else if (command[1] == "COMP") + { + rigState->compFunc = (bool)command[2].toInt(); + } + else if (command[1] == "VOX") + { + rigState->voxFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TONE") + { + rigState->toneFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TSQL") + { + rigState->tsqlFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SBKIN") + { + rigState->sbkinFunc = (bool)command[2].toInt(); + } + else if (command[1] == "FBKIN") + { + rigState->fbkinFunc = (bool)command[2].toInt(); + } + else if (command[1] == "ANF") + { + rigState->anfFunc = (bool)command[2].toInt(); + } + else if (command[1] == "NR") + { + rigState->nrFunc = (bool)command[2].toInt(); + } + else if (command[1] == "AIP") + { + rigState->aipFunc = (bool)command[2].toInt(); + } + else if (command[1] == "APF") + { + rigState->apfFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MON") + { + rigState->monFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MN") + { + rigState->mnFunc = (bool)command[2].toInt(); + } + else if (command[1] == "RF") + { + rigState->rfFunc = (bool)command[2].toInt(); + } + else if (command[1] == "ARO") + { + rigState->aroFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MUTE") + { + rigState->muteFunc = (bool)command[2].toInt(); + } + else if (command[1] == "VSC") + { + rigState->vscFunc = (bool)command[2].toInt(); + } + else if (command[1] == "REV") + { + rigState->revFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SQL") + { + rigState->sqlFunc = (bool)command[2].toInt(); + } + else if (command[1] == "ABM") + { + rigState->abmFunc = (bool)command[2].toInt(); + } + else if (command[1] == "BC") + { + rigState->bcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "MBC") + { + rigState->mbcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "RIT") + { + rigState->ritFunc = (bool)command[2].toInt(); + } + else if (command[1] == "AFC") + { + rigState->afcFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SATMODE") + { + rigState->satmodeFunc = (bool)command[2].toInt(); + } + else if (command[1] == "SCOPE") + { + rigState->scopeFunc = (bool)command[2].toInt(); + } + else if (command[1] == "RESUME") + { + rigState->resumeFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TBURST") + { + rigState->tburstFunc = (bool)command[2].toInt(); + } + else if (command[1] == "TUNER") + { + rigState->tunerFunc = (bool)command[2].toInt(); + } + else if (command[1] == "LOCK") + { + rigState->lockFunc = (bool)command[2].toInt(); + } + else { + qInfo(logRigCtlD()) << "Unimplemented func:" << command[0] << command[1] << command[2]; + } qInfo(logRigCtlD()) << "Setting:" << command[1] << command[2]; } else if (command.length() > 1 && (command[0] == 0x88 || command[0] == "get_powerstat"))