Skip to content
QGCUASParamManager.h 2.3 KiB
Newer Older
#ifndef QGCUASPARAMMANAGER_H
#define QGCUASPARAMMANAGER_H

#include <QWidget>
#include <QMap>
#include <QTimer>
#include <QVariant>
tstellanova's avatar
tstellanova committed
//forward declarations
tstellanova's avatar
tstellanova committed
class UASParameterCommsMgr;
class UASParameterDataModel;

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

tstellanova's avatar
tstellanova committed
    /** @brief Get the known, confirmed value of a parameter */
tstellanova's avatar
tstellanova committed
    virtual bool getParameterValue(int component, const QString& parameter, QVariant& value) const;
    /** @brief Provide tooltips / user-visible descriptions for parameters */
    virtual void setParamDescriptions(const QMap<QString,QString>& paramDescs);

tstellanova's avatar
tstellanova committed
    /** @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

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

    void parameterChanged(int component, QString parameter, QVariant value);
    void parameterChanged(int component, int parameterIndex, QVariant value);
tstellanova's avatar
tstellanova committed
//    void parameterUpdateRequested(int component, const QString& parameter);
//    void parameterUpdateRequestedById(int componentId, int paramId);
    /** @brief Write one parameter to the MAV */
    virtual void setParameter(int component, QString parameterName, QVariant value) = 0;
    /** @brief Request list of parameters from MAV */
tstellanova's avatar
tstellanova committed
    virtual void requestParameterList();
tstellanova's avatar
tstellanova committed
    /** @brief Request a single parameter by name */
    virtual void requestParameterUpdate(int component, const QString& parameter);

tstellanova's avatar
tstellanova committed
    virtual void handleParameterUpdate(int component, int paramCount, int paramId, const QString& parameterName, QVariant value) = 0;
    virtual void handleParameterListUpToDate(int component) = 0;


tstellanova's avatar
tstellanova committed
    // Parameter data model
    UASInterface* mav;   ///< The MAV this widget is controlling
    UASParameterDataModel* paramDataModel;///< Shared data model of parameters
tstellanova's avatar
tstellanova committed
    UASParameterCommsMgr*   paramCommsMgr; ///< Shared comms mgr for parameters
tstellanova's avatar
tstellanova committed
    QString parameterStatusMsg;