This commit is contained in:
Nav
2022-12-17 14:46:08 +00:00
parent 9097e37375
commit 529438b9e4
2 changed files with 12 additions and 7 deletions

View File

@@ -354,8 +354,10 @@ namespace Bloom
if (event.state == TargetControllerState::SUSPENDED) { if (event.state == TargetControllerState::SUSPENDED) {
emit this->insightSignals->targetControllerSuspended(); emit this->insightSignals->targetControllerSuspended();
return;
}
} else if (event.state == TargetControllerState::ACTIVE) { if (event.state == TargetControllerState::ACTIVE) {
auto* getTargetDescriptorTask = new GetTargetDescriptor(); auto* getTargetDescriptorTask = new GetTargetDescriptor();
QObject::connect( QObject::connect(

View File

@@ -165,12 +165,15 @@ namespace Bloom::TargetController
*/ */
template<class CommandType> template<class CommandType>
void registerCommandHandler(std::function<std::unique_ptr<Responses::Response>(CommandType&)> callback) { void registerCommandHandler(std::function<std::unique_ptr<Responses::Response>(CommandType&)> callback) {
auto parentCallback = [callback] (Commands::Command& command) { this->commandHandlersByCommandType.insert(
std::pair(
CommandType::type,
[callback] (Commands::Command& command) {
// Downcast the command to the expected type // Downcast the command to the expected type
return callback(dynamic_cast<CommandType&>(command)); return callback(dynamic_cast<CommandType&>(command));
}; }
)
this->commandHandlersByCommandType.insert(std::pair(CommandType::type, parentCallback)); );
} }
/** /**