ApmFirmwareConfig.h 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#ifndef APMFIRMWARECONFIG_H
#define APMFIRMWARECONFIG_H

#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QDebug>
#include <QTemporaryFile>
#include <QProcess>
11 12 13
#include <QXmlStreamReader>
#include <QMessageBox>
#include <QProcess>
14
#include <QScrollBar>
15
#include <QSerialPort>
16

17 18 19 20 21 22 23 24 25 26 27 28
#include "ui_ApmFirmwareConfig.h"

class ApmFirmwareConfig : public QWidget
{
    Q_OBJECT
    
public:
    explicit ApmFirmwareConfig(QWidget *parent = 0);
    ~ApmFirmwareConfig();
private slots:
    void firmwareListFinished();
    void firmwareListError(QNetworkReply::NetworkError error);
29
    void flashButtonClicked();
30
    void betaFirmwareButtonClicked(bool betafirmwareenabled);
31 32 33 34
    void downloadFinished();
    void firmwareProcessFinished(int status);
    void firmwareProcessReadyRead();
    void firmwareProcessError(QProcess::ProcessError error);
35
    void firmwareDownloadProgress(qint64 received,qint64 total);
36 37
    void requestFirmwares();
    void requestBetaFirmwares();
38
private:
39 40 41
    void addBetaLabel(QWidget *parent);
    void hideBetaLabels();
    void showBetaLabels();
42 43
    //ApmFirmwareStatus *firmwareStatus;
    QString m_detectedComPort;
44 45
    QTemporaryFile *m_tempFirmwareFile;
    QNetworkAccessManager *m_networkManager;
46
    QList<QLabel*> m_betaButtonLabelList;
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    bool stripVersionFromGitReply(QString url,QString reply,QString type,QString stable,QString *out);
    bool m_betaFirmwareChecked;
    QMap<QPushButton*,QString> m_buttonToUrlMap;
    Ui::ApmFirmwareConfig ui;
    class FirmwareDef
    {
    public:
        QString url;
        QString url2560;
        QString url25602;
        QString urlpx4;
        QString type;
        QString name;
        QString desc;
        int version;
    };
    QList<FirmwareDef> m_firmwareList;
};

#endif // APMFIRMWARECONFIG_H