* @brief Enable or disable UDP multicast */
| 240 | * @brief Enable or disable UDP multicast |
| 241 | */ |
| 242 | API::CommandResponse API::Handlers::NetworkHandler::setUdpMulticast(const QString& id, |
| 243 | const QJsonObject& params) |
| 244 | { |
| 245 | if (!params.contains(QStringLiteral("enabled"))) { |
| 246 | return CommandResponse::makeError( |
| 247 | id, ErrorCode::MissingParam, QStringLiteral("Missing required parameter: enabled")); |
| 248 | } |
| 249 | |
| 250 | const bool enabled = params.value(QStringLiteral("enabled")).toBool(); |
| 251 | IO::ConnectionManager::instance().network()->setUdpMulticast(enabled); |
| 252 | |
| 253 | QJsonObject result; |
| 254 | result[QStringLiteral("udpMulticast")] = enabled; |
| 255 | return CommandResponse::makeSuccess(id, result); |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * @brief Perform DNS lookup for a hostname |