* @brief Starts the bundled zero-hardware rocket-launch demo project. */
| 124 | * @brief Starts the bundled zero-hardware rocket-launch demo project. |
| 125 | */ |
| 126 | API::CommandResponse API::Handlers::SystemHandler::startDemo(const QString& id, |
| 127 | const QJsonObject& params) |
| 128 | { |
| 129 | Q_UNUSED(params) |
| 130 | |
| 131 | if (AppState::instance().ephemeralSession()) { |
| 132 | return CommandResponse::makeError( |
| 133 | id, ErrorCode::ExecutionError, QStringLiteral("Demo is unavailable in operator mode")); |
| 134 | } |
| 135 | |
| 136 | if (!Misc::DemoLauncher::instance().startDemo()) { |
| 137 | return CommandResponse::makeError( |
| 138 | id, ErrorCode::OperationFailed, QStringLiteral("Failed to start the demo project")); |
| 139 | } |
| 140 | |
| 141 | return CommandResponse::makeSuccess(id, QJsonObject()); |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * @brief Registers all system.* commands with the global registry. |
nothing calls this directly
no test coverage detected