#ifndef PORTUART_H #define PORTUART_H #include #include #include #include class PortUART : public QObject { Q_OBJECT public: explicit PortUART(QObject *parent = nullptr); ~PortUART(); signals: void signalReadedPortIO(QByteArray Str); //Resived data void signalErrComPort(QSerialPort::SerialPortError err); //Retranslate Error public slots: bool setComData(QString name, QSerialPort::BaudRate baud, QSerialPort::DataBits databits, QSerialPort::Parity parbits, QSerialPort::StopBits stopbits, QSerialPort::FlowControl qflow_control); bool open(void); bool close(void); QString getName(); qint64 WriteToPort(QByteArray message); bool isOpen(void); bool isWritable(void); bool isReadable(void); void read(); void errorSerail(QSerialPort::SerialPortError err); void timerOverflow(void); private: QTimer *pTimer; int timeInterval = 1000; QByteArray rcBuffer; QSerialPort *serial = nullptr; QString port_name; QSerialPort::BaudRate baud_rate; QSerialPort::DataBits data_bits; QSerialPort::Parity parity; QSerialPort::StopBits stop_bits; QSerialPort::FlowControl flow_control; }; #endif // PORTUART_H