kopia lustrzana https://gitlab.com/eliggett/wfview
Add function to handle connect/disconnect
rodzic
3e149ee742
commit
4a8de3c0c9
|
@ -320,7 +320,7 @@ void commHandler::openPort()
|
||||||
qInfo(logSerial()) << "Could not open serial port " << portName << " , please restart.";
|
qInfo(logSerial()) << "Could not open serial port " << portName << " , please restart.";
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
serialError = true;
|
serialError = true;
|
||||||
emit havePortError(errorType(portName, "Could not open port. Please restart."));
|
emit havePortError(errorType(true, portName, "Could not open port. Please restart."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
48
wfmain.cpp
48
wfmain.cpp
|
@ -677,6 +677,7 @@ void wfmain::receiveFoundRigID(rigCapabilities rigCaps)
|
||||||
void wfmain::receivePortError(errorType err)
|
void wfmain::receivePortError(errorType err)
|
||||||
{
|
{
|
||||||
if (err.alert) {
|
if (err.alert) {
|
||||||
|
connectionHandler(false); // Force disconnect
|
||||||
QMessageBox::critical(this, err.device, err.message, QMessageBox::Ok);
|
QMessageBox::critical(this, err.device, err.message, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -5273,26 +5274,14 @@ void wfmain::on_connectBtn_clicked()
|
||||||
{
|
{
|
||||||
this->rigStatus->setText(""); // Clear status
|
this->rigStatus->setText(""); // Clear status
|
||||||
|
|
||||||
if (haveRigCaps) {
|
if (ui->connectBtn->text() == "Connect to Radio") {
|
||||||
emit sendCloseComm();
|
connectionHandler(true);
|
||||||
ui->connectBtn->setText("Connect to Radio");
|
|
||||||
ui->audioSystemCombo->setEnabled(true);
|
|
||||||
ui->audioSystemServerCombo->setEnabled(true);
|
|
||||||
haveRigCaps = false;
|
|
||||||
rigName->setText("NONE");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit sendCloseComm(); // Just in case there is a failed connection open.
|
connectionHandler(false);
|
||||||
if (ui->connectBtn->text() != "Cancel connection") {
|
|
||||||
openRig();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->connectBtn->setText("Connect to Radio");
|
|
||||||
ui->audioSystemCombo->setEnabled(true);
|
|
||||||
ui->audioSystemServerCombo->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->connectBtn->clearFocus();
|
ui->connectBtn->clearFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7681,3 +7670,28 @@ void wfmain::changePollTiming(int timing_ms, bool setUI)
|
||||||
ui->pollTimeMsSpin->blockSignals(false);
|
ui->pollTimeMsSpin->blockSignals(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wfmain::connectionHandler(bool connect)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!connect) {
|
||||||
|
emit sendCloseComm();
|
||||||
|
ui->connectBtn->setText("Connect to Radio");
|
||||||
|
ui->audioSystemCombo->setEnabled(true);
|
||||||
|
ui->audioSystemServerCombo->setEnabled(true);
|
||||||
|
haveRigCaps = false;
|
||||||
|
rigName->setText("NONE");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit sendCloseComm(); // Just in case there is a failed connection open.
|
||||||
|
if (ui->connectBtn->text() != "Cancel connection") {
|
||||||
|
openRig();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ui->connectBtn->setText("Connect to Radio");
|
||||||
|
ui->audioSystemCombo->setEnabled(true);
|
||||||
|
ui->audioSystemServerCombo->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -985,6 +985,8 @@ private:
|
||||||
void changeMode(mode_kind mode);
|
void changeMode(mode_kind mode);
|
||||||
void changeMode(mode_kind mode, bool dataOn);
|
void changeMode(mode_kind mode, bool dataOn);
|
||||||
|
|
||||||
|
void connectionHandler(bool connect);
|
||||||
|
|
||||||
cmds meterKindToMeterCommand(meterKind m);
|
cmds meterKindToMeterCommand(meterKind m);
|
||||||
|
|
||||||
int oldFreqDialVal;
|
int oldFreqDialVal;
|
||||||
|
|
Ładowanie…
Reference in New Issue