mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-05 16:46:06 +01:00
57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#ifndef LOGFILE_H
|
|
#define LOGFILE_H
|
|
|
|
#include <QIODevice>
|
|
#include <QTime>
|
|
#include <QTimer>
|
|
#include <QMutexLocker>
|
|
#include <QDebug>
|
|
#include <QBuffer>
|
|
#include "uavobjectmanager.h"
|
|
#include <math.h>
|
|
|
|
class LogFile : public QIODevice
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit LogFile(QObject *parent = 0);
|
|
qint64 bytesAvailable() const;
|
|
qint64 bytesToWrite() { return file.bytesToWrite(); };
|
|
bool open(OpenMode mode);
|
|
void setFileName(QString name) { file.setFileName(name); };
|
|
void close();
|
|
qint64 writeData(const char * data, qint64 dataSize);
|
|
qint64 readData(char * data, qint64 maxlen);
|
|
|
|
bool startReplay();
|
|
bool stopReplay();
|
|
|
|
public slots:
|
|
void setReplaySpeed(double val) { playbackSpeed = val; qDebug() << playbackSpeed; };
|
|
void pauseReplay();
|
|
void resumeReplay();
|
|
|
|
protected slots:
|
|
void timerFired();
|
|
|
|
signals:
|
|
void readReady();
|
|
void replayStarted();
|
|
void replayFinished();
|
|
|
|
protected:
|
|
QByteArray dataBuffer;
|
|
QTimer timer;
|
|
QTime myTime;
|
|
QFile file;
|
|
qint32 lastTimeStamp;
|
|
qint32 lastPlayed;
|
|
QMutex mutex;
|
|
|
|
|
|
int timeOffset;
|
|
double playbackSpeed;
|
|
};
|
|
|
|
#endif // LOGFILE_H
|