kopia lustrzana https://gitlab.com/eliggett/wfview
More rigctld fixes
rodzic
ee2cf70dc0
commit
1e2a0db604
|
@ -25,6 +25,8 @@ rigCommander::rigCommander()
|
||||||
rigState.filter = 0;
|
rigState.filter = 0;
|
||||||
rigState.mode = 0;
|
rigState.mode = 0;
|
||||||
rigState.ptt = 0;
|
rigState.ptt = 0;
|
||||||
|
rigState.currentVfo = 0;
|
||||||
|
rigState.splitEnabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rigCommander::~rigCommander()
|
rigCommander::~rigCommander()
|
||||||
|
|
|
@ -62,9 +62,11 @@ struct timekind {
|
||||||
struct rigStateStruct {
|
struct rigStateStruct {
|
||||||
freqt vfoAFreq;
|
freqt vfoAFreq;
|
||||||
freqt vfoBFreq;
|
freqt vfoBFreq;
|
||||||
|
unsigned char currentVfo;
|
||||||
unsigned char ptt;
|
unsigned char ptt;
|
||||||
unsigned char mode;
|
unsigned char mode;
|
||||||
unsigned char filter;
|
unsigned char filter;
|
||||||
|
unsigned char splitEnabled;
|
||||||
bool datamode;
|
bool datamode;
|
||||||
// Tones
|
// Tones
|
||||||
quint16 ctcss;
|
quint16 ctcss;
|
||||||
|
|
95
rigctld.cpp
95
rigctld.cpp
|
@ -83,6 +83,7 @@ void rigCtlClient::socketReadyRead()
|
||||||
static QString sep = " ";
|
static QString sep = " ";
|
||||||
static int num = 0;
|
static int num = 0;
|
||||||
bool longReply = false;
|
bool longReply = false;
|
||||||
|
unsigned char responseCode = 0;
|
||||||
if (commandBuffer.endsWith('\n'))
|
if (commandBuffer.endsWith('\n'))
|
||||||
{
|
{
|
||||||
qDebug(logRigCtlD()) << sessionId << "command received" << commandBuffer;
|
qDebug(logRigCtlD()) << sessionId << "command received" << commandBuffer;
|
||||||
|
@ -108,17 +109,18 @@ void rigCtlClient::socketReadyRead()
|
||||||
else if (commandBuffer[num] == "+")
|
else if (commandBuffer[num] == "+")
|
||||||
{
|
{
|
||||||
sep = "\n";
|
sep = "\n";
|
||||||
}
|
num++;
|
||||||
|
|
||||||
else if (commandBuffer[num].toLower() == "q")
|
|
||||||
{
|
|
||||||
closeSocket();
|
|
||||||
}
|
}
|
||||||
else if (commandBuffer[num] == "#")
|
else if (commandBuffer[num] == "#")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (commandBuffer[num] == "\\")
|
else if (commandBuffer[num].toLower() == "q")
|
||||||
|
{
|
||||||
|
closeSocket();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandBuffer[num] == "\\")
|
||||||
{
|
{
|
||||||
num++;
|
num++;
|
||||||
longReply = true;
|
longReply = true;
|
||||||
|
@ -127,10 +129,7 @@ void rigCtlClient::socketReadyRead()
|
||||||
|
|
||||||
if (command[0] == 0xf0 || command[0]=="chk_vfo")
|
if (command[0] == 0xf0 || command[0]=="chk_vfo")
|
||||||
{
|
{
|
||||||
if (longReply)
|
sendData(QString("%1\n").arg(rigState->currentVfo));
|
||||||
sendData(QString("0\n"));
|
|
||||||
else
|
|
||||||
sendData(QString("0\n"));
|
|
||||||
}
|
}
|
||||||
else if (command[0] == "dump_state")
|
else if (command[0] == "dump_state")
|
||||||
{
|
{
|
||||||
|
@ -139,8 +138,13 @@ void rigCtlClient::socketReadyRead()
|
||||||
}
|
}
|
||||||
else if (command[0] == "f" || command[0] == "get_freq")
|
else if (command[0] == "f" || command[0] == "get_freq")
|
||||||
{
|
{
|
||||||
|
if (rigState->currentVfo == 0) {
|
||||||
sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz));
|
sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
sendData(QString("%1\n").arg(rigState->vfoBFreq.Hz));
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (command[0] == "F" || command[0] == "set_freq")
|
else if (command[0] == "F" || command[0] == "set_freq")
|
||||||
{
|
{
|
||||||
if (command.length()>1)
|
if (command.length()>1)
|
||||||
|
@ -154,17 +158,17 @@ void rigCtlClient::socketReadyRead()
|
||||||
qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]);
|
qInfo(logRigCtlD()) << QString("Set frequency: %1 (%2)").arg(freq.Hz).arg(command[1]);
|
||||||
emit parent->setFrequency(freq);
|
emit parent->setFrequency(freq);
|
||||||
}
|
}
|
||||||
sendData(QString("RPRT 0\n"));
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
}
|
}
|
||||||
else if (command[0] == "1" || command[0] == "dump_caps")
|
else if (command[0] == "1" || command[0] == "dump_caps")
|
||||||
{
|
{
|
||||||
dumpCaps(sep);
|
dumpCaps(sep);
|
||||||
}
|
}
|
||||||
else if (command[0] == "t")
|
else if (command[0] == "t" || command[0] == "get_ptt")
|
||||||
{
|
{
|
||||||
sendData(QString("%1\n").arg(rigState->ptt));
|
sendData(QString("%1\n").arg(rigState->ptt));
|
||||||
}
|
}
|
||||||
else if (command[0] == "T")
|
else if (command[0] == "T" || command[0] == "set_ptt")
|
||||||
{
|
{
|
||||||
if (command.length()>1 && command[1] == "0") {
|
if (command.length()>1 && command[1] == "0") {
|
||||||
emit parent->setPTT(false);
|
emit parent->setPTT(false);
|
||||||
|
@ -172,16 +176,73 @@ void rigCtlClient::socketReadyRead()
|
||||||
else {
|
else {
|
||||||
emit parent->setPTT(true);
|
emit parent->setPTT(true);
|
||||||
}
|
}
|
||||||
sendData(QString("RPRT 0\n"));
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
}
|
}
|
||||||
else if (command[0] == "v" || command[0] == "get_vfo")
|
else if (command[0] == "v" || command[0] == "get_vfo")
|
||||||
{
|
{
|
||||||
sendData(QString("VFOA\n"));
|
if (rigState->currentVfo == 0) {
|
||||||
|
sendData(QString("%1\n").arg("VFOA"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendData(QString("%1\n").arg("VFOB"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (command[0] == "V" || command[0] == "set_vfo")
|
||||||
|
{
|
||||||
|
qDebug(logRigCtlD()) << QString("Got VFO command: %1").arg(command[1]);
|
||||||
|
if (command.length() > 1 && command[1] == "VFOB") {
|
||||||
|
emit parent->setVFO(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit parent->setVFO(0);
|
||||||
|
}
|
||||||
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
|
}
|
||||||
|
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||||
|
{
|
||||||
|
sendData(QString("%1\n").arg(rigState->splitEnabled));
|
||||||
|
if (rigState->currentVfo == 0)
|
||||||
|
{
|
||||||
|
sendData(QString("%1\n").arg("VFOB"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendData(QString("%1\n").arg("VFOA"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (command[0] == "S" || command[0] == "set_split_vfo")
|
||||||
|
{
|
||||||
|
if (command.length() > 1 && command[1] == "1")
|
||||||
|
{
|
||||||
|
emit parent->setSplit(1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit parent->setSplit(0);
|
||||||
|
}
|
||||||
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
|
}
|
||||||
|
else if (command[0] == "i" || command[0] == "get_split_freq")
|
||||||
|
{
|
||||||
|
if (rigState->currentVfo == 0) {
|
||||||
|
sendData(QString("%1\n").arg(rigState->vfoBFreq.Hz));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendData(QString("%1\n").arg(rigState->vfoAFreq.Hz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (command[0] == "I" || command[0] == "set_split_freq")
|
||||||
|
{
|
||||||
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
}
|
}
|
||||||
else if (command[0] == "m" || command[0] == "get_mode")
|
else if (command[0] == "m" || command[0] == "get_mode")
|
||||||
{
|
{
|
||||||
|
if (longReply) {
|
||||||
|
sendData(QString("Mode: %1\nPassband: %2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter)));
|
||||||
|
}
|
||||||
|
else {
|
||||||
sendData(QString("%1\n%2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter)));
|
sendData(QString("%1\n%2\n").arg(getMode(rigState->mode, rigState->datamode)).arg(getFilter(rigState->mode, rigState->filter)));
|
||||||
}
|
}
|
||||||
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
|
}
|
||||||
else if (command[0] == "M" || command[0] == "set_mode")
|
else if (command[0] == "M" || command[0] == "set_mode")
|
||||||
{
|
{
|
||||||
// Set mode
|
// Set mode
|
||||||
|
@ -203,7 +264,7 @@ void rigCtlClient::socketReadyRead()
|
||||||
emit parent->setDataMode(false, 0x01);
|
emit parent->setDataMode(false, 0x01);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendData(QString("RPRT 0\n"));
|
sendData(QString("RPRT %1\n").arg(responseCode));
|
||||||
}
|
}
|
||||||
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
else if (command[0] == "s" || command[0] == "get_split_vfo")
|
||||||
{
|
{
|
||||||
|
@ -240,7 +301,6 @@ void rigCtlClient::sendData(QString data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void rigCtlClient::dumpCaps(QString sep)
|
void rigCtlClient::dumpCaps(QString sep)
|
||||||
{
|
{
|
||||||
sendData(QString("Caps dump for model: %1%2").arg(rigCaps.modelID).arg(sep));
|
sendData(QString("Caps dump for model: %1%2").arg(rigCaps.modelID).arg(sep));
|
||||||
|
@ -404,3 +464,4 @@ unsigned char rigCtlClient::getMode(QString modeString) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ signals:
|
||||||
void setPTT(bool state);
|
void setPTT(bool state);
|
||||||
void setMode(unsigned char mode, unsigned char modeFilter);
|
void setMode(unsigned char mode, unsigned char modeFilter);
|
||||||
void setDataMode(bool dataOn, unsigned char modeFilter);
|
void setDataMode(bool dataOn, unsigned char modeFilter);
|
||||||
|
void setVFO(unsigned char vfo);
|
||||||
|
void setSplit(unsigned char split);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void incomingConnection(qintptr socketDescriptor);
|
virtual void incomingConnection(qintptr socketDescriptor);
|
||||||
|
@ -75,7 +77,6 @@ private:
|
||||||
QString getMode(unsigned char mode, bool datamode);
|
QString getMode(unsigned char mode, bool datamode);
|
||||||
unsigned char getMode(QString modeString);
|
unsigned char getMode(QString modeString);
|
||||||
QString getFilter(unsigned char mode, unsigned char filter);
|
QString getFilter(unsigned char mode, unsigned char filter);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
10
wfmain.cpp
10
wfmain.cpp
|
@ -5274,6 +5274,16 @@ void wfmain::on_enableRigctldChk_clicked(bool checked)
|
||||||
prefs.enableRigCtlD = checked;
|
prefs.enableRigCtlD = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wfmain::on_rigctldPortTxt_editingFinished()
|
||||||
|
{
|
||||||
|
|
||||||
|
bool okconvert = false;
|
||||||
|
unsigned int port = ui->rigctldPortTxt->text().toUInt(&okconvert);
|
||||||
|
if (okconvert)
|
||||||
|
{
|
||||||
|
prefs.rigCtlPort = port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- DEBUG FUNCTION ---
|
// --- DEBUG FUNCTION ---
|
||||||
void wfmain::on_debugBtn_clicked()
|
void wfmain::on_debugBtn_clicked()
|
||||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -475,6 +475,8 @@ private slots:
|
||||||
|
|
||||||
void on_enableRigctldChk_clicked(bool checked);
|
void on_enableRigctldChk_clicked(bool checked);
|
||||||
|
|
||||||
|
void on_rigctldPortTxt_editingFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::wfmain *ui;
|
Ui::wfmain *ui;
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
Ładowanie…
Reference in New Issue