Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
5.6 KiB

  1. #ifndef __NmConference_h__
  2. #define __NmConference_h__
  3. #include "SDKInternal.h"
  4. #include "FtHook.h"
  5. // Forward decls
  6. class CNmMemberObj;
  7. class CNmManagerObj;
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CNmConferenceObj
  10. class ATL_NO_VTABLE CNmConferenceObj :
  11. public CComObjectRootEx<CComSingleThreadModel>,
  12. public IConnectionPointContainerImpl<CNmConferenceObj>,
  13. public IConnectionPointImpl<CNmConferenceObj, &IID_INmConferenceNotify, CComDynamicUnkArray>,
  14. public INmConference,
  15. public INmConferenceNotify2,
  16. public IInternalConferenceObj,
  17. public IMbftEvents
  18. {
  19. protected:
  20. // Data
  21. CComPtr<INmConference> m_spInternalINmConference;
  22. CSimpleArray<INmMember*> m_SDKMemberObjs;
  23. CSimpleArray<INmChannel*> m_SDKChannelObjs;
  24. CSimpleArray<GUID> m_DataChannelGUIDList;
  25. DWORD m_dwInternalINmConferenceAdvise;
  26. CNmManagerObj* m_pManagerObj;
  27. NM_CONFERENCE_STATE m_State;
  28. bool m_bFTHookedUp;
  29. BOOL m_bLocalVideoActive;
  30. BOOL m_bRemoteVideoActive;
  31. public:
  32. DECLARE_PROTECT_FINAL_CONSTRUCT()
  33. DECLARE_NO_REGISTRY()
  34. DECLARE_NOT_AGGREGATABLE(CNmConferenceObj)
  35. BEGIN_COM_MAP(CNmConferenceObj)
  36. COM_INTERFACE_ENTRY(INmConference)
  37. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  38. COM_INTERFACE_ENTRY(INmConferenceNotify)
  39. COM_INTERFACE_ENTRY(INmConferenceNotify2)
  40. COM_INTERFACE_ENTRY(IInternalConferenceObj)
  41. END_COM_MAP()
  42. BEGIN_CONNECTION_POINT_MAP(CNmConferenceObj)
  43. CONNECTION_POINT_ENTRY(IID_INmConferenceNotify)
  44. END_CONNECTION_POINT_MAP()
  45. // Construction/destruction
  46. CNmConferenceObj();
  47. ~CNmConferenceObj();
  48. HRESULT FinalConstruct();
  49. ULONG InternalRelease();
  50. static HRESULT CreateInstance(CNmManagerObj* pManagerObj, INmConference* pInternalINmConferenece, INmConference** ppConference);
  51. static HRESULT InitSDK();
  52. static void CleanupSDK();
  53. // INmConference methods
  54. STDMETHOD(GetName)(BSTR *pbstrName);
  55. STDMETHOD(GetID)(ULONG * puID);
  56. STDMETHOD(GetState)(NM_CONFERENCE_STATE *pState);
  57. STDMETHOD(GetNmchCaps)(ULONG *puchCaps);
  58. STDMETHOD(GetTopProvider)(INmMember **ppMember);
  59. STDMETHOD(EnumMember)(IEnumNmMember **ppEnum);
  60. STDMETHOD(GetMemberCount)(ULONG *puCount);
  61. STDMETHOD(CreateChannel)(INmChannel **ppChannel, ULONG uNmCh, INmMember *pMember);
  62. STDMETHOD(EnumChannel)(IEnumNmChannel **ppEnum);
  63. STDMETHOD(GetChannelCount)(ULONG *puCount);
  64. STDMETHOD(CreateDataChannel)(INmChannelData **ppChannel, REFGUID rguid);
  65. STDMETHOD(Host)(void);
  66. STDMETHOD(Leave)(void);
  67. STDMETHOD(IsHosting)(void);
  68. STDMETHOD(LaunchRemote)(REFGUID rguid, INmMember *pMember);
  69. // INmConferenceNotify2 methods:
  70. //
  71. STDMETHOD(NmUI)(CONFN uNotify);
  72. STDMETHOD(StateChanged)(NM_CONFERENCE_STATE uState);
  73. STDMETHOD(MemberChanged)(NM_MEMBER_NOTIFY uNotify, INmMember *pInternalMember);
  74. STDMETHOD(ChannelChanged)(NM_CHANNEL_NOTIFY uNotify, INmChannel *pInternalChannel);
  75. STDMETHOD(StreamEvent)(NM_STREAMEVENT uEvent, UINT uSubCode,INmChannel *pInternalChannel);
  76. //IInternalConferenceObj
  77. STDMETHOD(GetInternalINmConference)(INmConference** ppConference);
  78. STDMETHOD(GetMemberFromNodeID)(DWORD dwNodeID, INmMember** ppMember);
  79. STDMETHOD(RemoveAllMembersAndChannels)();
  80. STDMETHOD(AppSharingStateChanged)(BOOL bActive);
  81. STDMETHOD(SharableAppStateChanged)(HWND hWnd, NM_SHAPP_STATE state);
  82. STDMETHOD(ASLocalMemberChanged)();
  83. STDMETHOD(ASMemberChanged)(UINT gccID);
  84. STDMETHOD(FireNotificationsToSyncState)();
  85. STDMETHOD(AppSharingChannelChanged)();
  86. STDMETHOD(FireNotificationsToSyncToInternalObject)();
  87. STDMETHOD(EnsureFTChannel)();
  88. STDMETHOD(AudioChannelActiveState)(BOOL bActive, BOOL bIsIncoming);
  89. STDMETHOD(VideoChannelActiveState)(BOOL bActive, BOOL bIsIncoming);
  90. STDMETHOD(VideoChannelPropChanged)(DWORD dwProp, BOOL bIsIncoming);
  91. STDMETHOD(VideoChannelStateChanged)(NM_VIDEO_STATE uState, BOOL bIsIncoming);
  92. // IMbftEvent Interface
  93. STDMETHOD(OnInitializeComplete)(void);
  94. STDMETHOD(OnPeerAdded)(MBFT_PEER_INFO *pInfo);
  95. STDMETHOD(OnPeerRemoved)(MBFT_PEER_INFO *pInfo);
  96. STDMETHOD(OnFileOffer)(MBFT_FILE_OFFER *pOffer);
  97. STDMETHOD(OnFileProgress)(MBFT_FILE_PROGRESS *pProgress);
  98. STDMETHOD(OnFileEnd)(MBFTFILEHANDLE hFile);
  99. STDMETHOD(OnFileError)(MBFT_EVENT_ERROR *pEvent);
  100. STDMETHOD(OnFileEventEnd)(MBFTEVENTHANDLE hEvent);
  101. STDMETHOD(OnSessionEnd)(void);
  102. // Notifications
  103. HRESULT Fire_NmUI(CONFN uNotify);
  104. HRESULT Fire_StateChanged(NM_CONFERENCE_STATE uState);
  105. HRESULT Fire_MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember *pMember);
  106. HRESULT Fire_ChannelChanged(NM_CHANNEL_NOTIFY uNotify, INmChannel *pInternalChannel);
  107. INmMember* GetSDKMemberFromInternalMember(INmMember* pInternalMember);
  108. INmChannel* GetSDKChannelFromInternalChannel(INmChannel* pInternalChannel);
  109. INmMember* GetLocalSDKMember();
  110. private:
  111. // helper Fns
  112. static HRESULT _CreateInstanceGuts(CComObject<CNmConferenceObj> *p, INmConference** ppConference);
  113. HRESULT _RemoveMember(INmMember* pInternalMember);
  114. HRESULT _RemoveChannel(INmChannel* pSDKChannel);
  115. void _FreeInternalStuff();
  116. bool _IsGuidInDataChannelList(GUID& rg);
  117. HRESULT _AddAppShareChannel();
  118. HRESULT _AddFileTransferChannel();
  119. void _EnsureFtChannelAdded();
  120. void AddMemberToAsChannel(INmMember* pSDKMember);
  121. void RemoveMemberFromAsChannel(INmMember* pSDKMember);
  122. void AddMemberToFtChannel(INmMember* pSDKMember);
  123. void RemoveMemberFromFtChannel(INmMember* pSDKMember);
  124. INmChannel* _GetAppSharingChannel();
  125. INmChannel* _GetFtChannel();
  126. INmChannel* _GetAudioChannel(BOOL bIncoming);
  127. INmChannel* _GetVideoChannel(BOOL bIncoming);
  128. HRESULT _ASMemberChanged(INmMember *pSDKMember);
  129. void _EnsureMemberHasAVChannelsIfNeeded(INmMember* pSDKMember);
  130. void _EnsureMemberHasAVChannel(ULONG ulch, INmMember* pSDKMember);
  131. void _EnsureSentConferenceCreatedNotification();
  132. };
  133. #endif // __NmConference_h__