if you want to skip this part and jump to another part
Part 1 MainWindow
Part 2 readyRead signal
Part 3 openSerialPort
Part 5 writeData
Part 6 readData
Clicking on the Disconnect button invokes the closeSerialPort() slot:
void MainWindow::closeSerialPort()
{
if (m_serial->isOpen())
m_serial->close();
m_console->setEnabled(false);
m_ui->actionConnect->setEnabled(true);
m_ui->actionDisconnect->setEnabled(false);
m_ui->actionConfigure->setEnabled(true);
showStatusMessage(tr("Disconnected"));
}
In this case, handled by the closure of the serial port.
Remember we are NOT using m_ui UI:: code
we are using a MainWindow and all code is inside this MainWindow
textEdit-> is now our m_console->
and I rewrote the code to use statusBar->
'------------------------------------------------
SUB closeSerialPort_cb()
'------------------------------------------------
'#5
'Clicking on the Disconnect button
'invokes the closeSerialPort
IF (m_serial->isOpen()) THEN
m_serial->close()
END IF
textEdit->setEnabled(false)
actionConnect->setEnabled(true)
actionDisconnect->setEnabled(false)
actionConfigure->setEnabled(true)
statusBar->showMessage("Disconnected")
END SUB