MainToolBarController.h 4.51 KB
Newer Older
dogmaphobic's avatar
dogmaphobic 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 29
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

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

30 31
#ifndef MainToolBarController_H
#define MainToolBarController_H
dogmaphobic's avatar
dogmaphobic committed
32

33 34 35 36
#include <QObject>

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

38 39 40 41 42
#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"
43
#define TOOL_BAR_SHOW_RSSI      "ShowRSSI"
44

45
class MainToolBarController : public QObject
dogmaphobic's avatar
dogmaphobic committed
46 47
{
    Q_OBJECT
48

49 50 51
public:
    MainToolBarController(QObject* parent = NULL);
    ~MainToolBarController();
52

Don Gagne's avatar
Don Gagne committed
53 54 55 56
    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
57 58 59 60 61
    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)
62

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

65 66
    int         telemetryRRSSI          () { return _telemetryRRSSI; }
    int         telemetryLRSSI          () { return _telemetryLRSSI; }
dogmaphobic's avatar
dogmaphobic committed
67 68 69 70 71
    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
72

dogmaphobic's avatar
dogmaphobic committed
73
signals:
74
    void progressBarValueChanged        (float value);
75 76
    void telemetryRRSSIChanged          (int value);
    void telemetryLRSSIChanged          (int value);
Don Gagne's avatar
Don Gagne committed
77
    void heightChanged                  (double height);
dogmaphobic's avatar
dogmaphobic committed
78 79 80 81 82
    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
83

dogmaphobic's avatar
dogmaphobic committed
84
private slots:
85
    void _activeVehicleChanged          (Vehicle* vehicle);
86
    void _setProgressBarValue           (float value);
87
    void _telemetryChanged              (LinkInterface* link, unsigned rxerrors, unsigned fixed, int rssi, int remrssi, unsigned txbuf, unsigned noise, unsigned remnoise);
dogmaphobic's avatar
dogmaphobic committed
88 89

private:
90
    Vehicle*        _vehicle;
dogmaphobic's avatar
dogmaphobic committed
91
    UASInterface*   _mav;
92
    float           _progressBarValue;
dogmaphobic's avatar
dogmaphobic committed
93
    double          _remoteRSSIstore;
94 95
    int             _telemetryRRSSI;
    int             _telemetryLRSSI;
dogmaphobic's avatar
dogmaphobic committed
96 97 98 99 100 101
    uint32_t        _telemetryRXErrors;
    uint32_t        _telemetryFixed;
    uint32_t        _telemetryTXBuffer;
    uint32_t        _telemetryLNoise;
    uint32_t        _telemetryRNoise;

Don Gagne's avatar
Don Gagne committed
102
    double          _toolbarHeight;
dogmaphobic's avatar
dogmaphobic committed
103

104 105
    QStringList     _toolbarMessageQueue;
    QMutex          _toolbarMessageQueueMutex;
dogmaphobic's avatar
dogmaphobic committed
106 107
};

108
#endif // MainToolBarController_H