QGCUASParamManagerInterface.h 2.42 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#ifndef QGCUASPARAMMANAGERINTERFACE_H
#define QGCUASPARAMMANAGERINTERFACE_H

#include <QWidget>
#include <QMap>
#include <QTimer>
#include <QVariant>
#include <QTextStream>

#include "UASParameterDataModel.h"

/**
 * @brief This is the abstract base class for QGCUASParamManager. Although there is 
 * normally only a single QGCUASParamManager we still use an abstract base interface 
 * since this allows us to create mock versions.
 *
 * See QGCUASParamManager.h for method documentation
 **/

//forward declarations
class QTextStream;
class UASInterface;
class UASParameterCommsMgr;

class QGCUASParamManagerInterface : public QObject
{
public:
    QGCUASParamManagerInterface(QObject* parent = NULL) : QObject(parent) { }
    virtual bool getParameterValue(int component, const QString& parameter, QVariant& value) const = 0;
    virtual int getDefaultComponentId() = 0;
    virtual QList<int> getComponentForParam(const QString& parameter) const = 0;
    virtual void setParamDescriptions(const QMap<QString,QString>& paramDescs) = 0;
    virtual int countPendingParams() = 0;
    virtual int countOnboardParams() = 0;
    virtual UASParameterDataModel* dataModel() = 0;
36
    virtual bool parametersReady(void) = 0;
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
    
public slots:
    virtual void setParameter(int component, QString parameterName, QVariant value) = 0;
    virtual void sendPendingParameters(bool persistAfterSend = false, bool forceSend = false) = 0;
    virtual void requestParameterList() = 0;
    virtual void requestParameterListIfEmpty() = 0;
    virtual void setPendingParam(int componentId,  const QString& key,  const QVariant& value, bool forceSend = false) = 0;
    virtual void clearAllPendingParams() = 0;
    virtual void requestParameterUpdate(int component, const QString& parameter) = 0;
    virtual void writeOnboardParamsToStream(QTextStream &stream, const QString& uasName) = 0;
    virtual void readPendingParamsFromStream(QTextStream &stream) = 0;
    virtual void requestRcCalibrationParamsUpdate() = 0;
    virtual void copyVolatileParamsToPersistent() = 0;
    virtual void copyPersistentParamsToVolatile() = 0;
    
signals:
    void parameterStatusMsgUpdated(QString msg, int level);
    void parameterListUpToDate();
55
    void parameterListProgress(float percentComplete);
56 57 58 59 60
    void parameterUpdated(int compId, QString paramName, QVariant value);
    void pendingParamUpdate(int compId, const QString& paramName, QVariant value, bool isPending);
};

#endif // QGCUASPARAMMANAGER_H