#ifndef SERIAL_INC_H
#define SERIAL_INC_H

//#include <QDebug>
#include <sys/wait.h>
#include <QSerialPort>
#include <QSerialPortInfo>
//#include <QApplication>
#include <iostream>

class SerialManager : public QSerialPort
{
    Q_OBJECT

    public:
        //QSerialPort * sp;
        QByteArray dataRead;
        QByteArray dataWrite;
        qint64 dataWriteSize;
        QString serialDevicePath;
        QString deviceName;
        QString portName;
        QString serialDeviceDescription;
        QString serialDeviceManufacturer;
        QString serialDeviceNumber;
        QString serialDeviceVendor;
        QString serialDeviceProduct;
        quint32 baudRate = 115200;

        SerialManager();
        ~SerialManager();

        void initSerial();
        bool findSerialDevice();
        bool openSerialPort();
        void write2serial(QByteArray);

        //void getData();

    signals:
        void datasReady(QByteArray);

    public slots:
        void serialError(QSerialPort::SerialPortError);
};


#endif // SERIAL_INC_H
