Add 'get_who_am_i' command and related configurations for device identification

This commit is contained in:
PhosphorosVR
2025-09-05 17:47:04 +02:00
parent e4881ef5a0
commit 93b2f7f23f
12 changed files with 85 additions and 7 deletions

View File

@@ -248,3 +248,14 @@ CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry)
return CommandResult::getErrorResult("Monitoring disabled");
#endif
}
CommandResult getInfoCommand(std::shared_ptr<DependencyRegistry> /*registry*/)
{
const char* who = CONFIG_GENERAL_WHO_AM_I;
const char* ver = CONFIG_GENERAL_Version;
// Ensure non-null strings
if (!who) who = "";
if (!ver) ver = "";
auto result = std::format("{{ \"who_am_i\": \"{}\", \"version\": \"{}\" }}", who, ver);
return CommandResult::getSuccessResult(result);
}

View File

@@ -25,4 +25,7 @@ CommandResult getDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry)
CommandResult getSerialNumberCommand(std::shared_ptr<DependencyRegistry> registry);
// Monitoring
CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry);
CommandResult getLEDCurrentCommand(std::shared_ptr<DependencyRegistry> registry);
// General info
CommandResult getInfoCommand(std::shared_ptr<DependencyRegistry> registry);