QGCMAVLinkLogPlayer.h 1.33 KB
Newer Older
1
#pragma once
2 3 4 5 6

#include <QWidget>
#include <QFile>

#include "MAVLinkProtocol.h"
7
#include "LinkInterface.h"
Don Gagne's avatar
Don Gagne committed
8
#include "LogReplayLink.h"
9

10 11 12
namespace Ui
{
class QGCMAVLinkLogPlayer;
13 14 15 16 17 18 19 20 21 22 23 24 25 26
}

/**
 * @brief Replays MAVLink log files
 *
 * This class allows to replay MAVLink logs at varying speeds.
 * captured flights can be replayed, shown to others and analyzed
 * in-depth later on.
 */
class QGCMAVLinkLogPlayer : public QWidget
{
    Q_OBJECT

public:
Don Gagne's avatar
Don Gagne committed
27
    explicit QGCMAVLinkLogPlayer(QWidget *parent = 0);
28
    ~QGCMAVLinkLogPlayer();
29

Don Gagne's avatar
Don Gagne committed
30 31
private slots:
    void _selectLogFileForPlayback(void);
Don Gagne's avatar
Don Gagne committed
32 33 34
    void _playPauseToggle(void);
    void _pause(void);
    void _setPlayheadFromSlider(int value);
35
#if 0
Don Gagne's avatar
Don Gagne committed
36
    void _setAccelerationFromSlider(int value);
37
#endif
Don Gagne's avatar
Don Gagne committed
38 39 40 41 42 43
    void _logFileStats(bool logTimestamped, int logDurationSeconds, int binaryBaudRate);
    void _playbackStarted(void);
    void _playbackPaused(void);
    void _playbackPercentCompleteChanged(int percentComplete);
    void _playbackError(void);
    void _replayLinkDisconnected(void);
44
    void _setCurrentLogTime(int secs);
Lorenz Meier's avatar
Lorenz Meier committed
45

46
private:
Don Gagne's avatar
Don Gagne committed
47 48 49
    void _finishPlayback(void);
    QString _secondsToHMS(int seconds);
    void _enablePlaybackControls(bool enabled);
50

Don Gagne's avatar
Don Gagne committed
51 52
    LogReplayLink*  _replayLink;
    int             _logDurationSeconds;
53
    int             _lastCurrentTime;
Don Gagne's avatar
Don Gagne committed
54
    
Don Gagne's avatar
Don Gagne committed
55
    Ui::QGCMAVLinkLogPlayer* _ui;
56 57
};