Changeset - b259a534fe68
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-05-26 08:50:20
hy@ozderya.net
advanced port settings are applied after opening port
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
portcontrol.cpp
Show inline comments
 
@@ -206,33 +206,33 @@ void PortControl::togglePort()
 
    {
 
        serialPort->close();
 
        qDebug() << "Port closed, " << serialPort->portName();
 
        emit portToggled(false);
 
    }
 
    else
 
    {
 
        serialPort->setPortName(ui->cbPortList->currentText());
 

	
 
        // open port
 
        if (serialPort->open(QIODevice::ReadWrite))
 
        {
 
            // set port settings
 
            selectBaudRate(ui->cbBaudRate->currentText());
 
            selectParity((QSerialPort::Parity) parityButtons.checkedId());
 
            selectDataBits((QSerialPort::DataBits) dataBitsButtons.checkedId());
 
            selectStopBits((QSerialPort::StopBits) stopBitsButtons.checkedId());
 
            selectFlowControl((QSerialPort::FlowControl) flowControlButtons.checkedId());
 

	
 
            qDebug() << "Port opened, " << serialPort->portName();
 
            emit portToggled(true);
 

	
 
            // set baud rate
 
            if (!serialPort->setBaudRate(ui->cbBaudRate->currentText().toInt()))
 
            {
 
                qDebug() << "Set baud rate failed during port opening: "
 
                         << serialPort->error();
 
            }
 
        }
 
        else
 
        {
 
            qDebug() << "Port open error: " << serialPort->error();
 
        }
 
    }
 
    ui->pbOpenPort->setChecked(serialPort->isOpen());
 
}
 

	
 
void PortControl::selectPort(QString portName)
 
{
 
    // has selection actually changed
0 comments (0 inline, 0 general)