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
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
class LogFile : public QIODevice {
|
2010-09-21 09:07:39 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit LogFile(QObject *parent = 0);
|
2010-09-21 21:28:01 +02:00
|
|
|
qint64 bytesAvailable() const;
|
2013-05-19 16:37:30 +02:00
|
|
|
qint64 bytesToWrite()
|
|
|
|
{
|
|
|
|
return file.bytesToWrite();
|
|
|
|
};
|
2010-09-21 09:07:39 +02:00
|
|
|
bool open(OpenMode mode);
|
2013-05-19 16:37:30 +02:00
|
|
|
void setFileName(QString name)
|
|
|
|
{
|
|
|
|
file.setFileName(name);
|
|
|
|
};
|
2010-09-21 09:07:39 +02:00
|
|
|
void close();
|
2013-05-19 16:37:30 +02:00
|
|
|
qint64 writeData(const char *data, qint64 dataSize);
|
|
|
|
qint64 readData(char *data, qint64 maxlen);
|
2010-09-21 21:28:01 +02:00
|
|
|
|
|
|
|
bool startReplay();
|
|
|
|
bool stopReplay();
|
2010-09-21 09:07:39 +02:00
|
|
|
|
|
|
|
public slots:
|
2013-05-19 16:37:30 +02:00
|
|
|
void setReplaySpeed(double val)
|
|
|
|
{
|
2013-10-09 07:35:07 +02:00
|
|
|
playbackSpeed = val;
|
|
|
|
qDebug() << "Playback speed is now" << playbackSpeed;
|
2013-05-19 16:37:30 +02:00
|
|
|
};
|
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();
|
2011-03-13 23:27:26 +01:00
|
|
|
void replayStarted();
|
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-11-25 15:11:58 +01:00
|
|
|
qint32 lastPlayed;
|
2011-01-20 23:28:38 +01:00
|
|
|
QMutex mutex;
|
|
|
|
|
2010-09-21 23:43:23 +02:00
|
|
|
|
|
|
|
int timeOffset;
|
|
|
|
double playbackSpeed;
|
2010-09-21 09:07:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOGFILE_H
|