RadioCalibrationData.h 1.72 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#ifndef RADIOCALIBRATIONDATA_H
#define RADIOCALIBRATIONDATA_H

#include <QObject>
#include <QDebug>
#include <QVector>


class RadioCalibrationData : public QObject
{
Q_OBJECT

public:
    explicit RadioCalibrationData();
    RadioCalibrationData(const RadioCalibrationData&);
    RadioCalibrationData(const QVector<float>& aileron,
                         const QVector<float>& elevator,
                         const QVector<float>& rudder,
                         const QVector<float>& gyro,
                         const QVector<float>& pitch,
                         const QVector<float>& throttle);
22
    ~RadioCalibrationData();
23 24 25 26 27 28 29 30 31 32 33 34 35

    enum RadioElement
    {
        AILERON=0,
        ELEVATOR,
        RUDDER,
        GYRO,
        PITCH,
        THROTTLE
    };

    const float* operator[](int i) const;
    const QVector<float>& operator()(int i) const;
36 37 38 39 40
    void set(int element, int index, float value) {(*data)[element][index] = value;}

public slots:
    void setAileron(int index, float value) {set(AILERON, index, value);}
    void setElevator(int index, float value) {set(ELEVATOR, index, value);}
41
    void setRudder(int index, float value) {set(RUDDER, index, value);}
42 43 44
    void setGyro(int index, float value) {set(GYRO, index, value);}
    void setPitch(int index, float value) {set(PITCH, index, value);}
    void setThrottle(int index, float value) {set(THROTTLE, index, value);}
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

protected:
    QVector<QVector<float> > *data;


    void init(const QVector<float>& aileron,
              const QVector<float>& elevator,
              const QVector<float>& rudder,
              const QVector<float>& gyro,
              const QVector<float>& pitch,
              const QVector<float>& throttle);

};

#endif // RADIOCALIBRATIONDATA_H