LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / utils / logfile.h
blob0f84ad5d8e041718353914fb221dafa776f11fdc
1 #ifndef LOGFILE_H
2 #define LOGFILE_H
4 #include <QIODevice>
5 #include <QTime>
6 #include <QTimer>
7 #include <QMutexLocker>
8 #include <QDebug>
9 #include <QBuffer>
10 #include <QFile>
11 #include "utils_global.h"
13 class QTCREATOR_UTILS_EXPORT LogFile : public QIODevice {
14 Q_OBJECT
15 public:
16 explicit LogFile(QObject *parent = 0);
17 qint64 bytesAvailable() const;
18 qint64 bytesToWrite() const
20 return m_file.bytesToWrite();
22 bool open(OpenMode mode);
23 void setFileName(QString name)
25 m_file.setFileName(name);
27 void close();
28 qint64 writeData(const char *data, qint64 dataSize);
29 qint64 readData(char *data, qint64 maxlen);
31 bool startReplay();
32 bool stopReplay();
33 void useProvidedTimeStamp(bool useProvidedTimeStamp)
35 m_useProvidedTimeStamp = useProvidedTimeStamp;
38 void setNextTimeStamp(quint32 nextTimestamp)
40 m_nextTimeStamp = nextTimestamp;
43 public slots:
44 void setReplaySpeed(double val)
46 m_playbackSpeed = val;
47 qDebug() << "Playback speed is now" << m_playbackSpeed;
49 void pauseReplay();
50 void resumeReplay();
52 protected slots:
53 void timerFired();
55 signals:
56 void readReady();
57 void replayStarted();
58 void replayFinished();
60 protected:
61 QByteArray m_dataBuffer;
62 QTimer m_timer;
63 QTime m_myTime;
64 QFile m_file;
65 qint32 m_lastTimeStamp;
66 qint32 m_lastPlayed;
67 QMutex m_mutex;
70 int m_timeOffset;
71 double m_playbackSpeed;
73 private:
74 quint32 m_nextTimeStamp;
75 bool m_useProvidedTimeStamp;
78 #endif // LOGFILE_H