コード例 #1
0
ファイル: FTPDlg.cpp プロジェクト: asion0/AsionGitCodes
bool CFTPDlg::TransferFile(BinaryData& ephData)
{
	bool ret = true;
	int lSize = ephData.Size();
	int totalBytes = 0;
	while(lSize > 0)
	{
		int sentBytes = (lSize >= FlashBytes[0]) ? FlashBytes[0] : lSize;
		CGPSDlg::gpsDlg->SendToTargetNoAck(ephData.GetBuffer(totalBytes), sentBytes);
		totalBytes += sentBytes;
		if((totalBytes % sentBytes) == 0)
		{
			if(!CGPSDlg::gpsDlg->wait_res("OK"))
			{
				ret = false;
				break;
			}
		}
		lSize -= sentBytes;
		float fpos = (((float) totalBytes) / ephData.Size()) * 100;
		m_progress.SetPos((int)fpos);
	}	

	if (!CGPSDlg::gpsDlg->wait_res("END"))
	{
		ret = false;
	}
	Sleep(500);
	return ret;
}
コード例 #2
0
ファイル: FTPDlg.cpp プロジェクト: asion0/AsionGitCodes
bool CFTPDlg::UploadBin()
{
	U08 mycheckt = 0, mycheckb = 0;
	BinaryData ephData;
	if(m_agpsMode == 4)
	{
		ephData.ReadFromResource(IDR_OLDEPH, "EDAT");
	}
	else
	{
		ephData.ReadFromFile(m_ephFileName);
	}

	for(int i=0; i<ephData.Size(); ++i)
    {
		if(i < 0x10000)
		{
			mycheckb += ephData[i];
		}
        mycheckt = mycheckt + ephData[i];
    }	

	CString strMsg;
	strMsg.Format("BINSIZE = %d Checksum = %d Checksumb = %d ", ephData.Size(), mycheckt, mycheckb);
	if(CGPSDlg::gpsDlg->send_command_withackString((U08*)(LPCSTR)strMsg, 
		strMsg.GetLength() + 1, "OK"))
	{
		m_progress.SetPos(2);	
		return TransferFile(ephData);
	}
	else
	{
		return false;
	}
	return true;
}