void
BluetoothServiceChildProcess::SendFile(
  const BluetoothAddress& aDeviceAddress,
  BlobParent* aBlobParent,
  BlobChild* aBlobChild,
  BluetoothReplyRunnable* aRunnable)
{
  SendRequest(aRunnable, SendFileRequest(aDeviceAddress, nullptr, aBlobChild));
}
void CFileServerDlg::OnDropFiles(HDROP hDropInfo)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	try
	{
		if(GetPrompt(m_hWnd))
		{
			GetDlgItem(IDC_STATIC_STATUS)->ShowWindow(SW_SHOW);
			if(StrCmp(gl_strLanguageId, CHINESE) == 0)
				SetDlgItemText(IDC_STATIC_STATUS, szStatTermiate_CH);
			else
				SetDlgItemText(IDC_STATIC_STATUS, szStatTermiate_EN);
			SetForegroundWindow();
			return;
		}

		CDialog::OnDropFiles(hDropInfo);

		if(m_bSending)
		{
			CString strMsg = _T("正等待响应或已经有文件正在传输,请稍候重试。");
			if(StrCmp(gl_strLanguageId, CHINESE) == 0)
				strMsg = szWaiting_CH;
			else
				strMsg = szWaiting_EN;
			m_PromptDlg.SetMsgText(strMsg);
			m_PromptDlg.Show();
			return;
		}
		else if(m_bReceive)
		{
			CString strMsg = _T("正等待响应或已经有文件正在传输,请稍候重试。");
			if(StrCmp(gl_strLanguageId, CHINESE) == 0)
				strMsg = szWaiting_CH;
			else
				strMsg = szWaiting_EN;
			m_PromptDlg.SetMsgText(strMsg);
			m_PromptDlg.Show();
			return;
		}


		char lpszFileName[MAX_PATH]; 
		int nFileCount, k; 

		nFileCount = DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);

		CString strPathFileName;
		int filecount = 0;
		int foldercount = 0;
		for(k = 0; k < nFileCount; k++) 
		{ 
			DragQueryFile(hDropInfo, k, lpszFileName, MAX_PATH); 
			CFileFind filefind;
			if(filefind.FindFile(lpszFileName))
			{
				filefind.FindNextFile();
				if(filefind.IsDirectory())
					if(filefind.IsDirectory())
					{
						foldercount ++;
						continue;
					}
					strPathFileName = filefind.GetFilePath();
					filecount ++;
			}
		} 
		if(filecount > 1)
		{
			CString strMsg = _T("一次只能传送单个文件。");
			if(StrCmp(gl_strLanguageId, CHINESE) == 0)
				strMsg = szOneFileOnly_CH;
			else
				strMsg = szOneFileOnly_EN;
			m_PromptDlg.SetMsgText(strMsg);
			m_PromptDlg.Show();
			m_bSending = false;
			return;
		}

		if(foldercount > 0)
		{
			CString strMsg = _T("不支持文件夹传输。");
			if(StrCmp(gl_strLanguageId, CHINESE) == 0)
				strMsg = szNotFolder_CH;
			else
				strMsg = szNotFolder_EN;
			m_PromptDlg.SetMsgText(strMsg);
			m_PromptDlg.Show();
			m_bSending = false;
			return;
		}

		BasicFileInfo info;
		CString strFileName = strPathFileName;
		strcpy_s(info.FileName, sizeof(info.FileName), strFileName);
		info.Size = 0;
		CFile file;
		if(file.Open(strPathFileName, CFile::modeRead))
		{
			info.Size = file.GetLength();
			file.Close();
		}

		if (info.Size == 0)
		{
			CString strMsg = _T("不支持大小为0文件传输。");
			if(StrCmp(gl_strLanguageId, CHINESE) == 0)
				strMsg = szNotZeroFile_CH;
			else
				strMsg = szNotZeroFile_EN;
			m_PromptDlg.SetMsgText(strMsg);
			m_PromptDlg.Show();
			m_bSending = false;
			return;
		}

		State state;
		state = State::SRequestSend;
		SendMessage(WM_ADDLISTITEM, (WPARAM)&info, (LPARAM)&state);

		//this->m_strSendFileName = strPathFileName;

		CString strSendFilePathName = strPathFileName;
		int nFind = strSendFilePathName.ReverseFind('\\');
		if(nFind != -1)
		{
			m_strSendPath = strSendFilePathName.Left(nFind);
			m_strSendFileName = strSendFilePathName.Right(strPathFileName.GetLength() - nFind - 1);
		}


		m_bSending = true;
		if(!SendFileRequest(strPathFileName))
		{
			m_bSending = false;
		}
	}
	catch(...)
	{
		if (gl_pLogger) gl_pLogger->log_error("CFileServerDlg::OnDropFiles unknown exception.");
	}
}