#ifndef PORT_H
#define PORT_H

#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>

class SerialPort : public QObject {
  Q_OBJECT
public:
  SerialPort();
  ~SerialPort();

private:
  QSerialPort *serialPort; // serial port
  volatile bool opened;    // opened
  void portSetup();        // port setup

signals:
  void newData(const QByteArray &); // emit data
  void openStatus(bool);            // emit open status

public slots:
  void requestToStop();         // request to stop
  void requestOpen(QString);    // request to open
  void requestSend(QByteArray); // send data
  void readData();              // read data
};

#endif // PORT_H
