Skip to content
QGCUASParamManager.h 2.31 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?
tstellanova's avatar
tstellanova committed
    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
    /** @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
    /** @brief Send all pending parameters to the MAV, for storage in transient (RAM) memory */
    virtual void sendPendingParameters();

    /** @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 from the MAV */
    virtual void requestParameterUpdate(int component, const QString& parameter);

tstellanova's avatar
tstellanova committed
    virtual void handleParameterUpdate(int component, const QString& parameterName, QVariant value) = 0;
tstellanova's avatar
tstellanova committed
    virtual void handleParameterListUpToDate() = 0;
tstellanova's avatar
tstellanova committed
    // Parameter data model
tstellanova's avatar
tstellanova committed
    UASInterface*           mav;   ///< The MAV this manager 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;