Implement rudimentary command manager architecture

This commit is contained in:
Lorow
2024-11-06 00:10:01 +01:00
parent a5276f4d1d
commit 89f8d23421
8 changed files with 166 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
#include "CommandManager.hpp"
std::unique_ptr<Command> CommandManager::createCommand(CommandType type)
{
switch (type)
{
case CommandType::PING:
return std::make_unique<PingCommand>();
break;
case CommandType::UPDATE_WIFI:
return std::make_unique<UpdateWifiCommand>(projectConfig);
default:
return nullptr;
}
}
CommandResult CommandManager::executeFromJson(const std::string *json)
{
// parse it, get a type of command, grab a command from the map based on type
// parse the payload json, call execute on the command and return the result
}