52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
#ifndef THREADUPGRADEAPK_H
|
|
#define THREADUPGRADEAPK_H
|
|
#include <QThread>
|
|
#include <QFile>
|
|
#include <QTcpSocket>
|
|
#include <QJsonValue>
|
|
#include <QJsonObject>
|
|
#include <QJsonDocument>
|
|
#include <QAbstractSocket>
|
|
#include <QSemaphore>
|
|
#include <QDataStream>
|
|
#include <communication/hpptclient.h>
|
|
#include <QTimer>
|
|
const quint16 PORT = 3333;
|
|
const qint64 LOADBYTES = 4 * 1024; // 4 kilo-byte
|
|
const int DATA_STREAM_VERSION = QDataStream::Qt_4_8;
|
|
class ThreadUpgradeApk:public QThread
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
ThreadUpgradeApk(QString strApkPathAndName,QString url="",int iPort=3333);
|
|
~ThreadUpgradeApk();
|
|
void run();
|
|
protected slots:
|
|
void slotUploadProgress(qint64 A,qint64 B);
|
|
void slotUploadFinished();
|
|
void slotUploadFpgaFinished();
|
|
void slotTimerOutUnlock();
|
|
void OnUpgradeSuccess();
|
|
void OnUpgradeFail();
|
|
signals:
|
|
void sigSetLableText(QString);
|
|
|
|
void sigSetProgressValue(int);
|
|
void sigSetProgressMax(int);
|
|
void sigFinished();
|
|
void sigFpgaFinished();
|
|
void sigTimerOut();
|
|
private:
|
|
bool bSendCloseFlag=true;
|
|
QString m_strApkName;
|
|
QString m_strUrl;
|
|
int m_reSendCount=0;
|
|
QTimer *m_pGetAskTimer=nullptr;
|
|
int m_iType=0;
|
|
void UpLoadForm(QString Path,QMap<QString,QString> params,QString fileFormName,QFile *uploadFile,QString newFileName,int iType);
|
|
// void UpLoadForm(QString strUrl,QString strFilePathName);
|
|
|
|
};
|
|
|
|
#endif // THREADSENDPRO_H
|