Skip to content

Commit

Permalink
plugins: Implemented pausePing slot for the main plugins.
Browse files Browse the repository at this point in the history
Signed-off-by: andrei.danila <[email protected]>
  • Loading branch information
andreidanila1 committed Jun 19, 2024
1 parent 466ab7d commit 0cea353
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plugins/m2k/include/m2k/m2kplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public Q_SLOTS:
void hidePageCallback() override;
void startPingTask() override;
void stopPingTask() override;
void onPausePingTask(bool pause) override;

void calibrationStarted();
void calibrationSuccess();
Expand All @@ -72,6 +73,7 @@ public Q_SLOTS:
m2k_iio_manager *m2k_man;
InfoPage *m_m2kInfoPage;

const int PING_PERIOD = 5000;
const int infoPageTimerTimeout = 1000;
const QStringList calibrationToolNames = {"Oscilloscope", "Spectrum Analyzer", "Network Analyzer",
"Signal Generator", "Voltmeter", "Calibration"};
Expand Down
11 changes: 10 additions & 1 deletion plugins/m2k/src/m2kplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,19 @@ void M2kPlugin::showPageCallback() { m_m2kController->startTemperatureTask(); }

void M2kPlugin::hidePageCallback() { m_m2kController->stopTemperatureTask(); }

void M2kPlugin::startPingTask() { m_cyclicalTask->start(5000); }
void M2kPlugin::startPingTask() { m_cyclicalTask->start(PING_PERIOD); }

void M2kPlugin::stopPingTask() { m_cyclicalTask->stop(); }

void M2kPlugin::onPausePingTask(bool pause)
{
if(pause) {
stopPingTask();
} else {
startPingTask();
}
}

void M2kPlugin::calibrationStarted()
{
storeToolState(calibrationToolNames);
Expand Down
1 change: 1 addition & 0 deletions plugins/pqm/include/pqm/pqmplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public Q_SLOTS:
bool onDisconnect() override;
void startPingTask() override;
void stopPingTask() override;
void onPausePingTask(bool pause) override;

private:
void clearPingTask();
Expand Down
9 changes: 9 additions & 0 deletions plugins/pqm/src/pqmplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ void PQMPlugin::startPingTask() { m_acqManager->startPing(); }

void PQMPlugin::stopPingTask() { m_acqManager->stopPing(); }

void PQMPlugin::onPausePingTask(bool pause)
{
if(pause) {
m_acqManager->stopPing();
} else {
m_acqManager->startPing();
}
}

void PQMPlugin::clearPingTask()
{
if(m_pingTask) {
Expand Down
3 changes: 3 additions & 0 deletions plugins/swiot/include/swiot/swiotplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public Q_SLOTS:
bool onDisconnect() override;
void startPingTask() override;
void stopPingTask() override;
void onPausePingTask(bool pause) override;

void onIsRuntimeCtxChanged(bool isRuntimeCtx);

Expand Down Expand Up @@ -81,6 +82,8 @@ private Q_SLOTS:
bool m_isRuntime;
bool m_switchCmd = false;
QString m_ctxMode;

const int PING_PERIOD = 2000;
};
} // namespace scopy::swiot
#endif // SWIOTPLUGIN_H
11 changes: 10 additions & 1 deletion plugins/swiot/src/swiotplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,19 @@ bool SWIOTPlugin::onDisconnect()
return true;
}

void SWIOTPlugin::startPingTask() { m_cyclicalTask->start(2000); }
void SWIOTPlugin::startPingTask() { m_cyclicalTask->start(PING_PERIOD); }

void SWIOTPlugin::stopPingTask() { m_cyclicalTask->stop(); }

void SWIOTPlugin::onPausePingTask(bool pause)
{
if(pause) {
stopPingTask();
} else {
startPingTask();
}
}

void SWIOTPlugin::onIsRuntimeCtxChanged(bool isRuntimeCtx)
{
m_isRuntime = isRuntimeCtx;
Expand Down

0 comments on commit 0cea353

Please sign in to comment.