QGCUASParamManager.h 2.44 KB
Newer Older
1 2 3 4 5 6
#ifndef QGCUASPARAMMANAGER_H
#define QGCUASPARAMMANAGER_H

#include <QWidget>
#include <QMap>
#include <QTimer>
7
#include <QVariant>
8

tstellanova's avatar
tstellanova committed
9
//forward declarations
10
class UASInterface;
tstellanova's avatar
tstellanova committed
11
class UASParameterCommsMgr;
12
class UASParameterDataModel;
13 14 15 16 17 18 19

class QGCUASParamManager : public QWidget
{
    Q_OBJECT
public:
    QGCUASParamManager(UASInterface* uas, QWidget *parent = 0);

tstellanova's avatar
tstellanova committed
20
    /** @brief Get the known, confirmed value of a parameter */
tstellanova's avatar
tstellanova committed
21
    virtual bool getParameterValue(int component, const QString& parameter, QVariant& value) const;
22

23 24 25
    /** @brief Provide tooltips / user-visible descriptions for parameters */
    virtual void setParamDescriptions(const QMap<QString,QString>& paramDescs);

tstellanova's avatar
tstellanova committed
26 27 28 29
    /** @brief Get the UAS of this widget
     * @return The MAV of this mgr. Unless the MAV object has been destroyed, this is never null.
     */
    UASInterface* getUAS();
tstellanova's avatar
tstellanova committed
30

tstellanova's avatar
tstellanova committed
31
protected:
tstellanova's avatar
tstellanova committed
32 33
    //TODO decouple this UI message display further
    virtual void setParameterStatusMsg(const QString& msg);
tstellanova's avatar
tstellanova committed
34 35
    /** @brief Load parameter meta information from appropriate CSV file */
    virtual void loadParamMetaInfoCSV();
tstellanova's avatar
tstellanova committed
36

tstellanova's avatar
tstellanova committed
37

38
signals:
39 40
    void parameterChanged(int component, QString parameter, QVariant value);
    void parameterChanged(int component, int parameterIndex, QVariant value);
tstellanova's avatar
tstellanova committed
41 42
//    void parameterUpdateRequested(int component, const QString& parameter);
//    void parameterUpdateRequestedById(int componentId, int paramId);
43

44 45

public slots:
tstellanova's avatar
tstellanova committed
46 47 48
    /** @brief Send one parameter to the MAV: changes value in transient memory of MAV */
    virtual void setParameter(int component, QString parameterName, QVariant value);

tstellanova's avatar
tstellanova committed
49 50 51
    /** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory */
    virtual void sendPendingParameters();

52
    /** @brief Request list of parameters from MAV */
tstellanova's avatar
tstellanova committed
53
    virtual void requestParameterList();
54

tstellanova's avatar
tstellanova committed
55
    /** @brief Request a single parameter by name from the MAV */
56 57
    virtual void requestParameterUpdate(int component, const QString& parameter);

tstellanova's avatar
tstellanova committed
58
    virtual void handleParameterUpdate(int component, const QString& parameterName, QVariant value) = 0;
tstellanova's avatar
tstellanova committed
59
    virtual void handleParameterListUpToDate() = 0;
tstellanova's avatar
tstellanova committed
60 61


62
protected:
63

tstellanova's avatar
tstellanova committed
64
    // Parameter data model
65
    UASInterface* mav;   ///< The MAV this widget is controlling
66
    UASParameterDataModel* paramDataModel;///< Shared data model of parameters
tstellanova's avatar
tstellanova committed
67
    UASParameterCommsMgr*   paramCommsMgr; ///< Shared comms mgr for parameters
68 69

    // Status
tstellanova's avatar
tstellanova committed
70
    QString parameterStatusMsg;
71 72 73 74

};

#endif // QGCUASPARAMMANAGER_H