Commit a3943266 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #697 from Susurrus/serialport

Removed constant debugging output from scanning for serial ports.
parents d222658a eeb0d547
......@@ -99,19 +99,11 @@ QList<QString> SerialLink::getCurrentPorts()
m_ports.clear();
QList<QSerialPortInfo> portList = QSerialPortInfo::availablePorts();
if( portList.count() == 0){
qDebug() << "No Ports Found" << m_ports;
}
foreach (const QSerialPortInfo &info, portList)
{
// qDebug() << "PortName : " << info.portName()
// << "Description : " << info.description();
// qDebug() << "Manufacturer: " << info.manufacturer();
m_ports.append(info.portName());
}
return m_ports;
}
......
......@@ -55,7 +55,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
action = new QAction(QIcon(":/files/images/devices/network-wireless.svg"), "", this);
setLinkName(link->getName());
setupPortList();
// Scan for serial ports. Let the user know if none were found for debugging purposes
if (!setupPortList()) {
qDebug() << "No serial ports found.";
}
// Set up baud rates
ui.baudRate->clear();
......@@ -213,9 +216,9 @@ void SerialConfigurationWindow::configureCommunication()
this->show();
}
void SerialConfigurationWindow::setupPortList()
bool SerialConfigurationWindow::setupPortList()
{
if (!link) return;
if (!link) return false;
// Get the ports available on this system
QList<QString> ports = link->getCurrentPorts();
......@@ -240,6 +243,8 @@ void SerialConfigurationWindow::setupPortList()
if (storedFound)
ui.portName->setEditText(storedName);
return (ports.count() > 0);
}
void SerialConfigurationWindow::enableFlowControl(bool flow)
......
......@@ -60,7 +60,13 @@ public slots:
void setParityEven(bool accept);
void setPortName(QString port);
void setLinkName(QString name);
void setupPortList();
/**
* @brief setupPortList Populates the dropdown with the list of available serial ports.
* This function is called at 1s intervals to check that the serial port still exists and to see if
* any new ones have been attached.
* @return True if any ports were found, false otherwise.
*/
bool setupPortList();
protected:
void showEvent(QShowEvent* event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment