* @brief Registers all system.* commands with the global registry. */
| 145 | * @brief Registers all system.* commands with the global registry. |
| 146 | */ |
| 147 | void API::Handlers::SystemHandler::registerCommands() |
| 148 | { |
| 149 | auto& registry = CommandRegistry::instance(); |
| 150 | |
| 151 | registry.registerCommand( |
| 152 | QStringLiteral("system.projectDir"), |
| 153 | QStringLiteral("Return the loaded project's directory, file path, and file name. Use this " |
| 154 | "to resolve paths relative to the .ssproj (e.g. a sibling Python script) " |
| 155 | "before calling system.exec."), |
| 156 | emptySchema(), |
| 157 | &projectDir); |
| 158 | |
| 159 | registry.registerCommand( |
| 160 | QStringLiteral("system.exec"), |
| 161 | QStringLiteral("Launch a helper process (e.g. \"python\" with a script path). Control " |
| 162 | "script only -- rejected over the network/SDK. workingDir defaults to the " |
| 163 | "project directory. Returns a processId. The process is terminated " |
| 164 | "automatically when the device disconnects, the project changes, or the " |
| 165 | "app quits."), |
| 166 | makeSchema( |
| 167 | { |
| 168 | {QStringLiteral("program"), |
| 169 | QStringLiteral("string"), |
| 170 | QStringLiteral("Executable to run (resolved from PATH or an absolute path)")} |
| 171 | }, |
| 172 | {{QStringLiteral("args"), QStringLiteral("array"), QStringLiteral("Command-line arguments")}, |
| 173 | {QStringLiteral("workingDir"), |
| 174 | QStringLiteral("string"), |
| 175 | QStringLiteral("Working directory (defaults to the project directory)")}}), |
| 176 | &exec); |
| 177 | |
| 178 | registry.registerCommand( |
| 179 | QStringLiteral("system.kill"), |
| 180 | QStringLiteral("Terminate a managed helper process by id. Control script only."), |
| 181 | makeSchema({ |
| 182 | {QStringLiteral("processId"), QStringLiteral("integer"), QStringLiteral("Process id")} |
| 183 | }), |
| 184 | &kill); |
| 185 | |
| 186 | registry.registerCommand( |
| 187 | QStringLiteral("system.runningProcesses"), |
| 188 | QStringLiteral("List the helper processes currently managed by system.exec."), |
| 189 | emptySchema(), |
| 190 | &runningProcesses); |
| 191 | |
| 192 | registry.registerCommand( |
| 193 | QStringLiteral("system.startDemo"), |
| 194 | QStringLiteral("Start the bundled zero-hardware rocket-launch demo: stages the demo " |
| 195 | "project, opens it, and connects the simulated source so the dashboard " |
| 196 | "streams live data. Unavailable in operator deployments."), |
| 197 | emptySchema(), |
| 198 | &startDemo); |
| 199 | } |
nothing calls this directly
no test coverage detected