* @brief Configures and connects a UDP socket from CLI options. */
| 538 | * @brief Configures and connects a UDP socket from CLI options. |
| 539 | */ |
| 540 | void 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 |
nothing calls this directly
no test coverage detected