New TC shutdown command
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Bloom::TargetController::Commands
|
||||
enum class CommandType: std::uint8_t
|
||||
{
|
||||
GENERIC,
|
||||
SHUTDOWN,
|
||||
GET_TARGET_DESCRIPTOR,
|
||||
STOP_TARGET_EXECUTION,
|
||||
RESUME_TARGET_EXECUTION,
|
||||
|
||||
21
src/TargetController/Commands/Shutdown.hpp
Normal file
21
src/TargetController/Commands/Shutdown.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "Command.hpp"
|
||||
|
||||
namespace Bloom::TargetController::Commands
|
||||
{
|
||||
class Shutdown: public Command
|
||||
{
|
||||
public:
|
||||
static constexpr CommandType type = CommandType::SHUTDOWN;
|
||||
static const inline std::string name = "Shutdown";
|
||||
|
||||
[[nodiscard]] CommandType getType() const override {
|
||||
return Shutdown::type;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool requiresDebugMode() const override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -20,6 +20,7 @@ namespace Bloom::TargetController
|
||||
using Commands::CommandIdType;
|
||||
|
||||
using Commands::Command;
|
||||
using Commands::Shutdown;
|
||||
using Commands::GetTargetDescriptor;
|
||||
using Commands::GetTargetState;
|
||||
using Commands::StopTargetExecution;
|
||||
@@ -139,6 +140,10 @@ namespace Bloom::TargetController
|
||||
EventManager::registerListener(this->eventListener);
|
||||
|
||||
// Register command handlers
|
||||
this->registerCommandHandler<Shutdown>(
|
||||
std::bind(&TargetControllerComponent::handleShutdown, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->registerCommandHandler<GetTargetDescriptor>(
|
||||
std::bind(&TargetControllerComponent::handleGetTargetDescriptor, this, std::placeholders::_1)
|
||||
);
|
||||
@@ -640,6 +645,11 @@ namespace Bloom::TargetController
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Response> TargetControllerComponent::handleShutdown(Shutdown& command) {
|
||||
this->shutdown();
|
||||
return std::make_unique<Response>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Responses::TargetDescriptor> TargetControllerComponent::handleGetTargetDescriptor(
|
||||
GetTargetDescriptor& command
|
||||
) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
// Commands
|
||||
#include "Commands/Command.hpp"
|
||||
#include "Commands/Shutdown.hpp"
|
||||
#include "Commands/GetTargetDescriptor.hpp"
|
||||
#include "Commands/GetTargetState.hpp"
|
||||
#include "Commands/StopTargetExecution.hpp"
|
||||
@@ -303,6 +304,7 @@ namespace Bloom::TargetController
|
||||
void onDebugSessionFinishedEvent(const Events::DebugSessionFinished& event);
|
||||
|
||||
// Command handlers
|
||||
std::unique_ptr<Responses::Response> handleShutdown(Commands::Shutdown& command);
|
||||
std::unique_ptr<Responses::TargetDescriptor> handleGetTargetDescriptor(Commands::GetTargetDescriptor& command);
|
||||
std::unique_ptr<Responses::TargetState> handleGetTargetState(Commands::GetTargetState& command);
|
||||
std::unique_ptr<Responses::Response> handleStopTargetExecution(Commands::StopTargetExecution& command);
|
||||
|
||||
Reference in New Issue
Block a user