QGCBaseParamWidget.h 2.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#ifndef QGCBASEPARAMWIDGET_H
#define QGCBASEPARAMWIDGET_H

#include <QVariant>
#include <QWidget>




//forward declarations
11
class QGCUASParamManagerInterface;
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
class UASInterface;


class QGCBaseParamWidget : public QWidget
{
    Q_OBJECT
public:
    explicit QGCBaseParamWidget(QWidget *parent = 0);
    virtual QGCBaseParamWidget* initWithUAS(UASInterface* uas);///< Two-stage construction: initialize this object
    virtual void setUAS(UASInterface* uas);///< Allows swapping the underlying UAS

protected:
    virtual void setParameterStatusMsg(const QString& msg) = 0;
    virtual void layoutWidget() = 0;///< Layout the appearance of this widget
    virtual void connectViewSignalsAndSlots() = 0;///< Connect view signals/slots as needed
    virtual void disconnectViewSignalsAndSlots() = 0;///< Disconnect view signals/slots as needed
    virtual void connectToParamManager(); ///>Connect to any required param manager signals
    virtual void disconnectFromParamManager(); ///< Disconnect from any connected param manager signals

signals:
    
public slots:
    virtual void handleOnboardParamUpdate(int component,const QString& parameterName, QVariant value) = 0;
    virtual void handlePendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending) = 0;
    virtual void handleOnboardParameterListUpToDate() = 0;
    virtual void handleParamStatusMsgUpdate(QString msg, int level) = 0;
    /** @brief Clear the rendering of onboard parameters */
    virtual void clearOnboardParamDisplay() = 0;
    /** @brief Clear the rendering of pending parameters */
    virtual void clearPendingParamDisplay() = 0;

    /** @brief Request list of parameters from MAV */
    virtual void requestOnboardParamsUpdate();


    /** @brief Store parameters to a file */
    virtual void saveParametersToFile();
    /** @brief Load parameters from a file */
    virtual void loadParametersFromFile();

protected:
53
    QGCUASParamManagerInterface* paramMgr;
54 55 56 57 58 59
    UASInterface* mav;
    QString     updatingParamNameLock; ///< Name of param currently being updated-- used for reducing echo on param change

};

#endif // QGCBASEPARAMWIDGET_H