QGCUASParamManager.h 2.4 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
    //TODO decouple this UI message display further?
tstellanova's avatar
tstellanova committed
33
    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);
41 42

public slots:
tstellanova's avatar
tstellanova committed
43 44 45
    /** @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
46 47 48
    /** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory */
    virtual void sendPendingParameters();

49
    /** @brief Request list of parameters from MAV */
tstellanova's avatar
tstellanova committed
50
    virtual void requestParameterList();
51

52 53
    virtual void setPendingParam(int componentId,  QString& key,  const QVariant& value);

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

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


61
protected:
62

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

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

};

#endif // QGCUASPARAMMANAGER_H