* @brief Register all Network commands with the registry */
| 35 | * @brief Register all Network commands with the registry |
| 36 | */ |
| 37 | void API::Handlers::NetworkHandler::registerCommands() |
| 38 | { |
| 39 | auto& registry = CommandRegistry::instance(); |
| 40 | const auto empty = emptySchema(); |
| 41 | |
| 42 | SchemaProp address_prop; |
| 43 | address_prop.name = QStringLiteral("address"); |
| 44 | address_prop.type = QStringLiteral("string"); |
| 45 | address_prop.description = QStringLiteral("Remote host address (IP or hostname)"); |
| 46 | address_prop.defaultValue = QStringLiteral("localhost"); |
| 47 | registry.registerCommand(QStringLiteral("io.network.setRemoteAddress"), |
| 48 | QStringLiteral("Set remote host address (params: address)"), |
| 49 | makeSchema({address_prop}), |
| 50 | &setRemoteAddress); |
| 51 | |
| 52 | const SchemaProp port_prop = |
| 53 | rangeProp(QStringLiteral("port"), QStringLiteral("Port number (1-65535)"), 1, 65535); |
| 54 | |
| 55 | registry.registerCommand(QStringLiteral("io.network.setTcpPort"), |
| 56 | QStringLiteral("Set TCP port (params: port)"), |
| 57 | makeSchema({port_prop}), |
| 58 | &setTcpPort); |
| 59 | |
| 60 | registry.registerCommand(QStringLiteral("io.network.setUdpLocalPort"), |
| 61 | QStringLiteral("Set UDP local port (params: port)"), |
| 62 | makeSchema({port_prop}), |
| 63 | &setUdpLocalPort); |
| 64 | |
| 65 | registry.registerCommand(QStringLiteral("io.network.setUdpRemotePort"), |
| 66 | QStringLiteral("Set UDP remote port (params: port)"), |
| 67 | makeSchema({port_prop}), |
| 68 | &setUdpRemotePort); |
| 69 | |
| 70 | registry.registerCommand( |
| 71 | QStringLiteral("io.network.setSocketType"), |
| 72 | QStringLiteral("Set socket type (params: socketTypeIndex - 0=TCP, 1=UDP)"), |
| 73 | makeSchema({enumProp(QStringLiteral("socketTypeIndex"), |
| 74 | QStringLiteral("Socket type index (0=TCP, 1=UDP)"), |
| 75 | QJsonArray{0, 1}, |
| 76 | 0)}), |
| 77 | &setSocketType); |
| 78 | |
| 79 | registry.registerCommand(QStringLiteral("io.network.setUdpMulticast"), |
| 80 | QStringLiteral("Enable/disable UDP multicast (params: enabled)"), |
| 81 | makeSchema({ |
| 82 | {QStringLiteral("enabled"), |
| 83 | QStringLiteral("boolean"), |
| 84 | QStringLiteral("Enable UDP multicast mode")} |
| 85 | }), |
| 86 | &setUdpMulticast); |
| 87 | |
| 88 | registry.registerCommand(QStringLiteral("io.network.lookup"), |
| 89 | QStringLiteral("Perform DNS lookup (params: host)"), |
| 90 | makeSchema({ |
| 91 | {QStringLiteral("host"), |
| 92 | QStringLiteral("string"), |
| 93 | QStringLiteral("Hostname or IP address to look up")} |
| 94 | }), |
nothing calls this directly
no test coverage detected