MainToolBarController.h 3.92 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9 10 11 12 13 14 15 16


/**
 * @file
 *   @brief QGC Main Tool Bar
 *   @author Gus Grubba <mavlink@grubba.com>
 */

17 18
#ifndef MainToolBarController_H
#define MainToolBarController_H
dogmaphobic's avatar
dogmaphobic committed
19

20 21 22 23
#include <QObject>

#include "Vehicle.h"
#include "UASMessageView.h"
dogmaphobic's avatar
dogmaphobic committed
24

25 26 27 28 29
#define TOOL_BAR_SETTINGS_GROUP "TOOLBAR_SETTINGS_GROUP"
#define TOOL_BAR_SHOW_BATTERY   "ShowBattery"
#define TOOL_BAR_SHOW_GPS       "ShowGPS"
#define TOOL_BAR_SHOW_MAV       "ShowMav"
#define TOOL_BAR_SHOW_MESSAGES  "ShowMessages"
30
#define TOOL_BAR_SHOW_RSSI      "ShowRSSI"
31

32
class MainToolBarController : public QObject
dogmaphobic's avatar
dogmaphobic committed
33 34
{
    Q_OBJECT
35

36 37 38
public:
    MainToolBarController(QObject* parent = NULL);
    ~MainToolBarController();
39

Don Gagne's avatar
Don Gagne committed
40 41 42 43
    Q_PROPERTY(double       height              MEMBER _toolbarHeight           NOTIFY heightChanged)
    Q_PROPERTY(float        progressBarValue    MEMBER _progressBarValue        NOTIFY progressBarValueChanged)
    Q_PROPERTY(int          telemetryRRSSI      READ telemetryRRSSI             NOTIFY telemetryRRSSIChanged)
    Q_PROPERTY(int          telemetryLRSSI      READ telemetryLRSSI             NOTIFY telemetryLRSSIChanged)
dogmaphobic's avatar
dogmaphobic committed
44 45 46 47 48
    Q_PROPERTY(unsigned int telemetryRXErrors   READ telemetryRXErrors          NOTIFY telemetryRXErrorsChanged)
    Q_PROPERTY(unsigned int telemetryFixed      READ telemetryFixed             NOTIFY telemetryFixedChanged)
    Q_PROPERTY(unsigned int telemetryTXBuffer   READ telemetryTXBuffer          NOTIFY telemetryTXBufferChanged)
    Q_PROPERTY(unsigned int telemetryLNoise     READ telemetryLNoise            NOTIFY telemetryLNoiseChanged)
    Q_PROPERTY(unsigned int telemetryRNoise     READ telemetryRNoise            NOTIFY telemetryRNoiseChanged)
49

50
    void        viewStateChanged        (const QString& key, bool value);
dogmaphobic's avatar
dogmaphobic committed
51

52 53
    int         telemetryRRSSI          () { return _telemetryRRSSI; }
    int         telemetryLRSSI          () { return _telemetryLRSSI; }
dogmaphobic's avatar
dogmaphobic committed
54 55 56 57 58
    unsigned int telemetryRXErrors      () { return _telemetryRXErrors; }
    unsigned int telemetryFixed         () { return _telemetryFixed; }
    unsigned int telemetryTXBuffer      () { return _telemetryTXBuffer; }
    unsigned int telemetryLNoise        () { return _telemetryLNoise; }
    unsigned int telemetryRNoise        () { return _telemetryRNoise; }
dogmaphobic's avatar
dogmaphobic committed
59

dogmaphobic's avatar
dogmaphobic committed
60
signals:
61
    void progressBarValueChanged        (float value);
62 63
    void telemetryRRSSIChanged          (int value);
    void telemetryLRSSIChanged          (int value);
Don Gagne's avatar
Don Gagne committed
64
    void heightChanged                  (double height);
dogmaphobic's avatar
dogmaphobic committed
65 66 67 68 69
    void telemetryRXErrorsChanged       (unsigned int value);
    void telemetryFixedChanged          (unsigned int value);
    void telemetryTXBufferChanged       (unsigned int value);
    void telemetryLNoiseChanged         (unsigned int value);
    void telemetryRNoiseChanged         (unsigned int value);
dogmaphobic's avatar
dogmaphobic committed
70

dogmaphobic's avatar
dogmaphobic committed
71
private slots:
72
    void _activeVehicleChanged          (Vehicle* vehicle);
73
    void _setProgressBarValue           (float value);
74
    void _telemetryChanged              (LinkInterface* link, unsigned rxerrors, unsigned fixed, int rssi, int remrssi, unsigned txbuf, unsigned noise, unsigned remnoise);
dogmaphobic's avatar
dogmaphobic committed
75 76

private:
77
    Vehicle*        _vehicle;
dogmaphobic's avatar
dogmaphobic committed
78
    UASInterface*   _mav;
79
    float           _progressBarValue;
dogmaphobic's avatar
dogmaphobic committed
80
    double          _remoteRSSIstore;
81 82
    int             _telemetryRRSSI;
    int             _telemetryLRSSI;
dogmaphobic's avatar
dogmaphobic committed
83 84 85 86 87 88
    uint32_t        _telemetryRXErrors;
    uint32_t        _telemetryFixed;
    uint32_t        _telemetryTXBuffer;
    uint32_t        _telemetryLNoise;
    uint32_t        _telemetryRNoise;

Don Gagne's avatar
Don Gagne committed
89
    double          _toolbarHeight;
dogmaphobic's avatar
dogmaphobic committed
90

91 92
    QStringList     _toolbarMessageQueue;
    QMutex          _toolbarMessageQueueMutex;
dogmaphobic's avatar
dogmaphobic committed
93 94
};

95
#endif // MainToolBarController_H