void Dialog::usbConnectionDataSlot() { if (rtpUSB_is_available == false) { foreach(const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()) { if(serialPortInfo.hasVendorIdentifier()) { if(serialPortInfo.vendorIdentifier() == arduino_due_vendor_id) { rtpUSB_is_available = true; rtpUSB_cancel_enable = false; rtpUSB_port_name = serialPortInfo.portName(); rtpUSB->setPort(serialPortInfo); rtpUSB->setBaudRate(QSerialPort::Baud115200); rtpUSB->setDataBits(QSerialPort::Data8); rtpUSB->setParity(QSerialPort::NoParity); rtpUSB->setStopBits(QSerialPort::OneStop); rtpUSB->setFlowControl(QSerialPort::HardwareControl); rtpUSB->open(QIODevice::ReadWrite); } } } } else { dialog_ui->startPressurePlot->setEnabled(true); dialog_ui->usbStatus->setText("Status: USB port established."); dialog_ui->connectUSB->setText("Break USB connection."); dialog_ui->connectUSB->setEnabled(true); button_state = false; usbConnectionTimer.stop(); } }