QGCMAVLinkLogPlayer.h 1.38 KB
Newer Older
1 2 3 4 5 6 7
#ifndef QGCMAVLINKLOGPLAYER_H
#define QGCMAVLINKLOGPLAYER_H

#include <QWidget>
#include <QFile>

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

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

/**
 * @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
28
    explicit QGCMAVLinkLogPlayer(QWidget *parent = 0);
29
    ~QGCMAVLinkLogPlayer();
30

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

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

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

Don Gagne's avatar
Don Gagne committed
59
#endif