diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -179,10 +179,6 @@ MainWindow::MainWindow(QWidget *parent) QObject::connect(snapshotMan.takeSnapshotAction(), &QAction::triggered, plotMan, &PlotManager::flashSnapshotOverlay); - // init port signals - QObject::connect(&(this->serialPort), SIGNAL(error(QSerialPort::SerialPortError)), - this, SLOT(onPortError(QSerialPort::SerialPortError))); - // init data format and reader QObject::connect(&channelMan, &ChannelManager::dataAdded, plotMan, &PlotManager::replot); @@ -372,64 +368,6 @@ void MainWindow::onPortToggled(bool open ui->actionDemoMode->setEnabled(!open); } -void MainWindow::onPortError(QSerialPort::SerialPortError error) -{ - switch(error) - { - case QSerialPort::NoError : - break; - case QSerialPort::ResourceError : - qWarning() << "Port error: resource unavaliable; most likely device removed."; - if (serialPort.isOpen()) - { - qWarning() << "Closing port on resource error: " << serialPort.portName(); - portControl.togglePort(); - } - portControl.loadPortList(); - break; - case QSerialPort::DeviceNotFoundError: - qCritical() << "Device doesn't exists: " << serialPort.portName(); - break; - case QSerialPort::PermissionError: - qCritical() << "Permission denied. Either you don't have \ -required privileges or device is already opened by another process."; - break; - case QSerialPort::OpenError: - qWarning() << "Device is already opened!"; - break; - case QSerialPort::NotOpenError: - qCritical() << "Device is not open!"; - break; - case QSerialPort::ParityError: - qCritical() << "Parity error detected."; - break; - case QSerialPort::FramingError: - qCritical() << "Framing error detected."; - break; - case QSerialPort::BreakConditionError: - qCritical() << "Break condition is detected."; - break; - case QSerialPort::WriteError: - qCritical() << "An error occurred while writing data."; - break; - case QSerialPort::ReadError: - qCritical() << "An error occurred while reading data."; - break; - case QSerialPort::UnsupportedOperationError: - qCritical() << "Operation is not supported."; - break; - case QSerialPort::TimeoutError: - qCritical() << "A timeout error occurred."; - break; - case QSerialPort::UnknownError: - qCritical() << "Unknown error! Error: " << serialPort.errorString(); - break; - default: - qCritical() << "Unhandled port error: " << error; - break; - } -} - void MainWindow::clearPlot() { for (unsigned ci = 0; ci < channelMan.numOfChannels(); ci++)