MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / getConfiguration

Method getConfiguration

app/src/API/Handlers/NetworkHandler.cpp:290–321  ·  view source on GitHub ↗

* @brief Get current network configuration */

Source from the content-addressed store, hash-verified

288 * @brief Get current network configuration
289 */
290API::CommandResponse API::Handlers::NetworkHandler::getConfiguration(const QString& id,
291 const QJsonObject& params)
292{
293 Q_UNUSED(params)
294
295 auto* network = IO::ConnectionManager::instance().network();
296
297 QJsonObject result;
298
299 result[QStringLiteral("remoteAddress")] = network->remoteAddress();
300
301 result[QStringLiteral("tcpPort")] = network->tcpPort();
302 result[QStringLiteral("udpLocalPort")] = network->udpLocalPort();
303 result[QStringLiteral("udpRemotePort")] = network->udpRemotePort();
304
305 result[QStringLiteral("socketTypeIndex")] = network->socketTypeIndex();
306 const auto& socketTypes = network->socketTypes();
307 if (network->socketTypeIndex() < socketTypes.count())
308 result[QStringLiteral("socketTypeName")] = socketTypes.at(network->socketTypeIndex());
309
310 result[QStringLiteral("udpMulticast")] = network->udpMulticast();
311 result[QStringLiteral("lookupActive")] = network->lookupActive();
312 result[QStringLiteral("isOpen")] = network->isOpen();
313 result[QStringLiteral("configurationOk")] = network->configurationOk();
314
315 result[QStringLiteral("defaultAddress")] = network->defaultAddress();
316 result[QStringLiteral("defaultTcpPort")] = network->defaultTcpPort();
317 result[QStringLiteral("defaultUdpLocalPort")] = network->defaultUdpLocalPort();
318 result[QStringLiteral("defaultUdpRemotePort")] = network->defaultUdpRemotePort();
319
320 return CommandResponse::makeSuccess(id, result);
321}
322
323/**
324 * @brief Get available socket types

Callers

nothing calls this directly

Calls 14

networkMethod · 0.80
tcpPortMethod · 0.80
udpLocalPortMethod · 0.80
udpRemotePortMethod · 0.80
socketTypeIndexMethod · 0.80
socketTypesMethod · 0.80
udpMulticastMethod · 0.80
lookupActiveMethod · 0.80
defaultTcpPortMethod · 0.80
defaultUdpLocalPortMethod · 0.80
defaultUdpRemotePortMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected