1523 lines
45 KiB
C++
1523 lines
45 KiB
C++
// checkupdate.cpp: implementation of the Ccheckupdate class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "GeoMative.h"
|
|
#include "Constant.h"
|
|
#include "checkupdate.h"
|
|
#include "FileOperTools.h"
|
|
#include <DbgHelp.h>
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
#define GEOMATIVE_FILE_TYPE 0x10
|
|
extern HHOOK hHook;
|
|
extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam);
|
|
extern void SplitterString(CStringArray &szArray,const CString& szSource, const CString& szSplitter);
|
|
extern BOOL GetSubStringInHeadAndTail(const CString& szSource, CString& szSub, const CString& szHead, const CString& szTail);
|
|
extern int g_iUILanguage;
|
|
extern CGeoMativeApp theApp;
|
|
Ccheckupdate::Ccheckupdate()
|
|
{
|
|
nIndex = 0;
|
|
buffer = NULL;
|
|
m_pDevice = NULL;
|
|
m_bIsCrulInitaled = false;
|
|
m_vtDonwFileInfo.clear();
|
|
// m_strCurVerArray.RemoveAll();
|
|
// for (int i = 0; i < MAX_GD10_MODULE_CNT; i++)
|
|
// {
|
|
// m_strCurVerArray.Add(_T("NUL"));
|
|
// }
|
|
m_mapVerInfo.clear();
|
|
m_bIsNeedUpgGeomative = false;
|
|
}
|
|
|
|
Ccheckupdate::Ccheckupdate(CDevice *pDev)
|
|
{
|
|
m_pDevice = NULL;
|
|
nIndex = 0;
|
|
buffer = NULL;
|
|
m_bIsCrulInitaled = false;
|
|
m_vtDonwFileInfo.clear();
|
|
// m_strCurVerArray.RemoveAll();
|
|
m_pDevice = pDev;
|
|
// for (int i = 0; i < MAX_GD10_MODULE_CNT; i++)
|
|
// {
|
|
// m_strCurVerArray.Add(_T("NUL"));
|
|
// }
|
|
m_mapVerInfo.clear();
|
|
m_bIsNeedUpgGeomative = false;
|
|
// m_FileTransfer.InitalLogInfo();
|
|
}
|
|
|
|
Ccheckupdate::~Ccheckupdate()
|
|
{
|
|
if (buffer)
|
|
{
|
|
delete []buffer;
|
|
buffer = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
BOOL Ccheckupdate::checkGeoMaive()
|
|
{
|
|
BOOL bResult = FALSE;
|
|
|
|
CString szGeoVersion;
|
|
CString szGDTenVersion;
|
|
szGeoVersion = GetGeoMativeVersion();
|
|
|
|
if( szGeoVersion == "NULL" )
|
|
{
|
|
// hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
// ::AfxMessageBox("get geomative version failed,failed code is 00001");
|
|
return FALSE;
|
|
}
|
|
|
|
CString szVersionFile = "/GeomativeVersion.txt";
|
|
|
|
CString szHost = "218.17.161.7";
|
|
int nPort = 9520;
|
|
|
|
if(RequestFileContent(szVersionFile,szHost,nPort) != HTTP_OK)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
CString szRequest = "GeoMativeVersion";
|
|
CString szRequestValue;
|
|
|
|
szRequestValue = GetValue(szRequest);
|
|
|
|
if(szGeoVersion == szRequestValue)
|
|
{
|
|
bResult = FALSE;
|
|
}
|
|
|
|
else
|
|
{
|
|
bResult = TRUE;
|
|
}
|
|
|
|
return bResult;
|
|
|
|
}
|
|
|
|
CString Ccheckupdate::GetGeoMativeVersion()
|
|
{
|
|
TCHAR szFullPath[MAX_PATH];
|
|
DWORD dwVerInfoSize = 0;
|
|
DWORD dwVerHnd;
|
|
VS_FIXEDFILEINFO * pFileInfo;
|
|
|
|
CString strVersion = "NULL";
|
|
|
|
GetModuleFileName(NULL, szFullPath, sizeof(szFullPath));
|
|
dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
|
|
if (dwVerInfoSize)
|
|
{
|
|
// If we were able to get the information, process it:
|
|
|
|
HANDLE hMem;
|
|
LPVOID lpvMem;
|
|
unsigned int uInfoSize = 0;
|
|
|
|
hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
|
|
lpvMem = GlobalLock(hMem);
|
|
|
|
if( !GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem) )
|
|
{
|
|
GetLastErrorEx();
|
|
return strVersion;
|
|
}
|
|
|
|
if( !::VerQueryValue(lpvMem, (LPTSTR)_T("\\"), (void**)&pFileInfo, &uInfoSize) )
|
|
{
|
|
GetLastErrorEx();
|
|
return strVersion;
|
|
}
|
|
|
|
WORD m_nProdVersion[4];
|
|
|
|
// Product version from the FILEVERSION of the version info resource
|
|
m_nProdVersion[0] = HIWORD(pFileInfo->dwProductVersionMS);
|
|
m_nProdVersion[1] = LOWORD(pFileInfo->dwProductVersionMS);
|
|
m_nProdVersion[2] = HIWORD(pFileInfo->dwProductVersionLS);
|
|
m_nProdVersion[3] = LOWORD(pFileInfo->dwProductVersionLS);
|
|
|
|
strVersion.Format(_T("%d.%d.%d.%d"),m_nProdVersion[0],
|
|
m_nProdVersion[1],m_nProdVersion[2],m_nProdVersion[3]);
|
|
|
|
GlobalUnlock(hMem);
|
|
GlobalFree(hMem);
|
|
}
|
|
|
|
return strVersion;
|
|
}
|
|
|
|
void Ccheckupdate::GetLastErrorEx()
|
|
{
|
|
TCHAR szBuf[128];
|
|
LPVOID lpMsgBuf;
|
|
DWORD dw = GetLastError();
|
|
FormatMessage(
|
|
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
NULL,
|
|
dw,
|
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
(LPTSTR) &lpMsgBuf,
|
|
0, NULL );
|
|
wsprintf(szBuf,
|
|
_T("出错码:%d: %s"),
|
|
dw, lpMsgBuf);
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
// AfxMessageBox(szBuf);
|
|
LocalFree(lpMsgBuf);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL Ccheckupdate::RequestFileContent(CString filename, CString host, int port)
|
|
{
|
|
AfxSocketInit();
|
|
|
|
CSocket psocket;
|
|
|
|
//设置SOCKET并链接
|
|
if(!psocket.Create())
|
|
{
|
|
char *szMsg = new char[1024];
|
|
|
|
memset(szMsg,0,1024);
|
|
|
|
sprintf(szMsg, "ERROR:PLEASE CHECK INTERNET code: %d", psocket.GetLastError());
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBoxEx(NULL, szMsg, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
|
|
delete szMsg;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
psocket.Connect(host,port);
|
|
|
|
//设置请求报头并发送
|
|
CString strSend;
|
|
CString szVersionFile;
|
|
szVersionFile = filename;
|
|
strSend = "GET " + filename + " HTTP/1.1\r\n";
|
|
strSend += "Host: " + host + "\r\n";
|
|
strSend += "Accept: */*\r\n";
|
|
strSend += "Pragma: no-cache\r\n";
|
|
strSend += "Cache-Control: no-cache\r\n";
|
|
strSend += "Connection: close\r\n";
|
|
strSend += "\r\n";
|
|
|
|
if (!psocket.Send(strSend.GetBuffer(0), strSend.GetLength()))
|
|
{
|
|
char *szSendMsg = new char[1024];
|
|
|
|
memset(szSendMsg,0,1024);
|
|
|
|
sprintf(szSendMsg, "ERROR:PLEASE CHECK INTERNET code: %d", psocket.GetLastError());
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBoxEx(NULL, szSendMsg, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
|
|
delete szSendMsg;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
strSend.ReleaseBuffer();
|
|
|
|
//接受GeomativeVersion文件的内容并保存到BUFF中
|
|
int nReadCount;
|
|
|
|
char *cReadBuff = new char[1026];
|
|
memset(cReadBuff,0,1025);
|
|
|
|
CString szHeader;
|
|
|
|
nReadCount = psocket.Receive(cReadBuff,1025);
|
|
|
|
if(nReadCount == -1)
|
|
{
|
|
char *szRecvMsg = new char[1024];
|
|
|
|
memset(szRecvMsg,0,1024);
|
|
|
|
sprintf(szRecvMsg, "ERROR:PLEASE CHECK INTERNET code: %d", psocket.GetLastError());
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBoxEx(NULL, szRecvMsg, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
|
|
delete szRecvMsg;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
szHeader.Format("%s",cReadBuff);
|
|
|
|
long int ContentLength;
|
|
|
|
switch ( GetInfo(szHeader, &ContentLength) )
|
|
{
|
|
case HTTP_OK:
|
|
break;
|
|
case HTTP_REDIRECT:
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
// ::AfxMessageBox("connect has been REDIRECT");
|
|
case HTTP_FAIL:
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBoxEx(NULL, _T("Connect TIMEOUT"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
default:
|
|
return FALSE;
|
|
}
|
|
//分析报头并将数据保存到成员变量中
|
|
|
|
CString szOutHeader = szHeader;
|
|
int nFileSize;//接收到的文件大小
|
|
int nHeadLength;
|
|
|
|
nFileSize = 0;
|
|
nHeadLength = GetHeadLength(szOutHeader.GetBuffer(0));
|
|
|
|
szOutHeader.ReleaseBuffer();
|
|
|
|
nFileSize = nReadCount - nHeadLength;//数据体的长度
|
|
buffer = new char[ContentLength + 1];
|
|
memset(buffer,0,ContentLength + 1);
|
|
|
|
memcpy(buffer,cReadBuff+nHeadLength,nFileSize);
|
|
delete cReadBuff;
|
|
|
|
int nOnceRead;
|
|
nOnceRead = 0;
|
|
|
|
while (1)
|
|
{
|
|
if(nFileSize == ContentLength)
|
|
break;
|
|
nOnceRead = psocket.Receive(buffer+nFileSize,1024);
|
|
if(nOnceRead == -1)
|
|
{
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
// ::AfxMessageBox("链接丢失");
|
|
break;
|
|
}
|
|
nFileSize += nOnceRead;
|
|
}
|
|
psocket.Close();
|
|
return HTTP_OK;
|
|
}
|
|
|
|
UINT Ccheckupdate::GetInfo(LPCTSTR lpszHeader, long int *FileLength)
|
|
{
|
|
|
|
CString strHeader = lpszHeader;
|
|
strHeader.MakeLower();
|
|
|
|
int nPos = strHeader.Find("\r\n");
|
|
|
|
if (nPos == -1)
|
|
return HTTP_FAIL;
|
|
|
|
CString strFirstLine = strHeader.Left(nPos);
|
|
|
|
// 获得返回码: Status Code
|
|
DWORD dwStatusCode;
|
|
strFirstLine.TrimLeft();
|
|
strFirstLine.TrimRight();
|
|
nPos = strFirstLine.Find(' ');
|
|
|
|
if( nPos == -1 )
|
|
return HTTP_FAIL;
|
|
strFirstLine = strFirstLine.Mid(nPos+1);
|
|
nPos = strFirstLine.Find(' ');
|
|
|
|
if( nPos == -1 )
|
|
return HTTP_FAIL;
|
|
|
|
strFirstLine = strFirstLine.Left(nPos);
|
|
dwStatusCode = (DWORD)_ttoi((LPCTSTR)strFirstLine);
|
|
|
|
if( dwStatusCode >= 300 && dwStatusCode < 400 )
|
|
{
|
|
return HTTP_REDIRECT;
|
|
}
|
|
|
|
if( dwStatusCode >= 500 )
|
|
return HTTP_ERROR;
|
|
|
|
// 客户端错误,重试无用
|
|
if( dwStatusCode >=400 && dwStatusCode <500 )
|
|
return HTTP_FAIL;
|
|
|
|
// 获取ContentLength
|
|
nPos = strHeader.Find("content-length:");
|
|
if (nPos == -1)
|
|
return HTTP_FAIL;
|
|
|
|
CString strDownFileLen = strHeader.Mid(nPos + strlen("content-length:"));
|
|
nPos = strDownFileLen.Find("\r\n");
|
|
if (nPos == -1)
|
|
return HTTP_FAIL;
|
|
|
|
strDownFileLen = strDownFileLen.Left(nPos);
|
|
strDownFileLen.TrimLeft();
|
|
strDownFileLen.TrimRight();
|
|
|
|
*FileLength = (DWORD) _ttoi( (LPCTSTR)strDownFileLen );
|
|
// m_ContentLength = (DWORD) _ttoi( (LPCTSTR)strDownFileLen );
|
|
|
|
return HTTP_OK;
|
|
}
|
|
|
|
int Ccheckupdate::GetHeadLength(char *lpData)
|
|
{
|
|
//...得到Head串的长度,遇到空行停止
|
|
int ndx = 0;
|
|
CString str;
|
|
while(1) {
|
|
str.Empty();
|
|
str = GetLine(lpData, ndx);
|
|
if(str.IsEmpty())
|
|
break;
|
|
}
|
|
return (ndx);
|
|
}
|
|
|
|
CString Ccheckupdate::GetLine(char *lpData, int &ndx)
|
|
{
|
|
BOOL bLine = FALSE;
|
|
CString str;
|
|
while ( bLine == FALSE && ndx < 1025 ) {
|
|
|
|
char ch = (char)(lpData[ndx]);
|
|
switch( ch ) {
|
|
|
|
case '\r': // ignore
|
|
break;
|
|
case '\n': // end-of-line
|
|
bLine = TRUE;
|
|
break;
|
|
default: // other....
|
|
str += ch;
|
|
break;
|
|
}
|
|
++ndx;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
CString Ccheckupdate::GetValue(CString val)
|
|
{
|
|
|
|
int nIdex;
|
|
nIdex = 0;
|
|
|
|
CString szLine = "NULL";
|
|
|
|
while(1)
|
|
{
|
|
szLine.Empty();
|
|
szLine = GetLine(buffer, nIdex);
|
|
|
|
if (szLine.Left(szLine.Find(':')) == val)
|
|
{
|
|
szLine = szLine.Right(szLine.GetLength() - szLine.ReverseFind(':') - 1);
|
|
return szLine;
|
|
}
|
|
else if(szLine == "end")
|
|
return szLine;
|
|
}
|
|
|
|
return szLine;
|
|
}
|
|
|
|
bool Ccheckupdate::UpdateAppToDev()
|
|
{
|
|
int i = 0;
|
|
CString szOrder = _T("");
|
|
CString strErrInfo = _T("");
|
|
CString strResBuffer = _T("");
|
|
for (; i < m_vtDonwFileInfo.size(); i++)
|
|
{
|
|
if (EN_APP_MODULE == m_vtDonwFileInfo[i].FileType)
|
|
{
|
|
if (false == m_vtDonwFileInfo[i].bIsCompatible)
|
|
{
|
|
strErrInfo.Empty();
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
strErrInfo.Format(_T("新版本(版本号:%s, 名称:%s) 和设备中的硬件版本不匹配!"),
|
|
m_vtDonwFileInfo[i].strNewVer, m_vtDonwFileInfo[i].strFileName);
|
|
AfxMessageBox(strErrInfo);
|
|
}
|
|
else
|
|
{
|
|
strErrInfo.Format(_T("New version(ver:%s, name:%s) is not match with version of hardware in device!"),
|
|
m_vtDonwFileInfo[i].strNewVer, m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
|
|
m_bIsNeedUpgGeomative = false;
|
|
return true;
|
|
}
|
|
//下载附加文件列表
|
|
for (int j = 0; j < m_vtDonwFileInfo[i].vtAddtionalFile.size(); j++)
|
|
{
|
|
szOrder.Empty();
|
|
szOrder.Format(_T("rm(\"/SD/%s\")\r\n"),m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
if (!m_pDevice->ExecuteOrder(szOrder, ">", &strResBuffer))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Excute remove %s failed!!!"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
if (!m_pDevice->SendFile(_T("/SD/"), _T(".\\firmware\\"), m_vtDonwFileInfo[i].vtAddtionalFile[j]))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Send file %s failed!!!"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (i == m_vtDonwFileInfo.size())
|
|
{
|
|
return true;
|
|
}
|
|
|
|
//刷固件:
|
|
if(!MakeSureDirectoryPathExists(_T(".\\tools\\")))
|
|
{
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("工具文件已经丢失,请联系管理员."));
|
|
else
|
|
MessageBoxEx(NULL, _T("Tools file had been miss please contact admimnistrator"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
CString szFolderName = "tools";
|
|
CString szFilePath = ".//";
|
|
CString szBatPath;
|
|
szOrder.Empty();
|
|
szOrder = "isp()\r\n";
|
|
if (!m_pDevice->m_sComPort.ExecuteNoResOrder(szOrder))
|
|
{
|
|
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
|
MessageBoxEx(NULL, _T("Send update device cmd failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
Sleep(5000);
|
|
|
|
char cReadBuff[1024]; int nLength = 0;
|
|
memset(cReadBuff, 0, 1024);
|
|
m_pDevice->m_sComPort.ReceiveDataDirectly(cReadBuff, &nLength);
|
|
|
|
//判断是否电量低
|
|
if (nLength != 0)
|
|
{
|
|
CString strRcv = cReadBuff;
|
|
//当找到Low字符时,认为此时的电量不足
|
|
if (strRcv.Find("Low") != -1)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("电量太低,请先充电."));
|
|
else
|
|
MessageBoxEx(NULL, _T("Bettery is low, please charge"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
szBatPath = ".\\tools\\IAP-GD20.bat";
|
|
|
|
PROCESS_INFORMATION ProcessInfo;
|
|
|
|
STARTUPINFO StartupInfo; //入口参数
|
|
|
|
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
|
|
|
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
|
|
StartupInfo.wShowWindow = SW_SHOW;
|
|
StartupInfo.cb = sizeof StartupInfo; //分配大小
|
|
|
|
unsigned long nTime = 0;
|
|
|
|
if(CreateProcess(szBatPath, NULL,NULL,NULL,FALSE,0,NULL,NULL,&StartupInfo,&ProcessInfo))
|
|
{
|
|
int nAbandondeCount = 0;
|
|
int nTimeoutCount = 0;
|
|
while(TRUE)
|
|
{
|
|
switch(WaitForSingleObject(ProcessInfo.hProcess,500))
|
|
{
|
|
case WAIT_ABANDONED:
|
|
nTime += 500;
|
|
if (nAbandondeCount++ > 200)
|
|
{
|
|
CloseHandle(ProcessInfo.hThread);
|
|
CloseHandle(ProcessInfo.hProcess);
|
|
return false;
|
|
}
|
|
break;
|
|
case WAIT_TIMEOUT:
|
|
nTime += 500;
|
|
if (nTimeoutCount++ > 900)
|
|
{
|
|
CloseHandle(ProcessInfo.hThread);
|
|
CloseHandle(ProcessInfo.hProcess);
|
|
return false;
|
|
}
|
|
break;
|
|
case WAIT_OBJECT_0:
|
|
CloseHandle(ProcessInfo.hThread);
|
|
CloseHandle(ProcessInfo.hProcess);
|
|
if (nTime < 10000)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("设备更新失败,请检查操作系统环境."));
|
|
else
|
|
MessageBoxEx(NULL, _T("Device upData failed, please check operation system environment"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Ccheckupdate::UpdateGD10Dev()
|
|
{
|
|
CString strIniFile = _T("firmware\\firmware_version_info.ini");
|
|
if (false == CFileOperTools::GetInstance()->IsFileExist(strIniFile))
|
|
{
|
|
MessageBoxEx(NULL, _T("Update device software failed because of firmware_version_info.ini can't be found!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
for (int i = 0; i < m_vtDonwFileInfo.size(); i++)
|
|
{
|
|
m_vtDonwFileInfo[i].bIsCompatible = CheckHwSwCompatible(m_vtDonwFileInfo[i].FileType, m_vtDonwFileInfo[i].strNewVer, strIniFile);
|
|
if (false == m_vtDonwFileInfo[i].bIsCompatible)
|
|
{
|
|
CString strErr = _T("");
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
strErr.Format(_T("更新主机设备软件失败: 新版本(%s)和设备里的硬件版本不兼容!"), m_vtDonwFileInfo[i].strFileName);
|
|
AfxMessageBox(strErr);
|
|
}
|
|
else
|
|
{
|
|
strErr.Format(_T("Faild to upgrade mainframe: new version\r\nsoftware(%s) is not compatible to hardware\r\nof mainframe!"),
|
|
m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErr, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
if (!UpdateFunctionBoard())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("升级功能板失败!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Upgrade function board failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
if (!UpdateAppToDev())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("升级设备APP失败!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Upgrade App to device failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
BOOL Ccheckupdate::FindFolder(CString Foldername, CString FindFolderName)
|
|
{
|
|
CFileFind tempFind;
|
|
|
|
BOOL bFound;
|
|
bFound=tempFind.FindFile(Foldername+ "\\*.*");
|
|
|
|
int nPos = FindFolderName.ReverseFind('/');
|
|
|
|
if (nPos != -1)
|
|
{
|
|
FindFolderName = FindFolderName.Right(FindFolderName.GetLength() - nPos -1);
|
|
}
|
|
|
|
CString strTmp;
|
|
|
|
while(bFound)
|
|
{
|
|
bFound=tempFind.FindNextFile();
|
|
|
|
if(tempFind.IsDots())
|
|
continue;
|
|
|
|
// if(tempFind.IsDirectory())
|
|
// {
|
|
strTmp.Empty();
|
|
strTmp = tempFind.GetFileName();
|
|
|
|
if (strTmp == FindFolderName)
|
|
{
|
|
strTmp.Empty();
|
|
strTmp=tempFind.GetFilePath();
|
|
m_szPath = strTmp;
|
|
return TRUE;
|
|
}
|
|
// }
|
|
// else
|
|
// {
|
|
// continue;
|
|
// }
|
|
}
|
|
|
|
strTmp.Empty();
|
|
strTmp=tempFind.GetFilePath();
|
|
strTmp = strTmp.Left(strTmp.ReverseFind('\\') + 1);
|
|
m_szPath = strTmp;
|
|
|
|
tempFind.Close();
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
CString Ccheckupdate::GetPath()
|
|
{
|
|
CString szFileName;
|
|
|
|
szFileName = GetLine(buffer,nIndex);
|
|
|
|
return szFileName;
|
|
}
|
|
|
|
bool Ccheckupdate::DownLoadFileList()
|
|
{
|
|
if (!m_bIsCrulInitaled)
|
|
{
|
|
if (!m_FileTransfer.Inital())
|
|
{
|
|
MessageBoxEx(NULL, _T("FileTransfer Initail Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
m_bIsCrulInitaled = true;
|
|
}
|
|
//http://218.17.161.7:9520/liushq/GD10_FileList.ini
|
|
//http://192.168.1.110:8080/liushq
|
|
CString strUrl = _T("");
|
|
strUrl.Format(_T("%sGD10_FileList.txt"),theApp.m_strUpgUrl);
|
|
m_FileTransfer.SetOption(OPT_URL_ADDRESS, strUrl);
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_PATH, ".\\updates\\");
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_NAME, "GD10_FileList.ini");
|
|
m_FileTransfer.SetOption(OPT_TIMEOUT, "30");
|
|
m_FileTransfer.SetOption(OPT_NEED_PROGRESS, "", false);
|
|
|
|
return m_FileTransfer.DownloadFile();
|
|
}
|
|
|
|
int Ccheckupdate::StartUpdateSoft()
|
|
{
|
|
CString strFolderInfo = ".\\updates\\";
|
|
//首先检查是否创建用于存放更新文件的文件夹
|
|
if(!MakeSureDirectoryPathExists(strFolderInfo.GetBuffer(0)))
|
|
{
|
|
CString strShow = _T("");
|
|
strShow.Format(_T("Create folder updats failed! errorcode = %d"), GetLastError());
|
|
MessageBoxEx(NULL, strShow.GetBuffer(0), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return enUpdateFail;
|
|
}
|
|
|
|
if (!GetGDVersionInfo())
|
|
{
|
|
return enUpdateFail;
|
|
}
|
|
|
|
//下载兼容文件
|
|
if (!DownLoadGD10CompatVerFile())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("下载兼容版本配置文件失败!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Download device compatable-version file Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return enUpdateFail;
|
|
}
|
|
//下载FileList.ini文件
|
|
if (!DownLoadFileList())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("下载配置文件失败!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Download FileList Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return enUpdateFail;
|
|
}
|
|
|
|
//解析文件
|
|
if (!ParserFileList())
|
|
{
|
|
MessageBoxEx(NULL, _T("Parser FileList Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
m_vtDonwFileInfo.clear();
|
|
return enUpdateFail;
|
|
}
|
|
|
|
if (m_vtDonwFileInfo.empty())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("主机设备软件已经是最新版本,不需要进行升级!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Now GD_10 is the newest version, don't need to update!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return enNoNeedUpdate;
|
|
}
|
|
|
|
if (!DownLoadUpdateFiles())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("下载文件失败!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Download File Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
// DeleteDownloadFile(_T(".\\updates"));
|
|
// m_bIsUpdating = false;
|
|
// m_bIsStartUpdate = false;
|
|
return enUpdateFail;
|
|
}
|
|
|
|
if (!UpdateFiles())
|
|
{
|
|
// GetDlgItem(IDC_TITLE)->SetWindowText(_T("Update File Failed!!!"));
|
|
// m_bIsUpdating = false;
|
|
// m_bIsStartUpdate = false;
|
|
// DeleteDownloadFile(_T(".\\updates"));
|
|
return enUpdateFail;
|
|
}
|
|
DeleteDownloadFile(_T(".\\updates"));
|
|
// m_bIsUpdating = false;
|
|
// m_bIsStartUpdate = false;
|
|
// GetDlgItem(IDC_TITLE)->SetWindowText(_T("update complete..."));
|
|
// AfxMessageBox(_T("update file complete"));
|
|
return enUpdateSucc;
|
|
}
|
|
|
|
|
|
//在调用此函数之前一定要确保GD10_FileList.ini已经下载下来了
|
|
bool Ccheckupdate::ParserFileList()
|
|
{
|
|
m_bIsNeedUpgGeomative = false;
|
|
CString strFileName = _T(".\\updates\\GD10_FileList.ini");
|
|
char chBuf[MAX_PATH];
|
|
UINT unFileCount = GetPrivateProfileInt("FileUpdateInfo", "FileCount", 255, strFileName);
|
|
CString strTmp = _T("");
|
|
if (255 == unFileCount)
|
|
{
|
|
MessageBoxEx(NULL, _T("Get updates fileinfo number failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
// strTmp.Format(_T("[%d] Get updates fileinfo number failed, filecount = %d, version = %s, errorno= %d"), __LINE__,
|
|
// unFileCount, m_strNewVersion.GetBuffer(0), GetLastError());
|
|
// PrintLog(strTmp);
|
|
return false;
|
|
}
|
|
|
|
m_vtDonwFileInfo.clear();
|
|
CString strVersion = _T("");
|
|
for (int i = 0; i < unFileCount; i++)
|
|
{
|
|
STDownFileInfo stFileInfo;
|
|
CString strSection = _T("");
|
|
strVersion.Empty();
|
|
strSection.Format(_T("FileInfo%d"), i+1);
|
|
memset(chBuf, 0, sizeof(chBuf));
|
|
GetPrivateProfileString(strSection, _T("Version"), _T("NULL"), chBuf, MAX_PATH, strFileName);
|
|
strVersion = chBuf;
|
|
if (0 == strVersion.Compare(_T("NULL")))
|
|
{
|
|
strTmp.Empty();
|
|
strTmp.Format(_T("Get version in %s failed!"), strSection);
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
memset(chBuf, 0, sizeof(chBuf));
|
|
GetPrivateProfileString(strSection, "FileName", "NULL", chBuf, MAX_PATH, strFileName);
|
|
stFileInfo.strFileName = chBuf;
|
|
stFileInfo.FileType = GetPrivateProfileInt(strSection, "FileType", 255, strFileName);
|
|
if (0 == stFileInfo.strFileName.Compare("NULL"))
|
|
{
|
|
strTmp.Empty();
|
|
strTmp.Format(_T("Get FileName in %s failed!"), strSection);
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
if (255 == stFileInfo.FileType)
|
|
{
|
|
strTmp.Empty();
|
|
strTmp.Format(_T("Get Filetype in %s failed!"), strSection);
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
//如果这里又配套的需要更新的Geomative的话
|
|
if (GEOMATIVE_FILE_TYPE == stFileInfo.FileType)
|
|
{
|
|
m_bIsNeedUpgGeomative = true;
|
|
continue;
|
|
}
|
|
|
|
//首先找到相应的硬件标示,标示匹配后在比较版本号
|
|
std::map<int, STFirmwareVerInfo>::iterator iter = m_mapVerInfo.find(stFileInfo.FileType);
|
|
if (iter != m_mapVerInfo.end())
|
|
{
|
|
//删除左右两边的空格
|
|
strVersion.TrimLeft();
|
|
strVersion.TrimRight();
|
|
if (strVersion.GetLength() != iter->second.strSWVer.GetLength())
|
|
{
|
|
strTmp.Empty();
|
|
strTmp.Format(_T("The format of Version in %s is error!"), strSection);
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
//如果版本不匹配,则加入到下载文件列表中去
|
|
if (0 == strVersion.Compare(iter->second.strSWVer))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
stFileInfo.strNewVer = strVersion;
|
|
stFileInfo.bIsCompatible = false;
|
|
int nAdditinalFileCnt = GetPrivateProfileInt(strSection, "AddtionalFileCnt", 255, strFileName);
|
|
//如果存在附加文件列表,则将文件列表信息加入到下载信息中去
|
|
if (255 != nAdditinalFileCnt)
|
|
{
|
|
CString strAddFileIndex = _T(""),strAddFileName = _T("");
|
|
stFileInfo.vtAddtionalFile.clear();
|
|
for (int nAddFileIndex = 1; nAddFileIndex <= nAdditinalFileCnt; nAddFileIndex++)
|
|
{
|
|
strAddFileIndex.Empty();
|
|
strAddFileName.Empty();
|
|
strAddFileIndex.Format(_T("AddtionalFile%d"),nAddFileIndex);
|
|
memset(chBuf, 0, sizeof(chBuf));
|
|
GetPrivateProfileString(strSection, strAddFileIndex, _T("NULL"), chBuf, MAX_PATH, strFileName);
|
|
strAddFileName = chBuf;
|
|
if (0 != strAddFileName.Compare(_T("NULL")))
|
|
{
|
|
stFileInfo.vtAddtionalFile.push_back(strAddFileName);
|
|
}
|
|
|
|
}
|
|
}
|
|
m_vtDonwFileInfo.push_back(stFileInfo);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool Ccheckupdate::DownLoadUpdateFiles()
|
|
{
|
|
if (!m_bIsCrulInitaled)
|
|
{
|
|
if (!m_FileTransfer.Inital())
|
|
{
|
|
MessageBoxEx(NULL, _T("FileTransfer Initail Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
m_bIsCrulInitaled = true;
|
|
}
|
|
|
|
m_FileTransfer.SetOption(OPT_TIMEOUT, "180");
|
|
m_FileTransfer.SetOption(OPT_NEED_PROGRESS, "", false);
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_PATH, ".\\updates\\");
|
|
|
|
for (int i = 0; i < m_vtDonwFileInfo.size(); i++)
|
|
{
|
|
// m_bIsUpdating = true;
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_NAME, m_vtDonwFileInfo[i].strFileName);
|
|
CString strUrl =_T("");
|
|
strUrl.Format(_T("%s%s"), theApp.m_strUpgUrl,m_vtDonwFileInfo[i].strFileName.GetBuffer(0));
|
|
m_FileTransfer.SetOption(OPT_URL_ADDRESS, strUrl);
|
|
CString strTmp = _T("");
|
|
strTmp.Format(_T("Download %s, please wait..."),m_vtDonwFileInfo[i].strFileName.GetBuffer(0));
|
|
|
|
if (!m_FileTransfer.DownloadFile())
|
|
{
|
|
strTmp.Empty();
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
strTmp.Format(_T("下载文件 %s 失败!"), m_vtDonwFileInfo[i].strFileName.GetBuffer(0));
|
|
AfxMessageBox(strTmp);
|
|
}
|
|
else
|
|
{
|
|
strTmp.Format(_T("DownLoad file %s failed!"), m_vtDonwFileInfo[i].strFileName.GetBuffer(0));
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
// strTmp.Format(_T("[%d] download file failed!, index = %d, url = %s"),__LINE__, i+1, strUrl.GetBuffer(0));
|
|
// PrintLog(strTmp);
|
|
return false;
|
|
}
|
|
//下载附件文件
|
|
for (int j = 0; j < m_vtDonwFileInfo[i].vtAddtionalFile.size(); j++)
|
|
{
|
|
//将scr替换成txt
|
|
CString strConverName = m_vtDonwFileInfo[i].vtAddtionalFile[j];
|
|
if (-1 != strConverName.Find(_T(".scr")))
|
|
{
|
|
strConverName.Replace(_T(".scr"), _T(".txt"));
|
|
}
|
|
strUrl.Empty();
|
|
strUrl.Format(_T("%s%s"), theApp.m_strUpgUrl,strConverName);
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_NAME, m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
m_FileTransfer.SetOption(OPT_URL_ADDRESS, strUrl);
|
|
if (!m_FileTransfer.DownloadFile())
|
|
{
|
|
strTmp.Empty();
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
strTmp.Format(_T("下载文件 %s 失败!"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
AfxMessageBox(strTmp);
|
|
}
|
|
else
|
|
{
|
|
strTmp.Format(_T("DownLoad file %s failed!"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
// m_progrss.SetPos(100);
|
|
// GetDlgItem(IDC_NUM)->SetWindowText("100%%");
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool Ccheckupdate::UpdateFiles()
|
|
{
|
|
if(!MakeSureDirectoryPathExists(_T(".\\firmware\\")))
|
|
{
|
|
CString strShow = _T("");
|
|
strShow.Format(_T("Create folder firmware failed! errorcode = %d"), GetLastError());
|
|
MessageBoxEx(NULL, strShow.GetBuffer(0), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
CString strSrcFile = _T(".\\updates\\firmware_version_info.ini");
|
|
CString strDstFile = _T(".\\firmware\\firmware_version_info.ini");
|
|
if (!CopyFile(strSrcFile.GetBuffer(0), strDstFile.GetBuffer(0), FALSE))
|
|
{
|
|
CString strTmp =_T("");
|
|
strTmp.Format(_T("Copy file failed, src_file = %s ,dst_file = %s, errorno = %d"),
|
|
strSrcFile, strDstFile, GetLastError());
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
for (int i = 0; i < m_vtDonwFileInfo.size(); i++)
|
|
{
|
|
strSrcFile.Empty();
|
|
strDstFile.Empty();
|
|
strSrcFile.Format(_T(".\\updates\\%s"), m_vtDonwFileInfo[i].strFileName);
|
|
strDstFile.Format(_T(".\\firmware\\%s"), m_vtDonwFileInfo[i].strFileName);
|
|
if (!CopyFile(strSrcFile.GetBuffer(0), strDstFile.GetBuffer(0), FALSE))
|
|
{
|
|
CString strTmp =_T("");
|
|
strTmp.Format(_T("Copy file failed, src_file = %s ,dst_file = %s, errorno = %d"),
|
|
strSrcFile.GetBuffer(0), strDstFile.GetBuffer(0), GetLastError());
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
for (int j = 0; j < m_vtDonwFileInfo[i].vtAddtionalFile.size(); j++)
|
|
{
|
|
strSrcFile.Empty();
|
|
strDstFile.Empty();
|
|
strSrcFile.Format(_T(".\\updates\\%s"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
strDstFile.Format(_T(".\\firmware\\%s"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
if (!CopyFile(strSrcFile.GetBuffer(0), strDstFile.GetBuffer(0), FALSE))
|
|
{
|
|
CString strTmp =_T("");
|
|
strTmp.Format(_T("Copy file failed, src_file = %s ,dst_file = %s, errorno = %d"),
|
|
strSrcFile.GetBuffer(0), strDstFile.GetBuffer(0), GetLastError());
|
|
MessageBoxEx(NULL, strTmp, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
bool Ccheckupdate::GetGDVersionInfo()
|
|
{
|
|
if (NULL == m_pDevice)
|
|
{
|
|
MessageBoxEx(NULL, _T("Device Ptr can not be NULL!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
CString strOrder = _T("version()\r\n");
|
|
CString strResBuffer = _T("");
|
|
if (!m_pDevice->ExecuteOrder(strOrder, ">", &strResBuffer))
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("获取主机设备的版本信息失败!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Faild to get the version information of mainframe!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
CStringArray strTemp;
|
|
strTemp.RemoveAll();
|
|
SplitterString(strTemp, strResBuffer, ";");
|
|
if (strTemp.GetSize() < 1)
|
|
{
|
|
MessageBoxEx(NULL, _T("Parser version information of mainframe error!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
m_mapVerInfo.clear();
|
|
int nPosComma = -1; //逗号的位置
|
|
int nPosColon = -1; //冒号的位置
|
|
int nSWPos = -1; //软件版本号SW字符的起始位置
|
|
int nHWPos = -1; //硬件版本号HW字符的起始位置
|
|
int nSWVerLen = 6;
|
|
CString strInfo = _T("");
|
|
|
|
// BYTE ucFlag = 0;
|
|
for (int i = 0; i < strTemp.GetSize(); i++)
|
|
{
|
|
//查找软件版本号,如果此时未能查找到软件版本号则直接跳转到下一个查询
|
|
nSWPos = strTemp[i].Find(_T("SW"));
|
|
nHWPos = strTemp[i].Find(_T("HW"));
|
|
if (-1 == nSWPos || -1 == nHWPos)
|
|
{
|
|
continue;
|
|
}
|
|
if (strTemp[i].GetLength() < (nSWPos + 6))
|
|
{
|
|
strInfo.Format("Parser version info error,version = %s",strTemp[i]);
|
|
MessageBoxEx(NULL, strInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
//取出硬件版本信息,在这里默认硬件的ID标示只有1位数字,
|
|
//也就是HW1.0中的1,因此最多支持从0-9
|
|
int nHWID = atoi(strTemp[i].Mid(nHWPos+2,1));
|
|
if (nHWID < 0 || nHWID > 9)
|
|
{
|
|
strInfo.Format("Parser version's hardware info error,version = %s",strTemp[i]);
|
|
MessageBoxEx(NULL, strInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
STFirmwareVerInfo stFWVer;
|
|
stFWVer.strHWVer = strTemp[i].Mid(nHWPos+2,3);
|
|
//在这里支持的软件版本的格式为SW1.2.01,也就是6位
|
|
strInfo.Empty();
|
|
stFWVer.strSWVer = strTemp[i].Mid(nSWPos+2,6);
|
|
//将版本信息插入到map中去
|
|
m_mapVerInfo[nHWID] = stFWVer;
|
|
/*
|
|
strTemp[i].TrimRight();//删除右侧的空格
|
|
nPosComma = strTemp[i].Find(_T(","));
|
|
nPosColon = strTemp[i].Find(_T(":"));
|
|
if (-1 == nPosColon)
|
|
{
|
|
continue;
|
|
}
|
|
strInfo.Empty();
|
|
strInfo = strTemp[i].Mid(nPosColon-3, 3);
|
|
//在这里有一个基础依据就是如果存在着软件版本和硬件版本,软件版本和硬件用逗号隔开
|
|
//并且软件版本在逗号的左边,硬件版本在逗号的右边
|
|
int nCnt = (-1 == nPosComma) ? strTemp[i].GetLength()-nPosColon-1 : nPosComma-nPosColon-1;
|
|
if (_T("APP") == strInfo)
|
|
{
|
|
m_strCurVerArray[EN_APP_MODULE] = strTemp[i].Mid(nPosColon+1, nCnt);
|
|
ucFlag = ucFlag | 0x01;
|
|
}
|
|
else if (_T("TXB") == strInfo)
|
|
{
|
|
m_strCurVerArray[EN_TXB_MODULE] = strTemp[i].Mid(nPosColon+1, nCnt);
|
|
ucFlag = ucFlag | 0x02;
|
|
}
|
|
else if (_T("RXB") == strInfo)
|
|
{
|
|
m_strCurVerArray[EN_RXB_MODULE] = strTemp[i].Mid(nPosColon+1, nCnt);
|
|
ucFlag = ucFlag | 0x04;
|
|
}
|
|
else
|
|
continue;
|
|
*/
|
|
}
|
|
//判断三个版本信息是不是都获取到了
|
|
if (m_mapVerInfo.size() < 3)
|
|
{
|
|
MessageBoxEx(NULL, _T("Can not get all gd20 modules's version!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
return true;
|
|
|
|
}
|
|
|
|
bool Ccheckupdate::UpdateFunctionBoard()
|
|
{
|
|
//_T(".\\firmware\\%s"),
|
|
CString strFuncFileInfo = _T("");
|
|
CString strOrder = _T("");
|
|
CString strResBuffer = _T("");
|
|
CString strResult = _T("");
|
|
CString strErrInfo = _T("");
|
|
CString strUpgCmd = _T("");
|
|
int nWaitTimes = 12000;
|
|
for (int i = 0; i < m_vtDonwFileInfo.size(); i++)
|
|
{
|
|
strUpgCmd.Empty();
|
|
switch (m_vtDonwFileInfo[i].FileType)
|
|
{
|
|
case EN_APP_MODULE:
|
|
continue;
|
|
case EN_TXB_MODULE:
|
|
strUpgCmd = _T("upgrade(\"TXB\")\r\n");
|
|
break;
|
|
case EN_RXB_MODULE:
|
|
strUpgCmd = _T("upgrade(\"RXB\")\r\n");
|
|
break;
|
|
case EN_CBL_MODULE:
|
|
strUpgCmd = _T("iapcable()");
|
|
break;
|
|
default:
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Not support hardware type(%d)!"),m_vtDonwFileInfo[i].FileType);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
continue;
|
|
}
|
|
|
|
if (false == m_vtDonwFileInfo[i].bIsCompatible)
|
|
{
|
|
strErrInfo.Empty();
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
{
|
|
strErrInfo.Format(_T("新版本软件(版本号:%s, 名称:%s) 和设备上的硬件版本不兼容!"),
|
|
m_vtDonwFileInfo[i].strNewVer, m_vtDonwFileInfo[i].strFileName);
|
|
AfxMessageBox(strErrInfo);
|
|
}
|
|
else
|
|
{
|
|
strErrInfo.Format(_T("New version(ver:%s, name:%s) is not match with version of hardware in device!"),
|
|
m_vtDonwFileInfo[i].strNewVer, m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
}
|
|
continue;
|
|
}
|
|
|
|
//先下载附件文件
|
|
for (int j = 0; j < m_vtDonwFileInfo[i].vtAddtionalFile.size(); j++)
|
|
{
|
|
strOrder.Empty();
|
|
strOrder.Format(_T("rm(\"/SD/%s\")\r\n"),m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
if (!m_pDevice->ExecuteOrder(strOrder, ">", &strResBuffer))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Excute remove %s failed!!!"), m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
if (!m_pDevice->SendFile(_T("/SD/"), _T(".\\firmware\\"), m_vtDonwFileInfo[i].vtAddtionalFile[j]))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Send file %s failed!!!"),m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
strFuncFileInfo.Empty();
|
|
strOrder.Empty();
|
|
strResBuffer.Empty();
|
|
strOrder.Format(_T("rm(\"/SD/%s\")\r\n"),m_vtDonwFileInfo[i].strFileName);
|
|
if (!m_pDevice->ExecuteOrder(strOrder, ">", &strResBuffer))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Excute remove %s failed!!!"), m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
if (!m_pDevice->SendFile(_T("/SD/"), _T(".\\firmware\\"), m_vtDonwFileInfo[i].strFileName))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Send file %s failed!!!"),m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
|
|
strResBuffer.Empty();
|
|
strResult.Empty();
|
|
|
|
if (!m_pDevice->ExecuteOrder(strUpgCmd, ">", &strResBuffer,3,nWaitTimes))
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Excute upgrade %s failed,please restart your gd-20 device and retry it!"),m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
if (-1 == strResBuffer.Find(_T("]")))
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("该设备不支持升级功能,请检查主机设备版本信息!"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Upgrade function is not supported in device, please check your gd-20 version!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
CString strErrShow = _T("");
|
|
strErrShow.Format(_T("[Ccheckupdate][%d]Upgrade function is not supported in device,return info = %s"),__LINE__,strResBuffer);
|
|
CFileOperTools::GetInstance()->WriteComLog(strErrShow);
|
|
return false;
|
|
}
|
|
|
|
GetSubStringInHeadAndTail(strResBuffer, strResult, _T("["), _T("]"));
|
|
if (_T("1") != strResult)
|
|
{
|
|
strErrInfo.Empty();
|
|
strErrInfo.Format(_T("Upgrade %s to function board failed!!!"),m_vtDonwFileInfo[i].strFileName);
|
|
MessageBoxEx(NULL, strErrInfo, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void Ccheckupdate::DeleteDownloadFile(CString strPath)
|
|
{
|
|
CString strFileName = _T("");
|
|
strFileName.Format(_T("%s\\firmware_version_info.ini"),strPath);
|
|
DeleteFile(strFileName);
|
|
strFileName.Empty();
|
|
strFileName.Format(_T("%s\\GD10_FileList.ini"),strPath);
|
|
DeleteFile(strFileName);
|
|
for (int i = 0; i < m_vtDonwFileInfo.size(); i++)
|
|
{
|
|
strFileName.Empty();
|
|
strFileName.Format(_T("%s\\%s"),strPath,m_vtDonwFileInfo[i].strFileName);
|
|
DeleteFile(strFileName);
|
|
for (int j = 0; j < m_vtDonwFileInfo[i].vtAddtionalFile.size(); j++)
|
|
{
|
|
strFileName.Empty();
|
|
strFileName.Format(_T("%s\\%s"),strPath,m_vtDonwFileInfo[i].vtAddtionalFile[j]);
|
|
DeleteFile(strFileName);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
bool Ccheckupdate::CheckHwSwCompatible(int iCompHWType, CString strCompSWVer,CString strFileName)
|
|
{
|
|
char chBuf[MAX_PATH];
|
|
memset(chBuf, 0, sizeof(chBuf));
|
|
CString strInfo = _T("");
|
|
CString strText = _T("");
|
|
UINT unFWCnt = GetPrivateProfileInt(_T("FirmwareInfo"), _T("FirmwareCount"), 255, strFileName);
|
|
if (255 == unFWCnt)
|
|
{
|
|
MessageBoxEx(NULL, _T("Parser firmware_version_info info error!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
for (int i = 1; i <= unFWCnt; i++)
|
|
{
|
|
CString strIndex = _T("");
|
|
strIndex.Format(_T("Firmware%d"),i);
|
|
int iHWType = GetPrivateProfileInt(strIndex, _T("HW_Type"), 255, strFileName);
|
|
if (255 == iHWType)
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("Parser HWtype error in %s!"),strIndex);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
//首先查找是否下载了硬件相应的驱动,下载了的话则检查兼容性
|
|
if (iCompHWType != iHWType)
|
|
{
|
|
continue;
|
|
}
|
|
int iHwVerCnt = GetPrivateProfileInt(strIndex, _T("HW_Version_Count"), 255, strFileName);
|
|
if (255 == iHwVerCnt)
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("Parser HW_Version_Count error in %s!"),strIndex);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
std::map<int, STFirmwareVerInfo>::iterator iter = m_mapVerInfo.find(iHWType);
|
|
if (iter == m_mapVerInfo.end())
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("HWType(%d) in %s is not found in gd20's verion infomation!"),iHWType, strIndex);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
CString strHWVerInfo = _T("");
|
|
CString strVerIndex = _T("");
|
|
CString strSWInfo = _T("");
|
|
//首先用GD10现有的硬件版本号去版本适配文件中查找,如果找到,则对比软件版本号是否匹配
|
|
for (int iHWVerIndx = 1; iHWVerIndx <= iHwVerCnt; iHWVerIndx++)
|
|
{
|
|
strVerIndex.Empty();
|
|
strHWVerInfo.Empty();
|
|
strVerIndex.Format(_T("HW_Version%d"), iHWVerIndx);
|
|
memset(chBuf, 0, sizeof(chBuf));
|
|
GetPrivateProfileString(strIndex, strVerIndex, _T("NULL"), chBuf, MAX_PATH, strFileName);
|
|
strHWVerInfo = chBuf;
|
|
if (0 == strHWVerInfo.Compare(_T("NULL")))
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("Get %s in %s failed!"), strVerIndex, strIndex);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
if (0 == strHWVerInfo.Compare(iter->second.strHWVer))
|
|
{
|
|
strVerIndex.Empty();
|
|
strSWInfo.Empty();
|
|
strVerIndex.Format(_T("HW_Version%d_Adapter_SW"), iHWVerIndx);
|
|
memset(chBuf, 0, sizeof(chBuf));
|
|
GetPrivateProfileString(strIndex, strVerIndex, _T("NULL"), chBuf, MAX_PATH, strFileName);
|
|
strSWInfo = chBuf;
|
|
if (0 == strSWInfo.Compare(_T("NULL")))
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("Get %s in %s failed!"), strVerIndex, strIndex);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
if (CheckSWVerIsCompatibale(strSWInfo, strCompSWVer))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool Ccheckupdate::CheckSWVerIsCompatibale(CString strAdapaterVer, CString strSWver)
|
|
{
|
|
if (strAdapaterVer.IsEmpty() || strSWver.IsEmpty())
|
|
{
|
|
MessageBoxEx(NULL, _T("Neither adapaterVer nor comparedVer can be empty!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
|
|
CStringArray strVerArr;
|
|
strVerArr.RemoveAll();
|
|
SplitterString(strVerArr, strAdapaterVer, _T(","));
|
|
CString strText = _T("");
|
|
if (strVerArr.GetSize() < 1)
|
|
{
|
|
strText.Format(_T("Parser adapater version info error!version context = %s"), strAdapaterVer);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
CString strVal = _T("");
|
|
strSWver.Remove(_T('.'));
|
|
int iCompareVer = atoi(strSWver);
|
|
|
|
for (int i = 0; i < strVerArr.GetSize(); i++)
|
|
{
|
|
strVal.Empty();
|
|
strVal = strVerArr.GetAt(i);
|
|
strVal.TrimLeft();
|
|
strVal.TrimRight();
|
|
if (-1 != strVal.Find(_T("-")))
|
|
{
|
|
CStringArray strArrVerRanger;
|
|
strArrVerRanger.RemoveAll();
|
|
SplitterString(strArrVerRanger, strVal, _T("-"));
|
|
if (2 != strArrVerRanger.GetSize())
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("Parser separative sign error! conteng = %s"), strVal);
|
|
MessageBoxEx(NULL, strText, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
int iMinVer = 0, iMaxVer = 0;
|
|
CString strTmp = _T("");
|
|
strTmp = strArrVerRanger.GetAt(0);
|
|
strTmp.Remove(_T('.'));
|
|
iMinVer = atoi(strTmp);
|
|
|
|
strTmp.Empty();
|
|
strTmp = strArrVerRanger.GetAt(1);
|
|
strTmp.Remove(_T('.'));
|
|
iMaxVer = atoi(strTmp);
|
|
//如果最小版本大于最大版本则提示错误
|
|
if (iMinVer > iMaxVer)
|
|
{
|
|
strText.Empty();
|
|
strText.Format(_T("compatiable version info disorder! content = %s"),strVal);
|
|
return false;
|
|
}
|
|
if (iCompareVer>= iMinVer && iCompareVer <= iMaxVer)
|
|
{
|
|
return true;
|
|
}
|
|
continue;
|
|
}
|
|
strVal.Remove(_T('.'));
|
|
if (atoi(strVal) == iCompareVer)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
}
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
bool Ccheckupdate::DownLoadGD10CompatVerFile()
|
|
{
|
|
if (!m_bIsCrulInitaled)
|
|
{
|
|
if (!m_FileTransfer.Inital())
|
|
{
|
|
MessageBoxEx(NULL, _T("FileTransfer Initail Failed!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return false;
|
|
}
|
|
m_bIsCrulInitaled = true;
|
|
}
|
|
//http://218.17.161.7:9520/liushq/GD10_FileList.ini
|
|
//http://192.168.1.110:8080/liushq
|
|
CString strUrl;
|
|
strUrl.Format(_T("%sfirmware_version_info.txt"),theApp.m_strUpgUrl);
|
|
m_FileTransfer.SetOption(OPT_URL_ADDRESS, strUrl);
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_PATH, ".\\updates\\");
|
|
m_FileTransfer.SetOption(OPT_DOWNLOAD_NAME, "firmware_version_info.ini");
|
|
m_FileTransfer.SetOption(OPT_TIMEOUT, "30");
|
|
m_FileTransfer.SetOption(OPT_NEED_PROGRESS, "", false);
|
|
|
|
return m_FileTransfer.DownloadFile();
|
|
} |