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

Method setupUdpConnection

app/src/Misc/CLI.cpp:540–560  ·  view source on GitHub ↗

* @brief Configures and connects a UDP socket from CLI options. */

Source from the content-addressed store, hash-verified

538 * @brief Configures and connects a UDP socket from CLI options.
539 */
540void CLI::setupUdpConnection()
541{
542 bool ok = false;
543 const quint16 localPort = m_parser.value(m_opts.udpOpt).toUInt(&ok);
544 if (!ok || localPort == 0) {
545 qWarning() << "Invalid UDP local port:" << m_parser.value(m_opts.udpOpt);
546 return;
547 }
548
549 IO::ConnectionManager::instance().setBusType(SerialStudio::BusType::Network);
550 IO::ConnectionManager::instance().network()->setUdpSocket();
551 IO::ConnectionManager::instance().network()->setUdpLocalPort(localPort);
552
553 if (m_parser.isSet(m_opts.udpMulticastOpt))
554 IO::ConnectionManager::instance().network()->setUdpMulticast(true);
555
556 if (m_parser.isSet(m_opts.udpRemoteOpt))
557 applyUdpRemote(m_parser.value(m_opts.udpRemoteOpt));
558
559 IO::ConnectionManager::instance().connectDevice();
560}
561
562//---------------------------------------------------------------------------------------------------
563// Commercial: shortcut/runtime/exports

Callers

nothing calls this directly

Calls 8

applyUdpRemoteFunction · 0.85
setUdpSocketMethod · 0.80
networkMethod · 0.80
connectDeviceMethod · 0.80
valueMethod · 0.45
setBusTypeMethod · 0.45
setUdpLocalPortMethod · 0.45
setUdpMulticastMethod · 0.45

Tested by

no test coverage detected