This commit is contained in:
hm
2020-08-19 14:12:36 +08:00
parent 097b9a7056
commit 044c660ea6
7 changed files with 345 additions and 15 deletions
+84
View File
@@ -0,0 +1,84 @@
#ifndef REPLAY_H
#define REPLAY_H
#include <QObject>
#include "QThread"
#include "QMessageBox"
#include "QDebug"
#include "QFile"
#include "replay.h"
#include "QDataStream"
#ifdef QtDlink
#include <dlinkglobal.h>
class DLINKSHARED_EXPORT Replay : public QObject {
#else
class Replay : public QObject
{
#endif
Q_OBJECT
typedef struct {
qint32 max_size;
quint8 select;
QByteArray buff[2];
}_buffdef;
public:
explicit Replay(QObject *parent = nullptr);
~Replay();
QByteArray readAll(void);
void setLogfile(QString name);
signals:
void showMessage(const QString &message,int TimeOut = 0);
void readReady();
public slots:
//线程对外接口
void setRunFrq(uint32_t frq);
void start();
void stop();
bool isActive(void)
{
return running_flag;
}
//缓存对外接口
private slots:
//线程私有接口
void process();
protected:
bool running_flag = false;
quint32 running_frq = 200;//200Hz
QThread *thread = nullptr;
QString logFile;
QFile *file = nullptr;
//QDataStream *stream = nullptr;
float percentage = 0;
int position = 0;
bool ispause = false;//控制暂停
bool isplaying = false;//控制开始和结束
QByteArray buff;
};
#endif // MAVLINKNODE_H