/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

  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__