139 lines
3.4 KiB
C++
139 lines
3.4 KiB
C++
// checkupdate.h: interface for the Ccheckupdate class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
#include <Afxsock.h>
|
|
|
|
#include "HttpDownload.h"
|
|
#include "Device.h"
|
|
#include <vector>
|
|
#include <map>
|
|
#include "FileTransfer_crul.h"
|
|
#if !defined(AFX_CHECKUPDATE_H__895C172D_E957_4D25_B0CF_45BAAB67BEF8__INCLUDED_)
|
|
#define AFX_CHECKUPDATE_H__895C172D_E957_4D25_B0CF_45BAAB67BEF8__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
//HTTP STATUS CODE分类
|
|
// const UINT HTTP_OK = 0;
|
|
// const UINT HTTP_ERROR = 1;
|
|
// const UINT HTTP_REDIRECT = 2;
|
|
// const UINT HTTP_FAIL = 3;
|
|
enum EN_GD10_MODULE_INFO
|
|
{
|
|
EN_APP_MODULE = 0,
|
|
EN_RXB_MODULE,
|
|
EN_TXB_MODULE,
|
|
EN_TWG_MODULE,
|
|
EN_PWR_MODULE,
|
|
EN_CBL_MODULE
|
|
};
|
|
|
|
typedef struct ST_FIRMWARE_VER_INFO
|
|
{
|
|
CString strHWVer;
|
|
CString strSWVer;
|
|
ST_FIRMWARE_VER_INFO()
|
|
{
|
|
strHWVer = _T("");
|
|
strSWVer = _T("");
|
|
}
|
|
|
|
}STFirmwareVerInfo;
|
|
|
|
// const UINT UPG_APP_CARD_TYPE = 0;
|
|
// const UINT UPG_FUNCTION_CARD_TYPE = 1;
|
|
#define MAX_GD10_MODULE_CNT 10
|
|
|
|
typedef struct ST_DOWNLOADFILE_INFO
|
|
{
|
|
CString strFileName;
|
|
CString strNewVer;
|
|
UINT FileType;
|
|
bool bIsCompatible;
|
|
// CStringArray strArrAddtionalFile;
|
|
std::vector<CString> vtAddtionalFile;
|
|
ST_DOWNLOADFILE_INFO()
|
|
{
|
|
strFileName =_T("");
|
|
FileType = 0;
|
|
strNewVer = _T("");
|
|
//strArrAddtionalFile.RemoveAll();
|
|
vtAddtionalFile.clear();
|
|
bIsCompatible = false;
|
|
}
|
|
}STDownFileInfo;
|
|
|
|
typedef enum EN_DG10_RES
|
|
{
|
|
enUpdateFail = 0,
|
|
enUpdateSucc,
|
|
enNoNeedUpdate
|
|
}EnDG10Res;
|
|
|
|
class Ccheckupdate
|
|
{
|
|
public:
|
|
BOOL checkGeoMaive();
|
|
int StartUpdateSoft();
|
|
bool UpdateGD10Dev();
|
|
bool IsNeedUpgGeo(){return m_bIsNeedUpgGeomative;}
|
|
void DeleteDevUpgFile(){DeleteDownloadFile(_T(".\\updates"));}
|
|
Ccheckupdate();
|
|
Ccheckupdate(CDevice *pDev);
|
|
virtual ~Ccheckupdate();
|
|
|
|
private:
|
|
char *buffer;
|
|
//0721
|
|
int nIndex;
|
|
int nFileIndex;
|
|
NewTask task;
|
|
CString m_szFileName;
|
|
HttpDownload http;
|
|
CString m_szPath;
|
|
CStringArray szStrArray;
|
|
int nListCount;
|
|
// int m_nUpgradeType;
|
|
CString GetPath();
|
|
BOOL FindFolder(CString Foldername, CString FindFolderName);
|
|
CDevice *m_pDevice;
|
|
//0721
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
bool m_bIsCrulInitaled;
|
|
std::vector<STDownFileInfo> m_vtDonwFileInfo;
|
|
std::map<int, STFirmwareVerInfo> m_mapVerInfo;
|
|
CFileTransfer_crul m_FileTransfer;
|
|
// CStringArray m_strCurVerArray;
|
|
bool m_bIsNeedUpgGeomative;
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
CString GetGeoMativeVersion();
|
|
|
|
BOOL RequestFileContent(CString filename, CString host, int port);
|
|
UINT GetInfo(LPCTSTR lpszHeader, long int *FileLength);
|
|
int GetHeadLength(char *lpData);
|
|
CString GetLine(char *lpData, int &ndx);
|
|
CString GetValue(CString val);
|
|
void GetLastErrorEx();
|
|
bool ParserFileList();
|
|
bool DownLoadUpdateFiles();
|
|
bool DownLoadFileList();
|
|
bool UpdateFiles(); //将GD10的更新程序和附加文件都从update文件夹拷贝到firmwave文件夹中
|
|
bool GetGDVersionInfo();
|
|
bool UpdateFunctionBoard();
|
|
bool UpdateAppToDev();
|
|
void DeleteDownloadFile(CString strPath); //删除此次更新下载时所下载的所有文件
|
|
bool CheckHwSwCompatible(int iCompHWType, CString strCompSWVer,CString strFileName);
|
|
bool CheckSWVerIsCompatibale(CString strAdapaterVer, CString strSWver);
|
|
bool DownLoadGD10CompatVerFile();
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif // !defined(AFX_CHECKUPDATE_H__895C172D_E957_4D25_B0CF_45BAAB67BEF8__INCLUDED_)
|