QGCMAVLinkInspector.h 1.3 KB
Newer Older
lm's avatar
lm committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#ifndef QGCMAVLINKINSPECTOR_H
#define QGCMAVLINKINSPECTOR_H

#include <QWidget>
#include <QMap>
#include <QTimer>

#include "MAVLinkProtocol.h"

namespace Ui {
    class QGCMAVLinkInspector;
}

class QTreeWidgetItem;

class QGCMAVLinkInspector : public QWidget
{
    Q_OBJECT

public:
    explicit QGCMAVLinkInspector(MAVLinkProtocol* protocol, QWidget *parent = 0);
    ~QGCMAVLinkInspector();

public slots:
    void receiveMessage(LinkInterface* link,mavlink_message_t message);
    void refreshView();

protected:
29
    QMap<int, quint64> lastMessageUpdate; ///< Used to switch between highlight and non-highlighting color
30
    QMap<int, float> messagesHz; ///< Used to store update rate in Hz
LM's avatar
LM committed
31
    QMap<int, unsigned int> messageCount; ///< Used to store the message count
lm's avatar
lm committed
32
    mavlink_message_t receivedMessages[256]; ///< Available / known messages
lm's avatar
lm committed
33 34
    QMap<int, QTreeWidgetItem*> treeWidgetItems;   ///< Available tree widget items
    QTimer updateTimer; ///< Only update at 1 Hz to not overload the GUI
lm's avatar
lm committed
35 36 37 38
    mavlink_message_info_t messageInfo[256];

    // Update one message field
    void updateField(int msgid, int fieldid, QTreeWidgetItem* item);
lm's avatar
lm committed
39

LM's avatar
LM committed
40 41 42
    static const unsigned int updateInterval = 1000;
    static const float updateHzLowpass = 0.2f;

lm's avatar
lm committed
43 44 45 46 47
private:
    Ui::QGCMAVLinkInspector *ui;
};

#endif // QGCMAVLINKINSPECTOR_H