diff --git a/src/Insight/InsightWorker/InsightWorker.cpp b/src/Insight/InsightWorker/InsightWorker.cpp index 55e2dbd7..b233ea9d 100644 --- a/src/Insight/InsightWorker/InsightWorker.cpp +++ b/src/Insight/InsightWorker/InsightWorker.cpp @@ -36,6 +36,10 @@ namespace Bloom std::bind(&InsightWorker::onTargetResumedEvent, this, std::placeholders::_1) ); + this->eventListener->registerCallbackForEventType( + std::bind(&InsightWorker::onTargetResetEvent, this, std::placeholders::_1) + ); + this->eventListener->registerCallbackForEventType( std::bind(&InsightWorker::onTargetRegistersWrittenEvent, this, std::placeholders::_1) ); @@ -53,10 +57,6 @@ namespace Bloom emit this->ready(); } - void InsightWorker::requestPinStates(int variantId) { - this->targetControllerConsole.requestPinStates(variantId); - } - std::optional InsightWorker::getQueuedTask() { auto task = std::optional(); @@ -108,6 +108,12 @@ namespace Bloom emit this->targetStateUpdated(TargetState::RUNNING); } + void InsightWorker::onTargetResetEvent(const Events::TargetReset& event) { + // TODO: Pull PC from target. This will be done as part of the TC refactor (https://github.com/navnavnav/Bloom/issues/25) + emit this->targetStateUpdated(TargetState::STOPPED); + emit this->targetProgramCounterUpdated(0); + } + void InsightWorker::onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event) { emit this->targetRegistersWritten(event.registers, event.createdTimestamp); } diff --git a/src/Insight/InsightWorker/InsightWorker.hpp b/src/Insight/InsightWorker/InsightWorker.hpp index a5bbd87d..e273ced0 100644 --- a/src/Insight/InsightWorker/InsightWorker.hpp +++ b/src/Insight/InsightWorker/InsightWorker.hpp @@ -6,10 +6,14 @@ #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 "src/TargetController/TargetControllerState.hpp" + #include "Tasks/InsightWorkerTask.hpp" namespace Bloom @@ -58,6 +62,7 @@ namespace Bloom 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 onTargetControllerStateReportedEvent(const Events::TargetControllerStateReported& event);