PageRenderTime 59ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Modules/FileTransfer/FileTransferUIThread.h

https://gitlab.com/yoage/TTWinClient
C Header | 87 lines | 37 code | 9 blank | 41 comment | 0 complexity | 033062b960ead41b98e073a4a5ba4ca8 MD5 | raw file
Possible License(s): LGPL-3.0
  1. /*******************************************************************************
  2. * @file FileTransferUIThread.h 2014\9\17 16:32:15 $
  3. * @author 快刀<kuaidao@mogujie.com>
  4. * @brief 包含多个socket的文件传输UI thread
  5. ******************************************************************************/
  6. #ifndef FILETRANSFERUITHREAD_16C2B941_3E94_4B6F_B488_0B82EC2B3F26_H__
  7. #define FILETRANSFERUITHREAD_16C2B941_3E94_4B6F_B488_0B82EC2B3F26_H__
  8. #include "utility/TTThread.h"
  9. #include "utility/TTAutoLock.h"
  10. #include <list>
  11. /******************************************************************************/
  12. using namespace util;
  13. class FileTransferSocket;
  14. #define WM_FILE_TRANSFER WM_USER + 888
  15. /**
  16. * The class <code>包含多个socket的文件传输UI thread</code>
  17. *
  18. */
  19. class FileTransferUIThread : public TTThread
  20. {
  21. public:
  22. /** @name Constructors and Destructor*/
  23. //@{
  24. /**
  25. * Constructor
  26. */
  27. FileTransferUIThread();
  28. /**
  29. * Destructor
  30. */
  31. virtual ~FileTransferUIThread();
  32. //@}
  33. public:
  34. void Shutdown();
  35. virtual UInt32 process();
  36. public:
  37. /**
  38. * 在UI thread中异步创建文件传输socket
  39. *
  40. * @param std::string & taskId 文件传输任务id
  41. * @return void
  42. * @exception there is no any exception to throw.
  43. */
  44. void openFileSocketByTaskId(std::string& taskId);
  45. /**
  46. * 在UI thread中关闭文件传输socket
  47. *
  48. * @param std::string & taskId 文件传输任务id
  49. * @return void
  50. * @exception there is no any exception to throw.
  51. */
  52. void closeFileSocketByTaskId(std::string& taskId);
  53. /**
  54. * 向文件传输服务器发送接收文件信令
  55. *
  56. * @param std::string & taskId
  57. * @return BOOL
  58. * @exception there is no any exception to throw.
  59. */
  60. BOOL acceptFileTransfer(const std::string& taskId);
  61. BOOL rejectFileTransfer(const std::string& taskId);
  62. BOOL cancelFileTransfer(const std::string& taskId);
  63. private:
  64. HWND _createWnd();
  65. void _releaseWnd();
  66. void _closeAllFileSockets();
  67. static LRESULT _stdcall _WndProc(HWND hWnd
  68. , UINT message
  69. , WPARAM wparam
  70. , LPARAM lparam);
  71. FileTransferSocket* _findFileSocketByTaskId(const std::string& taskId);
  72. public:
  73. HWND m_hWnd;
  74. std::list<FileTransferSocket*> m_lstFileTransSockets;
  75. util::TTFastLock m_lock;
  76. };
  77. /******************************************************************************/
  78. #endif// FILETRANSFERUITHREAD_16C2B941_3E94_4B6F_B488_0B82EC2B3F26_H__