Replaced InsightWorker signals with InsightSignals singleton
This commit is contained in:
@@ -2,6 +2,7 @@ target_sources(
|
|||||||
Bloom
|
Bloom
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Insight.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Insight.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/InsightSignals.hpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/InsightWorker/InsightWorker.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/InsightWorker/InsightWorker.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/UiLoader.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/UiLoader.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/BloomProxyStyle.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/UserInterfaces/InsightWindow/BloomProxyStyle.cpp
|
||||||
|
|||||||
@@ -8,11 +8,15 @@
|
|||||||
#include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp"
|
#include "UserInterfaces/InsightWindow/BloomProxyStyle.hpp"
|
||||||
|
|
||||||
#include "src/Application.hpp"
|
#include "src/Application.hpp"
|
||||||
|
|
||||||
#include "InsightWorker/Tasks/QueryLatestVersionNumber.hpp"
|
#include "InsightWorker/Tasks/QueryLatestVersionNumber.hpp"
|
||||||
|
#include "InsightWorker/Tasks/GetTargetState.hpp"
|
||||||
|
#include "InsightWorker/Tasks/GetTargetDescriptor.hpp"
|
||||||
|
|
||||||
namespace Bloom
|
namespace Bloom
|
||||||
{
|
{
|
||||||
using namespace Bloom::Exceptions;
|
using namespace Bloom::Exceptions;
|
||||||
|
using Bloom::Targets::TargetState;
|
||||||
|
|
||||||
Insight::Insight(
|
Insight::Insight(
|
||||||
EventListener& eventListener,
|
EventListener& eventListener,
|
||||||
@@ -62,7 +66,33 @@ namespace Bloom
|
|||||||
Logger::info("Starting Insight");
|
Logger::info("Starting Insight");
|
||||||
this->setThreadState(ThreadState::STARTING);
|
this->setThreadState(ThreadState::STARTING);
|
||||||
|
|
||||||
auto targetDescriptor = this->targetControllerConsole.getTargetDescriptor();
|
this->eventListener.registerCallbackForEventType<Events::TargetControllerStateChanged>(
|
||||||
|
std::bind(&Insight::onTargetControllerStateChangedEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
|
this->eventListener.registerCallbackForEventType<Events::TargetExecutionStopped>(
|
||||||
|
std::bind(&Insight::onTargetStoppedEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
|
this->eventListener.registerCallbackForEventType<Events::TargetExecutionResumed>(
|
||||||
|
std::bind(&Insight::onTargetResumedEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
|
this->eventListener.registerCallbackForEventType<Events::TargetReset>(
|
||||||
|
std::bind(&Insight::onTargetResetEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
|
this->eventListener.registerCallbackForEventType<Events::RegistersWrittenToTarget>(
|
||||||
|
std::bind(&Insight::onTargetRegistersWrittenEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
|
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeEnabled>(
|
||||||
|
std::bind(&Insight::onProgrammingModeEnabledEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
|
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeDisabled>(
|
||||||
|
std::bind(&Insight::onProgrammingModeDisabledEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
QApplication::setQuitOnLastWindowClosed(true);
|
QApplication::setQuitOnLastWindowClosed(true);
|
||||||
QApplication::setStyle(new BloomProxyStyle());
|
QApplication::setStyle(new BloomProxyStyle());
|
||||||
@@ -137,13 +167,13 @@ namespace Bloom
|
|||||||
*/
|
*/
|
||||||
auto* eventDispatchTimer = new QTimer(&(this->application));
|
auto* eventDispatchTimer = new QTimer(&(this->application));
|
||||||
QObject::connect(eventDispatchTimer, &QTimer::timeout, this, &Insight::dispatchEvents);
|
QObject::connect(eventDispatchTimer, &QTimer::timeout, this, &Insight::dispatchEvents);
|
||||||
eventDispatchTimer->start(100);
|
eventDispatchTimer->start(50);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
this->mainWindow,
|
this->mainWindow,
|
||||||
&InsightWindow::activatedSignal,
|
&InsightWindow::activatedSignal,
|
||||||
this->insightWorker,
|
this,
|
||||||
&InsightWorker::onInsightWindowActivated
|
&Insight::onInsightWindowActivated
|
||||||
);
|
);
|
||||||
|
|
||||||
this->mainWindow->setInsightConfig(this->insightConfig);
|
this->mainWindow->setInsightConfig(this->insightConfig);
|
||||||
@@ -157,7 +187,7 @@ namespace Bloom
|
|||||||
QObject::connect(this->workerThread, &QThread::finished, this->insightWorker, &QObject::deleteLater);
|
QObject::connect(this->workerThread, &QThread::finished, this->insightWorker, &QObject::deleteLater);
|
||||||
QObject::connect(this->workerThread, &QThread::finished, this->workerThread, &QThread::deleteLater);
|
QObject::connect(this->workerThread, &QThread::finished, this->workerThread, &QThread::deleteLater);
|
||||||
|
|
||||||
this->mainWindow->init(targetDescriptor);
|
this->mainWindow->init(this->targetControllerConsole.getTargetDescriptor());
|
||||||
|
|
||||||
QObject::connect(this->insightWorker, &InsightWorker::ready, this, [this] {
|
QObject::connect(this->insightWorker, &InsightWorker::ready, this, [this] {
|
||||||
this->checkBloomVersion();
|
this->checkBloomVersion();
|
||||||
@@ -209,4 +239,87 @@ namespace Bloom
|
|||||||
|
|
||||||
this->insightWorker->queueTask(versionQueryTask);
|
this->insightWorker->queueTask(versionQueryTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Insight::onInsightWindowActivated() {
|
||||||
|
auto* getTargetStateTask = new GetTargetState();
|
||||||
|
QObject::connect(
|
||||||
|
getTargetStateTask,
|
||||||
|
&GetTargetState::targetState,
|
||||||
|
this,
|
||||||
|
[this] (Targets::TargetState targetState) {
|
||||||
|
this->lastTargetState = targetState;
|
||||||
|
emit this->insightSignals->targetStateUpdated(this->lastTargetState);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
InsightWorker::queueTask(getTargetStateTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
||||||
|
if (this->lastTargetState == TargetState::STOPPED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->lastTargetState = TargetState::STOPPED;
|
||||||
|
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
|
||||||
|
if (this->lastTargetState != TargetState::RUNNING) {
|
||||||
|
this->lastTargetState = TargetState::RUNNING;
|
||||||
|
emit this->insightSignals->targetStateUpdated(TargetState::RUNNING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onTargetResetEvent(const Events::TargetReset& event) {
|
||||||
|
try {
|
||||||
|
if (this->targetControllerConsole.getTargetState() != TargetState::STOPPED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->lastTargetState != TargetState::STOPPED) {
|
||||||
|
this->lastTargetState = TargetState::STOPPED;
|
||||||
|
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit this->insightSignals->targetReset();
|
||||||
|
|
||||||
|
} catch (const Exceptions::Exception& exception) {
|
||||||
|
Logger::debug("Error handling TargetReset event - " + exception.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event) {
|
||||||
|
emit this->insightSignals->targetRegistersWritten(event.registers, event.createdTimestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onTargetControllerStateChangedEvent(const Events::TargetControllerStateChanged& event) {
|
||||||
|
using TargetController::TargetControllerState;
|
||||||
|
|
||||||
|
if (event.state == TargetControllerState::SUSPENDED) {
|
||||||
|
emit this->insightSignals->targetControllerSuspended();
|
||||||
|
|
||||||
|
} else if (event.state == TargetControllerState::ACTIVE) {
|
||||||
|
auto* getTargetDescriptorTask = new GetTargetDescriptor();
|
||||||
|
|
||||||
|
QObject::connect(
|
||||||
|
getTargetDescriptorTask,
|
||||||
|
&GetTargetDescriptor::targetDescriptor,
|
||||||
|
this,
|
||||||
|
[this] (Targets::TargetDescriptor targetDescriptor) {
|
||||||
|
emit this->insightSignals->targetControllerResumed(targetDescriptor);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
InsightWorker::queueTask(getTargetDescriptorTask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event) {
|
||||||
|
emit this->insightSignals->programmingModeEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Insight::onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event) {
|
||||||
|
emit this->insightSignals->programmingModeDisabled();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,18 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "src/Helpers/Thread.hpp"
|
#include "src/Helpers/Thread.hpp"
|
||||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
#include "src/ProjectConfig.hpp"
|
#include "src/ProjectConfig.hpp"
|
||||||
#include "src/ProjectSettings.hpp"
|
#include "src/ProjectSettings.hpp"
|
||||||
|
|
||||||
#include "src/EventManager/EventManager.hpp"
|
#include "src/EventManager/EventManager.hpp"
|
||||||
#include "src/EventManager/EventListener.hpp"
|
#include "src/EventManager/EventListener.hpp"
|
||||||
|
#include "src/EventManager/Events/Events.hpp"
|
||||||
|
|
||||||
|
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||||
|
#include "src/Targets/TargetState.hpp"
|
||||||
|
|
||||||
|
#include "InsightSignals.hpp"
|
||||||
|
|
||||||
#include "InsightWorker/InsightWorker.hpp"
|
#include "InsightWorker/InsightWorker.hpp"
|
||||||
#include "UserInterfaces/InsightWindow/InsightWindow.hpp"
|
#include "UserInterfaces/InsightWindow/InsightWindow.hpp"
|
||||||
@@ -79,6 +84,8 @@ namespace Bloom
|
|||||||
);
|
);
|
||||||
|
|
||||||
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
||||||
|
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
||||||
|
InsightSignals* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insight consists of two threads - the main thread where the main Qt event loop runs (for the GUI), and
|
* Insight consists of two threads - the main thread where the main Qt event loop runs (for the GUI), and
|
||||||
@@ -105,5 +112,14 @@ namespace Bloom
|
|||||||
void dispatchEvents() {
|
void dispatchEvents() {
|
||||||
this->eventListener.dispatchCurrentEvents();
|
this->eventListener.dispatchCurrentEvents();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void onInsightWindowActivated();
|
||||||
|
void onTargetStoppedEvent(const Events::TargetExecutionStopped& event);
|
||||||
|
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
||||||
|
void onTargetResetEvent(const Events::TargetReset& event);
|
||||||
|
void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event);
|
||||||
|
void onTargetControllerStateChangedEvent(const Events::TargetControllerStateChanged& event);
|
||||||
|
void onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event);
|
||||||
|
void onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
43
src/Insight/InsightSignals.hpp
Normal file
43
src/Insight/InsightSignals.hpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
#include "src/Targets/TargetState.hpp"
|
||||||
|
#include "src/Targets/TargetDescriptor.hpp"
|
||||||
|
#include "src/Targets/TargetRegister.hpp"
|
||||||
|
|
||||||
|
namespace Bloom
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Singleton class providing global signals to all Insight widgets that require them. The signals are emitted via
|
||||||
|
* the Insight class and InsightWorkerTasks.
|
||||||
|
*/
|
||||||
|
class InsightSignals: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
static InsightSignals* instance() {
|
||||||
|
static auto instance = InsightSignals();
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
InsightSignals(const InsightSignals&) = delete;
|
||||||
|
void operator = (const InsightSignals&) = delete;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void taskQueued();
|
||||||
|
|
||||||
|
void targetStateUpdated(Bloom::Targets::TargetState newState);
|
||||||
|
void targetReset();
|
||||||
|
void targetRegistersWritten(const Bloom::Targets::TargetRegisters& targetRegisters, const QDateTime& timestamp);
|
||||||
|
void targetControllerSuspended();
|
||||||
|
void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
||||||
|
void programmingModeEnabled();
|
||||||
|
void programmingModeDisabled();
|
||||||
|
|
||||||
|
private:
|
||||||
|
InsightSignals() = default;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
#include "InsightWorker.hpp"
|
#include "InsightWorker.hpp"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include "src/TargetController/TargetControllerState.hpp"
|
|
||||||
|
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
#include "src/Logger/Logger.hpp"
|
#include "src/Logger/Logger.hpp"
|
||||||
|
|
||||||
namespace Bloom
|
namespace Bloom
|
||||||
@@ -13,137 +11,52 @@ namespace Bloom
|
|||||||
|
|
||||||
using Bloom::Targets::TargetState;
|
using Bloom::Targets::TargetState;
|
||||||
|
|
||||||
void InsightWorker::queueTask(InsightWorkerTask* task) {
|
|
||||||
auto taskQueueLock = this->queuedTasks.acquireLock();
|
|
||||||
task->moveToThread(this->thread());
|
|
||||||
task->setParent(this);
|
|
||||||
this->queuedTasks.getValue().push(task);
|
|
||||||
emit this->taskQueued();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InsightWorker::startup() {
|
void InsightWorker::startup() {
|
||||||
Logger::debug("Starting InsightWorker thread");
|
Logger::debug("Starting InsightWorker thread");
|
||||||
EventManager::registerListener(this->eventListener);
|
|
||||||
|
|
||||||
this->eventListener->registerCallbackForEventType<Events::TargetControllerStateChanged>(
|
QObject::connect(
|
||||||
std::bind(&InsightWorker::onTargetControllerStateChangedEvent, this, std::placeholders::_1)
|
InsightSignals::instance(),
|
||||||
);
|
&InsightSignals::taskQueued,
|
||||||
|
this,
|
||||||
this->eventListener->registerCallbackForEventType<Events::TargetExecutionStopped>(
|
&InsightWorker::executeTasks
|
||||||
std::bind(&InsightWorker::onTargetStoppedEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->eventListener->registerCallbackForEventType<Events::TargetExecutionResumed>(
|
|
||||||
std::bind(&InsightWorker::onTargetResumedEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->eventListener->registerCallbackForEventType<Events::TargetReset>(
|
|
||||||
std::bind(&InsightWorker::onTargetResetEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->eventListener->registerCallbackForEventType<Events::ProgrammingModeEnabled>(
|
|
||||||
std::bind(&InsightWorker::onProgrammingModeEnabledEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->eventListener->registerCallbackForEventType<Events::ProgrammingModeDisabled>(
|
|
||||||
std::bind(&InsightWorker::onProgrammingModeDisabledEvent, this, std::placeholders::_1)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->eventDispatchTimer = new QTimer(this);
|
|
||||||
QObject::connect(this->eventDispatchTimer, &QTimer::timeout, this, &InsightWorker::dispatchEvents);
|
|
||||||
this->eventDispatchTimer->start(5);
|
|
||||||
|
|
||||||
QObject::connect(this, &InsightWorker::taskQueued, this, &InsightWorker::executeTasks);
|
|
||||||
|
|
||||||
EventManager::triggerEvent(
|
|
||||||
std::make_shared<Events::InsightThreadStateChanged>(ThreadState::READY)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
emit this->ready();
|
emit this->ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsightWorker::onInsightWindowActivated() {
|
void InsightWorker::queueTask(InsightWorkerTask* task) {
|
||||||
this->lastTargetState = this->targetControllerConsole.getTargetState();
|
task->moveToThread(nullptr);
|
||||||
emit this->targetStateUpdated(this->lastTargetState);
|
|
||||||
|
{
|
||||||
|
const auto taskQueueLock = InsightWorker::queuedTasks.acquireLock();
|
||||||
|
InsightWorker::queuedTasks.getValue().push(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
emit InsightSignals::instance()->taskQueued();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<InsightWorkerTask*> InsightWorker::getQueuedTask() {
|
std::optional<InsightWorkerTask*> InsightWorker::getQueuedTask() {
|
||||||
auto task = std::optional<InsightWorkerTask*>();
|
auto taskQueueLock = InsightWorker::queuedTasks.acquireLock();
|
||||||
|
auto& queuedTasks = InsightWorker::queuedTasks.getValue();
|
||||||
auto& queuedTasks = this->queuedTasks.getValue();
|
|
||||||
auto taskQueueLock = this->queuedTasks.acquireLock();
|
|
||||||
|
|
||||||
if (!queuedTasks.empty()) {
|
if (!queuedTasks.empty()) {
|
||||||
task = queuedTasks.front();
|
auto* task = queuedTasks.front();
|
||||||
queuedTasks.pop();
|
queuedTasks.pop();
|
||||||
}
|
|
||||||
|
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsightWorker::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
return std::nullopt;
|
||||||
if (this->lastTargetState == TargetState::STOPPED) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->lastTargetState = TargetState::STOPPED;
|
|
||||||
emit this->targetStateUpdated(TargetState::STOPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
void InsightWorker::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
|
|
||||||
if (this->lastTargetState != TargetState::RUNNING) {
|
|
||||||
this->lastTargetState = TargetState::RUNNING;
|
|
||||||
emit this->targetStateUpdated(TargetState::RUNNING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void InsightWorker::onTargetResetEvent(const Events::TargetReset& event) {
|
|
||||||
try {
|
|
||||||
if (this->targetControllerConsole.getTargetState() != TargetState::STOPPED) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->lastTargetState != TargetState::STOPPED) {
|
|
||||||
this->lastTargetState = TargetState::STOPPED;
|
|
||||||
emit this->targetStateUpdated(TargetState::STOPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
emit this->targetReset();
|
|
||||||
|
|
||||||
} catch (const Exceptions::Exception& exception) {
|
|
||||||
Logger::debug("Error handling TargetReset event - " + exception.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void InsightWorker::onTargetControllerStateChangedEvent(const Events::TargetControllerStateChanged& event) {
|
|
||||||
using TargetController::TargetControllerState;
|
|
||||||
|
|
||||||
if (event.state == TargetControllerState::SUSPENDED) {
|
|
||||||
emit this->targetControllerSuspended();
|
|
||||||
|
|
||||||
} else if (event.state == TargetControllerState::ACTIVE) {
|
|
||||||
try {
|
|
||||||
emit this->targetControllerResumed(this->targetControllerConsole.getTargetDescriptor());
|
|
||||||
|
|
||||||
} catch (const Exception& exception) {
|
|
||||||
Logger::error("Insight resume failed - " + exception.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void InsightWorker::onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event) {
|
|
||||||
emit this->programmingModeEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InsightWorker::onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event) {
|
|
||||||
emit this->programmingModeDisabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsightWorker::executeTasks() {
|
void InsightWorker::executeTasks() {
|
||||||
auto task = std::optional<InsightWorkerTask*>();
|
auto queuedTask = std::optional<InsightWorkerTask*>();
|
||||||
|
|
||||||
while ((task = this->getQueuedTask()).has_value()) {
|
while ((queuedTask = InsightWorker::getQueuedTask()).has_value()) {
|
||||||
task.value()->execute(this->targetControllerConsole);
|
auto* task = queuedTask.value();
|
||||||
|
task->moveToThread(this->thread());
|
||||||
|
task->setParent(this);
|
||||||
|
task->execute(this->targetControllerConsole);
|
||||||
|
task->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QApplication>
|
#include <queue>
|
||||||
|
|
||||||
#include "src/Helpers/Thread.hpp"
|
|
||||||
#include "src/Helpers/SyncSafe.hpp"
|
|
||||||
#include "src/ProjectConfig.hpp"
|
|
||||||
|
|
||||||
#include "src/EventManager/EventManager.hpp"
|
|
||||||
#include "src/EventManager/EventListener.hpp"
|
|
||||||
#include "src/EventManager/Events/Events.hpp"
|
|
||||||
|
|
||||||
#include "src/TargetController/TargetControllerConsole.hpp"
|
|
||||||
|
|
||||||
#include "Tasks/InsightWorkerTask.hpp"
|
#include "Tasks/InsightWorkerTask.hpp"
|
||||||
|
|
||||||
|
#include "src/Helpers/SyncSafe.hpp"
|
||||||
|
#include "src/TargetController/TargetControllerConsole.hpp"
|
||||||
|
|
||||||
namespace Bloom
|
namespace Bloom
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -28,47 +21,18 @@ namespace Bloom
|
|||||||
public:
|
public:
|
||||||
InsightWorker() = default;
|
InsightWorker() = default;
|
||||||
|
|
||||||
void queueTask(InsightWorkerTask* task);
|
|
||||||
|
|
||||||
void startup();
|
void startup();
|
||||||
|
static void queueTask(InsightWorkerTask* task);
|
||||||
void onInsightWindowActivated();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ready();
|
void ready();
|
||||||
void taskQueued();
|
|
||||||
void targetStateUpdated(Bloom::Targets::TargetState newState);
|
|
||||||
void targetReset();
|
|
||||||
void targetControllerSuspended();
|
|
||||||
void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
|
||||||
void targetRegistersWritten(const Bloom::Targets::TargetRegisters& targetRegisters, const QDateTime& timestamp);
|
|
||||||
void programmingModeEnabled();
|
|
||||||
void programmingModeDisabled();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventListenerPointer eventListener = std::make_shared<EventListener>("InsightWorkerEventListener");
|
|
||||||
|
|
||||||
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
TargetController::TargetControllerConsole targetControllerConsole = TargetController::TargetControllerConsole();
|
||||||
|
|
||||||
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
static inline SyncSafe<std::queue<InsightWorkerTask*>> queuedTasks = {};
|
||||||
|
|
||||||
QTimer* eventDispatchTimer = nullptr;
|
|
||||||
|
|
||||||
SyncSafe<std::queue<InsightWorkerTask*>> queuedTasks;
|
|
||||||
|
|
||||||
void dispatchEvents() {
|
|
||||||
this->eventListener->dispatchCurrentEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<InsightWorkerTask*> getQueuedTask();
|
|
||||||
|
|
||||||
void onTargetStoppedEvent(const Events::TargetExecutionStopped& event);
|
|
||||||
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
|
||||||
void onTargetResetEvent(const Events::TargetReset& event);
|
|
||||||
void onTargetControllerStateChangedEvent(const Events::TargetControllerStateChanged& event);
|
|
||||||
void onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event);
|
|
||||||
void onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event);
|
|
||||||
|
|
||||||
|
static std::optional<InsightWorkerTask*> getQueuedTask();
|
||||||
void executeTasks();
|
void executeTasks();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "src/Targets/TargetMemory.hpp"
|
#include "src/Targets/TargetMemory.hpp"
|
||||||
|
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Insight/InsightWorker/Tasks/ReadProgramCounter.hpp"
|
#include "src/Insight/InsightWorker/Tasks/ReadProgramCounter.hpp"
|
||||||
|
|
||||||
namespace Bloom
|
namespace Bloom
|
||||||
@@ -244,28 +246,30 @@ namespace Bloom
|
|||||||
&InsightWindow::toggleEepromInspectionPane
|
&InsightWindow::toggleEepromInspectionPane
|
||||||
);
|
);
|
||||||
|
|
||||||
// InsightWorker connections
|
// InsightSignal connections
|
||||||
|
auto* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::targetControllerSuspended,
|
&InsightSignals::targetControllerSuspended,
|
||||||
this,
|
this,
|
||||||
&InsightWindow::onTargetControllerSuspended
|
&InsightWindow::onTargetControllerSuspended
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::targetControllerResumed,
|
&InsightSignals::targetControllerResumed,
|
||||||
this,
|
this,
|
||||||
&InsightWindow::onTargetControllerResumed
|
&InsightWindow::onTargetControllerResumed
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&InsightWindow::onTargetStateUpdate
|
&InsightWindow::onTargetStateUpdate
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::targetReset,
|
&InsightSignals::targetReset,
|
||||||
this,
|
this,
|
||||||
[this] {
|
[this] {
|
||||||
this->refreshProgramCounter();
|
this->refreshProgramCounter();
|
||||||
@@ -273,14 +277,14 @@ namespace Bloom
|
|||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::programmingModeEnabled,
|
&InsightSignals::programmingModeEnabled,
|
||||||
this,
|
this,
|
||||||
&InsightWindow::onProgrammingModeEnabled
|
&InsightWindow::onProgrammingModeEnabled
|
||||||
);
|
);
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::programmingModeDisabled,
|
&InsightSignals::programmingModeDisabled,
|
||||||
this,
|
this,
|
||||||
&InsightWindow::onProgrammingModeDisabled
|
&InsightWindow::onProgrammingModeDisabled
|
||||||
);
|
);
|
||||||
@@ -913,7 +917,7 @@ namespace Bloom
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->insightWorker.queueTask(readProgramCounterTask);
|
InsightWorker::queueTask(readProgramCounterTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsightWindow::openReportIssuesUrl() {
|
void InsightWindow::openReportIssuesUrl() {
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
|
||||||
namespace Bloom::Widgets
|
namespace Bloom::Widgets
|
||||||
{
|
{
|
||||||
using Bloom::Targets::TargetMemoryDescriptor;
|
using Bloom::Targets::TargetMemoryDescriptor;
|
||||||
@@ -54,8 +56,8 @@ namespace Bloom::Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
InsightSignals::instance(),
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&ByteItemGraphicsScene::onTargetStateChanged
|
&ByteItemGraphicsScene::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "HexViewerWidget.hpp"
|
#include "HexViewerWidget.hpp"
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
#include "src/Exceptions/Exception.hpp"
|
#include "src/Exceptions/Exception.hpp"
|
||||||
@@ -156,8 +157,8 @@ namespace Bloom::Widgets
|
|||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
InsightSignals::instance(),
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&HexViewerWidget::onTargetStateChanged
|
&HexViewerWidget::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||||
|
|
||||||
#include "src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp"
|
#include "src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp"
|
||||||
@@ -169,23 +171,25 @@ namespace Bloom::Widgets
|
|||||||
&TargetMemoryInspectionPane::attach
|
&TargetMemoryInspectionPane::attach
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&TargetMemoryInspectionPane::onTargetStateChanged
|
&TargetMemoryInspectionPane::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::programmingModeEnabled,
|
&InsightSignals::programmingModeEnabled,
|
||||||
this,
|
this,
|
||||||
&TargetMemoryInspectionPane::onProgrammingModeEnabled
|
&TargetMemoryInspectionPane::onProgrammingModeEnabled
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::programmingModeDisabled,
|
&InsightSignals::programmingModeDisabled,
|
||||||
this,
|
this,
|
||||||
&TargetMemoryInspectionPane::onProgrammingModeDisabled
|
&TargetMemoryInspectionPane::onProgrammingModeDisabled
|
||||||
);
|
);
|
||||||
@@ -268,7 +272,7 @@ namespace Bloom::Widgets
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->insightWorker.queueTask(readStackPointerTask);
|
InsightWorker::queueTask(readStackPointerTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -312,7 +316,7 @@ namespace Bloom::Widgets
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->insightWorker.queueTask(readMemoryTask);
|
InsightWorker::queueTask(readMemoryTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetMemoryInspectionPane::resizeEvent(QResizeEvent* event) {
|
void TargetMemoryInspectionPane::resizeEvent(QResizeEvent* event) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||||
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
@@ -60,16 +61,18 @@ namespace Bloom::Widgets
|
|||||||
titleBar->setContentsMargins(0, 0, 0, 0);
|
titleBar->setContentsMargins(0, 0, 0, 0);
|
||||||
title->setFixedHeight(titleBar->height());
|
title->setFixedHeight(titleBar->height());
|
||||||
|
|
||||||
|
auto* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&RegisterHistoryWidget::onTargetStateChanged
|
&RegisterHistoryWidget::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::targetRegistersWritten,
|
&InsightSignals::targetRegistersWritten,
|
||||||
this,
|
this,
|
||||||
&RegisterHistoryWidget::onRegistersWritten
|
&RegisterHistoryWidget::onRegistersWritten
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/ErrorDialogue/ErrorDialogue.hpp"
|
||||||
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
@@ -200,8 +202,8 @@ namespace Bloom::Widgets
|
|||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
InsightSignals::instance(),
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&TargetRegisterInspectorWindow::onTargetStateChanged
|
&TargetRegisterInspectorWindow::onTargetStateChanged
|
||||||
);
|
);
|
||||||
@@ -345,7 +347,7 @@ namespace Bloom::Widgets
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this->insightWorker.queueTask(readTargetRegisterTask);
|
InsightWorker::queueTask(readTargetRegisterTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetRegisterInspectorWindow::applyChanges() {
|
void TargetRegisterInspectorWindow::applyChanges() {
|
||||||
@@ -374,7 +376,7 @@ namespace Bloom::Widgets
|
|||||||
errorDialogue->show();
|
errorDialogue->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->insightWorker.queueTask(writeRegisterTask);
|
InsightWorker::queueTask(writeRegisterTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetRegisterInspectorWindow::openHelpPage() {
|
void TargetRegisterInspectorWindow::openHelpPage() {
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "src/Helpers/Paths.hpp"
|
#include "src/Helpers/Paths.hpp"
|
||||||
|
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp"
|
#include "src/Insight/InsightWorker/Tasks/ReadTargetRegisters.hpp"
|
||||||
|
|
||||||
namespace Bloom::Widgets
|
namespace Bloom::Widgets
|
||||||
@@ -60,8 +62,8 @@ namespace Bloom::Widgets
|
|||||||
QObject::connect(this->copyValueBinaryAction, &QAction::triggered, this, &RegisterWidget::copyValueBinary);
|
QObject::connect(this->copyValueBinaryAction, &QAction::triggered, this, &RegisterWidget::copyValueBinary);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
InsightSignals::instance(),
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&RegisterWidget::onTargetStateChange
|
&RegisterWidget::onTargetStateChange
|
||||||
);
|
);
|
||||||
@@ -174,7 +176,7 @@ namespace Bloom::Widgets
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
this->insightWorker.queueTask(readRegisterTask);
|
InsightWorker::queueTask(readRegisterTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterWidget::copyName() {
|
void RegisterWidget::copyName() {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
#include "src/Insight/UserInterfaces/InsightWindow/UiLoader.hpp"
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "RegisterGroupWidget.hpp"
|
#include "RegisterGroupWidget.hpp"
|
||||||
#include "RegisterWidget.hpp"
|
#include "RegisterWidget.hpp"
|
||||||
|
|
||||||
@@ -115,16 +117,18 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
itemLayout->addStretch(1);
|
itemLayout->addStretch(1);
|
||||||
|
|
||||||
|
auto* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&TargetRegistersPaneWidget::onTargetStateChanged
|
&TargetRegistersPaneWidget::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&insightWorker,
|
insightSignals,
|
||||||
&InsightWorker::targetRegistersWritten,
|
&InsightSignals::targetRegistersWritten,
|
||||||
this,
|
this,
|
||||||
&TargetRegistersPaneWidget::onRegistersRead
|
&TargetRegistersPaneWidget::onRegistersRead
|
||||||
);
|
);
|
||||||
@@ -197,7 +201,7 @@ namespace Bloom::Widgets
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->insightWorker.queueTask(readRegisterTask);
|
InsightWorker::queueTask(readRegisterTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetRegistersPaneWidget::onItemSelectionChange(ItemWidget* newlySelectedWidget) {
|
void TargetRegistersPaneWidget::onItemSelectionChange(ItemWidget* newlySelectedWidget) {
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
|
||||||
|
#include "src/Insight/InsightSignals.hpp"
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.hpp"
|
#include "src/Insight/InsightWorker/Tasks/RefreshTargetPinStates.hpp"
|
||||||
|
|
||||||
namespace Bloom::Widgets::InsightTargetWidgets
|
namespace Bloom::Widgets::InsightTargetWidgets
|
||||||
@@ -17,30 +19,32 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
|||||||
, targetVariant(std::move(targetVariant))
|
, targetVariant(std::move(targetVariant))
|
||||||
, insightWorker(insightWorker)
|
, insightWorker(insightWorker)
|
||||||
{
|
{
|
||||||
|
auto* insightSignals = InsightSignals::instance();
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::targetStateUpdated,
|
&InsightSignals::targetStateUpdated,
|
||||||
this,
|
this,
|
||||||
&TargetPackageWidget::onTargetStateChanged
|
&TargetPackageWidget::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::targetRegistersWritten,
|
&InsightSignals::targetRegistersWritten,
|
||||||
this,
|
this,
|
||||||
&TargetPackageWidget::onRegistersWritten
|
&TargetPackageWidget::onRegistersWritten
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::programmingModeEnabled,
|
&InsightSignals::programmingModeEnabled,
|
||||||
this,
|
this,
|
||||||
&TargetPackageWidget::onProgrammingModeEnabled
|
&TargetPackageWidget::onProgrammingModeEnabled
|
||||||
);
|
);
|
||||||
|
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
&(this->insightWorker),
|
insightSignals,
|
||||||
&InsightWorker::programmingModeDisabled,
|
&InsightSignals::programmingModeDisabled,
|
||||||
this,
|
this,
|
||||||
&TargetPackageWidget::onProgrammingModeDisabled
|
&TargetPackageWidget::onProgrammingModeDisabled
|
||||||
);
|
);
|
||||||
@@ -66,7 +70,7 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->insightWorker.queueTask(refreshTask);
|
InsightWorker::queueTask(refreshTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetPackageWidget::updatePinStates(const Targets::TargetPinStateMappingType& pinStatesByNumber) {
|
void TargetPackageWidget::updatePinStates(const Targets::TargetPinStateMappingType& pinStatesByNumber) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "TargetPinWidget.hpp"
|
#include "TargetPinWidget.hpp"
|
||||||
|
|
||||||
|
#include "src/Insight/InsightWorker/InsightWorker.hpp"
|
||||||
#include "src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp"
|
#include "src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp"
|
||||||
|
|
||||||
namespace Bloom::Widgets::InsightTargetWidgets
|
namespace Bloom::Widgets::InsightTargetWidgets
|
||||||
@@ -46,7 +47,7 @@ namespace Bloom::Widgets::InsightTargetWidgets
|
|||||||
this->setDisabled(false);
|
this->setDisabled(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
this->insightWorker.queueTask(setPinStateTask);
|
InsightWorker::queueTask(setPinStateTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user