Removed tight coupling of target pin widgets with Insight window - moved target pin state toggling into an InsightWorker task.
This commit is contained in:
@@ -28,10 +28,6 @@ void InsightWorker::startup() {
|
||||
std::bind(&InsightWorker::onTargetResumedEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener->registerCallbackForEventType<Events::TargetPinStatesRetrieved>(
|
||||
std::bind(&InsightWorker::onTargetPinStatesRetrievedEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener->registerCallbackForEventType<Events::TargetIoPortsUpdated>(
|
||||
std::bind(&InsightWorker::onTargetIoPortsUpdatedEvent, this, std::placeholders::_1)
|
||||
);
|
||||
@@ -81,14 +77,6 @@ void InsightWorker::requestPinStates(int variantId) {
|
||||
this->targetControllerConsole.requestPinStates(variantId);
|
||||
}
|
||||
|
||||
void InsightWorker::requestPinStateUpdate(
|
||||
int variantId,
|
||||
Bloom::Targets::TargetPinDescriptor pinDescriptor,
|
||||
Bloom::Targets::TargetPinState pinState
|
||||
) {
|
||||
this->targetControllerConsole.setPinState(variantId, pinDescriptor, pinState);
|
||||
}
|
||||
|
||||
void InsightWorker::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
||||
/*
|
||||
* When we report a target halt to Insight, Insight will immediately seek more data from the target (such as GPIO
|
||||
@@ -125,10 +113,6 @@ void InsightWorker::onTargetResumedEvent(const Events::TargetExecutionResumed& e
|
||||
emit this->targetStateUpdated(TargetState::RUNNING);
|
||||
}
|
||||
|
||||
void InsightWorker::onTargetPinStatesRetrievedEvent(const Events::TargetPinStatesRetrieved& event) {
|
||||
emit this->targetPinStatesUpdated(event.variantId, event.pinSatesByNumber);
|
||||
}
|
||||
|
||||
void InsightWorker::onTargetIoPortsUpdatedEvent(const Events::TargetIoPortsUpdated& event) {
|
||||
emit this->targetIoPortsUpdated();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace Bloom
|
||||
|
||||
void onTargetStoppedEvent(const Events::TargetExecutionStopped& event);
|
||||
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
||||
void onTargetPinStatesRetrievedEvent(const Events::TargetPinStatesRetrieved& event);
|
||||
void onTargetIoPortsUpdatedEvent(const Events::TargetIoPortsUpdated& event);
|
||||
void onTargetControllerStateReported(const Events::TargetControllerStateReported& event);
|
||||
|
||||
@@ -58,17 +57,11 @@ namespace Bloom
|
||||
public slots:
|
||||
void startup();
|
||||
void requestPinStates(int variantId);
|
||||
void requestPinStateUpdate(
|
||||
int variantId,
|
||||
Bloom::Targets::TargetPinDescriptor pinDescriptor,
|
||||
Bloom::Targets::TargetPinState pinState
|
||||
);
|
||||
|
||||
signals:
|
||||
void taskQueued();
|
||||
void targetStateUpdated(Bloom::Targets::TargetState newState);
|
||||
void targetProgramCounterUpdated(quint32 programCounter);
|
||||
void targetPinStatesUpdated(int variantId, Bloom::Targets::TargetPinStateMappingType pinStatesByNumber);
|
||||
void targetIoPortsUpdated();
|
||||
void targetControllerSuspended();
|
||||
void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
||||
|
||||
7
src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp
Normal file
7
src/Insight/InsightWorker/Tasks/SetTargetPinState.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "SetTargetPinState.hpp"
|
||||
|
||||
using namespace Bloom;
|
||||
|
||||
void SetTargetPinState::run(TargetControllerConsole& targetControllerConsole) {
|
||||
targetControllerConsole.setPinState(this->pinDescriptor, this->pinState);
|
||||
}
|
||||
22
src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp
Normal file
22
src/Insight/InsightWorker/Tasks/SetTargetPinState.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include "InsightWorkerTask.hpp"
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
class SetTargetPinState: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
Targets::TargetPinState pinState;
|
||||
|
||||
protected:
|
||||
void run(TargetControllerConsole& targetControllerConsole) override;
|
||||
|
||||
public:
|
||||
SetTargetPinState(const Targets::TargetPinDescriptor& pinDescriptor, const Targets::TargetPinState& pinState):
|
||||
InsightWorkerTask(), pinDescriptor(pinDescriptor), pinState(pinState) {}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user