1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

KiwiSDR: restored disconnect signal with reporting in the GUI

This commit is contained in:
f4exb 2019-06-08 22:28:06 +02:00
parent 4c04ac85ed
commit 8ea5606034
4 changed files with 21 additions and 9 deletions

View File

@ -53,15 +53,17 @@ KiwiSDRGui::KiwiSDRGui(DeviceUISet *deviceUISet, QWidget* parent) :
qDebug("KiwiSDRGui::KiwiSDRGui"); qDebug("KiwiSDRGui::KiwiSDRGui");
m_sampleSource = m_deviceUISet->m_deviceAPI->getSampleSource(); m_sampleSource = m_deviceUISet->m_deviceAPI->getSampleSource();
m_statusTooltips.push_back("Idle"); m_statusTooltips.push_back("Idle"); // 0
m_statusTooltips.push_back("Connecting..."); m_statusTooltips.push_back("Connecting..."); // 1
m_statusTooltips.push_back("Connected"); m_statusTooltips.push_back("Connected"); // 2
m_statusTooltips.push_back("Error"); m_statusTooltips.push_back("Error"); // 3
m_statusTooltips.push_back("Disconnected"); // 4
m_statusColors.push_back("gray"); m_statusColors.push_back("gray"); // Idle
m_statusColors.push_back("rgb(232, 212, 35)"); m_statusColors.push_back("rgb(232, 212, 35)"); // Connecting (yellow)
m_statusColors.push_back("rgb(35, 138, 35)"); m_statusColors.push_back("rgb(35, 138, 35)"); // Connected (green)
m_statusColors.push_back("rgb(232, 85, 85)"); m_statusColors.push_back("rgb(232, 85, 85)"); // Error (red)
m_statusColors.push_back("rgb(232, 85, 232)"); // Disconnected (magenta)
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));

View File

@ -184,8 +184,9 @@ void KiwiSDRInput::setCenterFrequency(qint64 centerFrequency)
void KiwiSDRInput::setWorkerStatus(int status) void KiwiSDRInput::setWorkerStatus(int status)
{ {
if (m_guiMessageQueue) if (m_guiMessageQueue) {
m_guiMessageQueue->push(MsgSetStatus::create(status)); m_guiMessageQueue->push(MsgSetStatus::create(status));
}
} }
bool KiwiSDRInput::handleMessage(const Message& message) bool KiwiSDRInput::handleMessage(const Message& message)

View File

@ -36,6 +36,8 @@ KiwiSDRWorker::KiwiSDRWorker(SampleSinkFifo* sampleFifo)
this, &KiwiSDRWorker::onBinaryMessageReceived); this, &KiwiSDRWorker::onBinaryMessageReceived);
connect(&m_webSocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error), connect(&m_webSocket, QOverload<QAbstractSocket::SocketError>::of(&QWebSocket::error),
this, &KiwiSDRWorker::onSocketError); this, &KiwiSDRWorker::onSocketError);
connect(&m_webSocket, &QWebSocket::disconnected,
this, &KiwiSDRWorker::onDisconnected);
} }
void KiwiSDRWorker::onConnected() void KiwiSDRWorker::onConnected()
@ -43,6 +45,12 @@ void KiwiSDRWorker::onConnected()
m_webSocket.sendTextMessage("SET auth t=kiwi p=#"); m_webSocket.sendTextMessage("SET auth t=kiwi p=#");
} }
void KiwiSDRWorker::onDisconnected()
{
qDebug("KiwiSDRWorker::onDisconnected");
emit updateStatus(4);
}
void KiwiSDRWorker::onSocketError(QAbstractSocket::SocketError error) void KiwiSDRWorker::onSocketError(QAbstractSocket::SocketError error)
{ {
emit updateStatus(3); emit updateStatus(3);

View File

@ -55,6 +55,7 @@ public slots:
private slots: private slots:
void onConnected(); void onConnected();
void onDisconnected();
void onBinaryMessageReceived(const QByteArray &message); void onBinaryMessageReceived(const QByteArray &message);
void onSocketError(QAbstractSocket::SocketError error); void onSocketError(QAbstractSocket::SocketError error);