40 lines
622 B
C++
40 lines
622 B
C++
#ifndef SERIALWATCHER_H
|
|
#define SERIALWATCHER_H
|
|
#include "serial_io.h"
|
|
|
|
#define BUFFER_SIZE 128
|
|
|
|
#include<QString>
|
|
#include<QObject>
|
|
#include<QRunnable>
|
|
#include<QScopedPointer>
|
|
#include<QEventLoop>
|
|
#include<QTimer>
|
|
|
|
class SerialWatcher: public QObject, public QRunnable
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
|
|
QScopedPointer<QEventLoop> loop;
|
|
int _serial;
|
|
|
|
QString _buffer;
|
|
|
|
public:
|
|
explicit SerialWatcher(int serial, QObject *parent = 0);
|
|
~SerialWatcher();
|
|
|
|
signals:
|
|
void textRecived(const QString string);
|
|
|
|
public slots:
|
|
void run();
|
|
void abort();
|
|
|
|
void doTick();
|
|
};
|
|
|
|
|
|
#endif // SERIALWATCHER_H
|