Added handling of target reset events in Insight

This commit is contained in:
Nav
2022-04-08 22:14:37 +01:00
parent 1696d2dcbe
commit 7fa93936aa
2 changed files with 15 additions and 4 deletions

View File

@@ -36,6 +36,10 @@ namespace Bloom
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::RegistersWrittenToTarget>(
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<InsightWorkerTask*> InsightWorker::getQueuedTask() {
auto task = std::optional<InsightWorkerTask*>();
@@ -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);
}