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>
|
2010-09-21 09:07:39 +02:00
|
|
|
#include <QDebug>
|
2010-09-21 21:28:01 +02:00
|
|
|
#include <QBuffer>
|
2010-09-21 09:07:39 +02:00
|
|
|
#include <uavobjects/uavobjectmanager.h>
|
|
|
|
|
|
|
|
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:
|
2010-09-21 21:28:01 +02:00
|
|
|
void timerFired();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void readReady();
|
|
|
|
|
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;
|
2010-09-21 09:07:39 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOGFILE_H
|