1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Report to GUI if failed to open VISA device

This commit is contained in:
Jon Beniston 2021-06-09 17:23:37 +01:00
parent 5d24bf9086
commit ae88a7e584
3 changed files with 18 additions and 11 deletions

View File

@ -120,10 +120,11 @@ void NoiseFigure::stop()
m_thread.wait();
}
void NoiseFigure::openVISADevice()
bool NoiseFigure::openVISADevice()
{
m_visa.openDefault();
m_session = m_visa.open(m_settings.m_visaDevice);
return m_session != 0;
}
void NoiseFigure::closeVISADevice()
@ -406,8 +407,18 @@ bool NoiseFigure::handleMessage(const Message& cmd)
{
if (m_state == IDLE)
{
openVISADevice();
if (!m_settings.m_visaDevice.isEmpty())
{
if (openVISADevice()) {
QTimer::singleShot(0, this, SLOT(nextState()));
} else if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(MsgFinished::create(QString("Failed to open VISA device %1").arg(m_settings.m_visaDevice)));
}
}
else
{
QTimer::singleShot(0, this, SLOT(nextState()));
}
}
else
{

View File

@ -219,12 +219,8 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
}
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
void openVISADevice();
bool openVISADevice();
void closeVISADevice();
void processVISA(QStringList commands);
void powerOn();

View File

@ -49,9 +49,9 @@ NoiseFigureControlDialog::~NoiseFigureControlDialog()
void NoiseFigureControlDialog::accept()
{
m_settings->m_powerOnCommand = ui->powerOnCommand->text();
m_settings->m_powerOffCommand = ui->powerOffCommand->text();
m_settings->m_visaDevice = ui->device->text();
m_settings->m_powerOnCommand = ui->powerOnCommand->text().trimmed();
m_settings->m_powerOffCommand = ui->powerOffCommand->text().trimmed();
m_settings->m_visaDevice = ui->device->text().trimmed();
m_settings->m_powerOnSCPI = ui->powerOnSCPI->toPlainText();
m_settings->m_powerOffSCPI = ui->powerOffSCPI->toPlainText();
m_settings->m_powerDelay = ui->delay->value();