Tidied structure of all classes within the entire code base
Also some other small bits of tidying
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "InsightWorker.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
|
||||
@@ -12,6 +11,16 @@ using namespace Bloom::Exceptions;
|
||||
|
||||
using Bloom::Targets::TargetState;
|
||||
|
||||
InsightWorker::InsightWorker(EventManager& eventManager): eventManager(eventManager) {}
|
||||
|
||||
void InsightWorker::queueTask(InsightWorkerTask* task) {
|
||||
auto taskQueueLock = this->queuedTasks.acquireLock();
|
||||
task->moveToThread(this->thread());
|
||||
task->setParent(this);
|
||||
this->queuedTasks.getReference().push(task);
|
||||
emit this->taskQueued();
|
||||
}
|
||||
|
||||
void InsightWorker::startup() {
|
||||
Logger::debug("Starting InsightWorker thread");
|
||||
this->eventManager.registerListener(this->eventListener);
|
||||
@@ -43,12 +52,8 @@ void InsightWorker::startup() {
|
||||
);
|
||||
}
|
||||
|
||||
void InsightWorker::queueTask(InsightWorkerTask* task) {
|
||||
auto taskQueueLock = this->queuedTasks.acquireLock();
|
||||
task->moveToThread(this->thread());
|
||||
task->setParent(this);
|
||||
this->queuedTasks.getReference().push(task);
|
||||
emit this->taskQueued();
|
||||
void InsightWorker::requestPinStates(int variantId) {
|
||||
this->targetControllerConsole.requestPinStates(variantId);
|
||||
}
|
||||
|
||||
std::optional<InsightWorkerTask*> InsightWorker::getQueuedTask() {
|
||||
@@ -65,18 +70,6 @@ std::optional<InsightWorkerTask*> InsightWorker::getQueuedTask() {
|
||||
return task;
|
||||
}
|
||||
|
||||
void InsightWorker::executeTasks() {
|
||||
auto task = std::optional<InsightWorkerTask*>();
|
||||
|
||||
while ((task = this->getQueuedTask()).has_value()) {
|
||||
task.value()->execute(this->targetControllerConsole);
|
||||
}
|
||||
}
|
||||
|
||||
void InsightWorker::requestPinStates(int variantId) {
|
||||
this->targetControllerConsole.requestPinStates(variantId);
|
||||
}
|
||||
|
||||
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
|
||||
@@ -135,3 +128,11 @@ void InsightWorker::onTargetControllerStateReportedEvent(const Events::TargetCon
|
||||
}
|
||||
this->lastTargetControllerState = event.state;
|
||||
}
|
||||
|
||||
void InsightWorker::executeTasks() {
|
||||
auto task = std::optional<InsightWorkerTask*>();
|
||||
|
||||
while ((task = this->getQueuedTask()).has_value()) {
|
||||
task.value()->execute(this->targetControllerConsole);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user