2 ******************************************************************************
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
6 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
7 * @see The GNU Public License (GPL) Version 3
9 *****************************************************************************/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "utils_global.h"
33 #include <QMutexLocker>
38 class QTCREATOR_UTILS_EXPORT LogFile
: public QIODevice
{
41 explicit LogFile(QObject
*parent
= 0);
43 QString
fileName() const
45 return m_file
.fileName();
47 void setFileName(QString name
)
49 m_file
.setFileName(name
);
52 bool isSequential() const;
54 bool isPlaying() const;
56 bool open(OpenMode mode
);
59 qint64
bytesAvailable() const;
60 qint64
bytesToWrite() const
62 return m_file
.bytesToWrite();
65 qint64
writeData(const char *data
, qint64 dataSize
);
66 qint64
readData(char *data
, qint64 maxlen
);
68 void useProvidedTimeStamp(bool useProvidedTimeStamp
)
70 m_useProvidedTimeStamp
= useProvidedTimeStamp
;
73 void setNextTimeStamp(quint32 providedTimestamp
)
75 m_providedTimeStamp
= providedTimestamp
;
79 void setReplaySpeed(double val
)
81 m_playbackSpeed
= val
;
82 qDebug() << "Playback speed is now" << m_playbackSpeed
;
95 void replayFinished();
98 QByteArray m_dataBuffer
;
102 qint32 m_previousTimeStamp
;
103 qint32 m_nextTimeStamp
;
105 // QMutex wants to be mutable
106 // http://stackoverflow.com/questions/25521570/can-mutex-locking-function-be-marked-as-const
107 mutable QMutex m_mutex
;
110 double m_playbackSpeed
;
114 bool m_useProvidedTimeStamp
;
115 qint32 m_providedTimeStamp
;