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

Method setupUartConnection

app/src/Misc/CLI.cpp:469–488  ·  view source on GitHub ↗

* @brief Configures and connects the UART bus from CLI options. */

Source from the content-addressed store, hash-verified

467 * @brief Configures and connects the UART bus from CLI options.
468 */
469void CLI::setupUartConnection()
470{
471 IO::ConnectionManager::instance().setBusType(SerialStudio::BusType::UART);
472
473 if (m_parser.isSet(m_opts.uartOpt)) {
474 const QString device = m_parser.value(m_opts.uartOpt);
475 IO::ConnectionManager::instance().uart()->registerDevice(device);
476 }
477
478 if (m_parser.isSet(m_opts.baudOpt)) {
479 bool ok = false;
480 const qint32 baudRate = m_parser.value(m_opts.baudOpt).toInt(&ok);
481 if (!ok)
482 qWarning() << "Invalid baud rate:" << m_parser.value(m_opts.baudOpt);
483 else
484 IO::ConnectionManager::instance().uart()->setBaudRate(baudRate);
485 }
486
487 IO::ConnectionManager::instance().connectDevice();
488}
489
490/**
491 * @brief Configures and connects a TCP socket from a CLI host:port string.

Callers

nothing calls this directly

Calls 6

registerDeviceMethod · 0.80
uartMethod · 0.80
connectDeviceMethod · 0.80
setBusTypeMethod · 0.45
valueMethod · 0.45
setBaudRateMethod · 0.45

Tested by

no test coverage detected