* @brief Registers publisher get/set/status commands with the registry. */
| 59 | * @brief Registers publisher get/set/status commands with the registry. |
| 60 | */ |
| 61 | void API::Handlers::MqttHandler::registerPublisherCommands() |
| 62 | { |
| 63 | auto& registry = CommandRegistry::instance(); |
| 64 | |
| 65 | registry.registerCommand( |
| 66 | QStringLiteral("project.mqtt.publisher.getConfig"), |
| 67 | QStringLiteral("Read the MQTT publisher configuration (broker, mode, TLS, etc.). " |
| 68 | "The password is NEVER returned -- inspect 'hasCredentials' instead. " |
| 69 | "Use 'modes', 'mqttVersions', 'sslProtocols', 'peerVerifyModes' as " |
| 70 | "the canonical enum tables when interpreting the integer fields."), |
| 71 | API::emptySchema(), |
| 72 | &publisherGetConfig); |
| 73 | |
| 74 | registry.registerCommand( |
| 75 | QStringLiteral("project.mqtt.publisher.setConfig"), |
| 76 | QStringLiteral("Patch one or more MQTT publisher fields. Pass only the keys you " |
| 77 | "want to change. Setting 'password' requires 'username' in the " |
| 78 | "same call -- the credential pair is persisted to the encrypted " |
| 79 | "vault, NOT to the project file. To clear credentials, pass empty " |
| 80 | "strings for both. Setting 'enabled:true' starts publishing."), |
| 81 | API::makeSchema( |
| 82 | { |
| 83 | }, |
| 84 | {{QStringLiteral("enabled"), |
| 85 | QStringLiteral("boolean"), |
| 86 | QStringLiteral("Start/stop publishing")}, |
| 87 | {QStringLiteral("hostname"), QStringLiteral("string"), QStringLiteral("Broker hostname")}, |
| 88 | {QStringLiteral("port"), |
| 89 | QStringLiteral("integer"), |
| 90 | QStringLiteral("Broker TCP port (1-65535)")}, |
| 91 | {QStringLiteral("clientId"), QStringLiteral("string"), QStringLiteral("MQTT client id")}, |
| 92 | {QStringLiteral("customClientId"), |
| 93 | QStringLiteral("boolean"), |
| 94 | QStringLiteral("If false, regenerate clientId automatically")}, |
| 95 | {QStringLiteral("username"), |
| 96 | QStringLiteral("string"), |
| 97 | QStringLiteral("Vault username (paired with password)")}, |
| 98 | {QStringLiteral("password"), |
| 99 | QStringLiteral("string"), |
| 100 | QStringLiteral("Vault password (requires username in same call)")}, |
| 101 | {QStringLiteral("topicBase"), |
| 102 | QStringLiteral("string"), |
| 103 | QStringLiteral("Publish topic root")}, |
| 104 | {QStringLiteral("notificationTopic"), |
| 105 | QStringLiteral("string"), |
| 106 | QStringLiteral("Topic for app notifications")}, |
| 107 | {QStringLiteral("publishNotifications"), |
| 108 | QStringLiteral("boolean"), |
| 109 | QStringLiteral("Forward app notifications to MQTT")}, |
| 110 | {QStringLiteral("mode"), |
| 111 | QStringLiteral("integer"), |
| 112 | QStringLiteral("0=RawRxData, 1=ScriptDriven, 2=DashboardCsv, 3=DashboardJson")}, |
| 113 | {QStringLiteral("publishFrequency"), |
| 114 | QStringLiteral("integer"), |
| 115 | QStringLiteral("Publish rate in Hz (1-30)")}, |
| 116 | {QStringLiteral("cleanSession"), |
| 117 | QStringLiteral("boolean"), |
| 118 | QStringLiteral("Use clean MQTT session")}, |
nothing calls this directly
no test coverage detected