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

Method setPortIndex

app/src/IO/Drivers/UART.cpp:528–543  ·  view source on GitHub ↗

* @brief Changes the port index value, later used by openSerialPort(). */

Source from the content-addressed store, hash-verified

526 * @brief Changes the port index value, later used by openSerialPort().
527 */
528void IO::Drivers::UART::setPortIndex(const quint8 portIndex)
529{
530 if (m_deviceNames.isEmpty())
531 refreshSerialDevices();
532
533 if (portIndex < portList().count())
534 m_portIndex = portIndex;
535 else
536 m_portIndex = 0;
537
538 const auto name = portList().at(m_portIndex);
539 if (!name.isEmpty() && m_portIndex > 0)
540 m_settings.setValue("IO_Serial_SelectedDevice", name);
541
542 Q_EMIT portIndexChanged();
543}
544
545/**
546 * @brief Registers a custom serial device by path.

Callers

nothing calls this directly

Calls 2

isEmptyMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected