Automatically trigger refreshing of register widgets, in the TargetRegistersPane, upon a registers written event
This commit is contained in:
@@ -32,6 +32,10 @@ void InsightWorker::startup() {
|
|||||||
std::bind(&InsightWorker::onTargetIoPortsUpdatedEvent, this, std::placeholders::_1)
|
std::bind(&InsightWorker::onTargetIoPortsUpdatedEvent, this, std::placeholders::_1)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this->eventListener->registerCallbackForEventType<Events::RegistersWrittenToTarget>(
|
||||||
|
std::bind(&InsightWorker::onTargetRegistersWrittenEvent, this, std::placeholders::_1)
|
||||||
|
);
|
||||||
|
|
||||||
this->eventDispatchTimer = new QTimer(this);
|
this->eventDispatchTimer = new QTimer(this);
|
||||||
this->connect(this->eventDispatchTimer, &QTimer::timeout, this, &InsightWorker::dispatchEvents);
|
this->connect(this->eventDispatchTimer, &QTimer::timeout, this, &InsightWorker::dispatchEvents);
|
||||||
this->eventDispatchTimer->start(5);
|
this->eventDispatchTimer->start(5);
|
||||||
@@ -117,6 +121,10 @@ void InsightWorker::onTargetIoPortsUpdatedEvent(const Events::TargetIoPortsUpdat
|
|||||||
emit this->targetIoPortsUpdated();
|
emit this->targetIoPortsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InsightWorker::onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event) {
|
||||||
|
emit this->targetRegistersWritten(event.descriptors);
|
||||||
|
}
|
||||||
|
|
||||||
void InsightWorker::onTargetControllerStateReported(const Events::TargetControllerStateReported& event) {
|
void InsightWorker::onTargetControllerStateReported(const Events::TargetControllerStateReported& event) {
|
||||||
if (this->lastTargetControllerState == TargetControllerState::ACTIVE
|
if (this->lastTargetControllerState == TargetControllerState::ACTIVE
|
||||||
&& event.state == TargetControllerState::SUSPENDED
|
&& event.state == TargetControllerState::SUSPENDED
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace Bloom
|
|||||||
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
||||||
void onTargetIoPortsUpdatedEvent(const Events::TargetIoPortsUpdated& event);
|
void onTargetIoPortsUpdatedEvent(const Events::TargetIoPortsUpdated& event);
|
||||||
void onTargetControllerStateReported(const Events::TargetControllerStateReported& event);
|
void onTargetControllerStateReported(const Events::TargetControllerStateReported& event);
|
||||||
|
void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void executeTasks();
|
void executeTasks();
|
||||||
@@ -65,5 +66,6 @@ namespace Bloom
|
|||||||
void targetIoPortsUpdated();
|
void targetIoPortsUpdated();
|
||||||
void targetControllerSuspended();
|
void targetControllerSuspended();
|
||||||
void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
void targetControllerResumed(const Bloom::Targets::TargetDescriptor& targetDescriptor);
|
||||||
|
void targetRegistersWritten(const Bloom::Targets::TargetRegisterDescriptors& descriptors);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,13 @@ TargetRegistersPaneWidget::TargetRegistersPaneWidget(
|
|||||||
this,
|
this,
|
||||||
&TargetRegistersPaneWidget::onTargetStateChanged
|
&TargetRegistersPaneWidget::onTargetStateChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this->connect(
|
||||||
|
&insightWorker,
|
||||||
|
&InsightWorker::targetRegistersWritten,
|
||||||
|
this,
|
||||||
|
&TargetRegistersPaneWidget::onRegistersWritten
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetRegistersPaneWidget::resizeEvent(QResizeEvent* event) {
|
void TargetRegistersPaneWidget::resizeEvent(QResizeEvent* event) {
|
||||||
@@ -142,6 +149,31 @@ void TargetRegistersPaneWidget::onTargetStateChanged(Targets::TargetState newSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TargetRegistersPaneWidget::onRegistersWritten(const Bloom::Targets::TargetRegisterDescriptors& descriptors) {
|
||||||
|
if (this->targetState != Targets::TargetState::STOPPED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Don't bother refreshing individual registers if it will involve more than two refresh calls - In this case, it
|
||||||
|
* will be faster to just refresh all of them at once.
|
||||||
|
*/
|
||||||
|
if (descriptors.size() <= 2) {
|
||||||
|
for (const auto& descriptor : descriptors) {
|
||||||
|
for (const auto& registerGroupWidget : this->registerGroupWidgets) {
|
||||||
|
if (registerGroupWidget->registerWidgetsMappedByDescriptor.contains(descriptor)) {
|
||||||
|
registerGroupWidget->registerWidgetsMappedByDescriptor.at(descriptor)->refreshValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this->refreshRegisterValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TargetRegistersPaneWidget::filterRegisters(const QString& keyword) {
|
void TargetRegistersPaneWidget::filterRegisters(const QString& keyword) {
|
||||||
auto stdKeyword = keyword.toLower().toStdString();
|
auto stdKeyword = keyword.toLower().toStdString();
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace Bloom::Widgets
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTargetStateChanged(Targets::TargetState newState);
|
void onTargetStateChanged(Targets::TargetState newState);
|
||||||
|
void onRegistersWritten(const Bloom::Targets::TargetRegisterDescriptors& descriptors);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override;
|
void resizeEvent(QResizeEvent* event) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user