Fixing inconsistencies

This commit is contained in:
Nav
2021-04-08 00:49:33 +01:00
parent 9dd42ecbd5
commit 091e623248
2 changed files with 11 additions and 13 deletions

View File

@@ -53,37 +53,37 @@ void TargetController::startup() {
auto supportedDebugTools = TargetController::getSupportedDebugTools(); auto supportedDebugTools = TargetController::getSupportedDebugTools();
auto supportedTargets = TargetController::getSupportedTargets(); auto supportedTargets = TargetController::getSupportedTargets();
if (supportedDebugTools.find(debugToolName) == supportedDebugTools.end()) { if (!supportedDebugTools.contains(debugToolName)) {
throw Exceptions::InvalidConfig( throw Exceptions::InvalidConfig(
"Debug tool name (\"" + debugToolName + "\") not recognised. Please check your configuration!" "Debug tool name (\"" + debugToolName + "\") not recognised. Please check your configuration!"
); );
} }
if (supportedTargets.find(targetName) == supportedTargets.end()) { if (!supportedTargets.contains(targetName)) {
throw Exceptions::InvalidConfig( throw Exceptions::InvalidConfig(
"Target name (\"" + targetName + "\") not recognised. Please check your configuration!" "Target name (\"" + targetName + "\") not recognised. Please check your configuration!"
); );
} }
// Initiate debug tool and target // Initiate debug tool and target
this->setDebugTool(std::move(supportedDebugTools.find(debugToolName)->second())); this->setDebugTool(std::move(supportedDebugTools.at(debugToolName)()));
this->setTarget(supportedTargets.find(targetName)->second()); this->setTarget(supportedTargets.at(targetName)());
Logger::info("Connecting to debug tool"); Logger::info("Connecting to debug tool");
this->debugTool->init(); this->debugTool->init();
Logger::info("Debug tool connected"); Logger::info("Debug tool connected");
Logger::info("Debug tool name: " + debugTool->getName()); Logger::info("Debug tool name: " + this->debugTool->getName());
Logger::info("Debug tool serial: " + debugTool->getSerialNumber()); Logger::info("Debug tool serial: " + this->debugTool->getSerialNumber());
if (!this->target->isDebugToolSupported(debugTool.get())) { if (!this->target->isDebugToolSupported(this->debugTool.get())) {
throw Exceptions::InvalidConfig( throw Exceptions::InvalidConfig(
"Debug tool (\"" + debugTool->getName() + "\") not supported " + "Debug tool (\"" + this->debugTool->getName() + "\") not supported " +
"by target (\"" + this->target->getName() + "\")." "by target (\"" + this->target->getName() + "\")."
); );
} }
this->target->setDebugTool(debugTool.get()); this->target->setDebugTool(this->debugTool.get());
this->target->preActivationConfigure(this->environmentConfig.targetConfig); this->target->preActivationConfigure(this->environmentConfig.targetConfig);
Logger::info("Activating target"); Logger::info("Activating target");
@@ -104,8 +104,8 @@ void TargetController::startup() {
this->target->postPromotionConfigure(); this->target->postPromotionConfigure();
} }
Logger::info("Target ID: " + target->getHumanReadableId()); Logger::info("Target ID: " + this->target->getHumanReadableId());
Logger::info("Target name: " + target->getName()); Logger::info("Target name: " + this->target->getName());
if (this->target->getState() == TargetState::STOPPED) { if (this->target->getState() == TargetState::STOPPED) {
this->target->run(); this->target->run();

View File

@@ -67,8 +67,6 @@ namespace Bloom
* and return an instance to the derived DebugTool class. They should never attempt to establish * and return an instance to the derived DebugTool class. They should never attempt to establish
* a connection to the device. * a connection to the device.
* *
* Currently, the only debug tool we support is the Atmel-ICE.
*
* @return * @return
*/ */
static auto getSupportedDebugTools() { static auto getSupportedDebugTools() {