2010-09-21 09:07:39 +02:00
|
|
|
#ifndef LOGFILE_H
|
|
|
|
#define LOGFILE_H
|
|
|
|
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <QTime>
|
2010-09-21 21:28:01 +02:00
|
|
|
#include <QTimer>
|
2011-01-20 23:28:38 +01:00
|
|
|
#include <QMutexLocker>
|
2010-09-21 09:07:39 +02:00
|
|
|
#include <QDebug>
|
2010-09-21 21:28:01 +02:00
|
|
|
#include <QBuffer>
|
2011-01-22 18:38:22 +01:00
|
|
|
#include "uavobjectmanager.h"
|
2010-09-21 23:43:23 +02:00
|
|
|
#include <math.h>
|
2010-09-21 09:07:39 +02:00
|
|
|
|
|
|
|
class LogFile : public QIODevice
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit LogFile(QObject *parent = 0);
|
2010-09-21 21:28:01 +02:00
|
|
|
qint64 bytesAvailable() const;
|
2010-09-21 09:07:39 +02:00
|
|
|
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);
|
2010-09-21 21:28:01 +02:00
|
|
|
qint64 readData(char * data, qint64 maxlen);
|
|
|
|
|
|
|
|
bool startReplay();
|
|
|
|
bool stopReplay();
|
2010-09-21 09:07:39 +02:00
|
|
|
|
|
|
|
public slots:
|
2011-03-05 00:22:49 +01:00
|
|
|
void setReplaySpeed(double val) { playbackSpeed = pow(10,(val)/100); qDebug() << playbackSpeed; };
|
2010-09-21 23:43:23 +02:00
|
|
|
void pauseReplay();
|
|
|
|
void resumeReplay();
|
|
|
|
|
|
|
|
protected slots:
|
2010-09-21 21:28:01 +02:00
|
|
|
void timerFired();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void readReady();
|
2010-09-22 03:04:24 +02:00
|
|
|
void replayFinished();
|
2010-09-21 21:28:01 +02:00
|
|
|
|
2010-09-21 09:07:39 +02:00
|
|
|
protected:
|
2010-09-21 21:28:01 +02:00
|
|
|
QByteArray dataBuffer;
|
|
|
|
QTimer timer;
|
2010-09-21 09:07:39 +02:00
|
|
|
QTime myTime;
|
|
|
|
QFile file;
|
2010-09-21 21:28:01 +02:00
|
|
|
qint32 lastTimeStamp;
|
2011-01-20 23:28:38 +01:00
|
|
|
QMutex mutex;
|
|
|
|
|
2010-09-21 23:43:23 +02:00
|
|
|
|
|
|
|
int timeOffset;
|
|
|
|
int pausedTime;
|
|
|
|
double playbackSpeed;
|
2010-09-21 09:07:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOGFILE_H
|