Leaked source code of windows server 2003
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.

218 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. phonemsp.h
  5. Abstract:
  6. Declaration of the CPhoneMSP class
  7. Author:
  8. mquinton 09-25-98
  9. Notes:
  10. Revision History:
  11. --*/
  12. #ifndef __PHONEMSP_H__
  13. #define __PHONEMSP_H__
  14. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  15. //
  16. // CPhoneMSP
  17. //
  18. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
  19. class CPhoneMSP :
  20. public CTAPIComObjectRoot<CPhoneMSP>,
  21. public CComDualImpl<ITMSPAddress, &IID_ITMSPAddress, &LIBID_TAPI3Lib>,
  22. public CComDualImpl<ITTerminalSupport, &IID_ITTerminalSupport, &LIBID_TAPI3Lib>,
  23. public ITPhoneMSPAddressPrivate,
  24. public CObjectSafeImpl
  25. {
  26. public:
  27. CPhoneMSP()
  28. {}
  29. void FinalRelease();
  30. DECLARE_MARSHALQI(CPhoneMSP)
  31. DECLARE_AGGREGATABLE(CPhoneMSP)
  32. DECLARE_QI()
  33. DECLARE_TRACELOG_CLASS(CPhoneMSP)
  34. BEGIN_COM_MAP(CPhoneMSP)
  35. COM_INTERFACE_ENTRY2(IDispatch, ITTerminalSupport)
  36. COM_INTERFACE_ENTRY(ITMSPAddress)
  37. COM_INTERFACE_ENTRY(ITTerminalSupport)
  38. COM_INTERFACE_ENTRY(ITPhoneMSPAddressPrivate)
  39. COM_INTERFACE_ENTRY(IObjectSafety)
  40. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  41. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  42. END_COM_MAP()
  43. HRESULT InitializeTerminals(
  44. HPHONEAPP hPhoneApp,
  45. DWORD dwAPIVersion,
  46. DWORD dwPhoneDevice,
  47. CAddress * pAddress
  48. );
  49. HRESULT VerifyTerminal( ITTerminal * pTerminal );
  50. protected:
  51. private:
  52. // TAPI terminals owned by this address
  53. TerminalArray m_TerminalArray;
  54. UnknownArray m_CallArray;
  55. HANDLE m_hEvent;
  56. #if DBG
  57. PWSTR m_pDebug;
  58. #endif
  59. void AddTerminal( ITTerminal * pTerminal );
  60. void AddCall( IUnknown * pCall );
  61. void RemoveCall( IUnknown * pCall );
  62. public:
  63. //
  64. // itmspaddress methods
  65. //
  66. STDMETHOD(Initialize)(
  67. MSP_HANDLE hEvent
  68. );
  69. STDMETHOD(Shutdown)();
  70. STDMETHOD(CreateMSPCall)(
  71. MSP_HANDLE hCall,
  72. DWORD dwReserved,
  73. DWORD dwMediaType,
  74. IUnknown * pOuterUnknown,
  75. IUnknown ** ppStreamControl
  76. );
  77. STDMETHOD(ShutdownMSPCall)(
  78. IUnknown * pStreamControl
  79. );
  80. STDMETHOD(ReceiveTSPData)(
  81. IUnknown * pMSPCall,
  82. BYTE * pBuffer,
  83. DWORD dwSize
  84. );
  85. STDMETHOD(GetEvent)(
  86. DWORD * pdwSize,
  87. byte * pEventBuffer
  88. );
  89. //
  90. //ITTerminalSupport methods
  91. //
  92. STDMETHOD(get_StaticTerminals)(VARIANT * pVariant);
  93. STDMETHOD(EnumerateStaticTerminals)(IEnumTerminal ** ppEnumTerminal);
  94. STDMETHOD(get_DynamicTerminalClasses)(VARIANT * pVariant);
  95. STDMETHOD(EnumerateDynamicTerminalClasses)(
  96. IEnumTerminalClass ** ppTerminalClassEnumerator);
  97. STDMETHOD(CreateTerminal)(
  98. BSTR TerminalClass,
  99. long lMediaType,
  100. TERMINAL_DIRECTION TerminalDirection,
  101. ITTerminal ** ppTerminal
  102. );
  103. STDMETHOD(GetDefaultStaticTerminal)(
  104. long lMediaType,
  105. TERMINAL_DIRECTION,
  106. ITTerminal ** ppTerminal
  107. );
  108. };
  109. typedef enum
  110. {
  111. PHONEMSP_CONNECTED,
  112. PHONEMSP_DISCONNECTED
  113. } PhoneMSPCallState;
  114. class CPhoneMSPCall :
  115. public CTAPIComObjectRoot<CPhoneMSPCall>,
  116. public CComDualImpl<ITStreamControl, &IID_ITStreamControl, &LIBID_TAPI3Lib>,
  117. public ITPhoneMSPCallPrivate,
  118. public CObjectSafeImpl
  119. {
  120. public:
  121. CPhoneMSPCall() : m_State(PHONEMSP_DISCONNECTED)
  122. {}
  123. void FinalRelease();
  124. DECLARE_MARSHALQI(CPhoneMSPCall)
  125. DECLARE_AGGREGATABLE(CPhoneMSPCall)
  126. DECLARE_QI()
  127. DECLARE_TRACELOG_CLASS(CPhoneMSPCall)
  128. BEGIN_COM_MAP(CPhoneMSPCall)
  129. COM_INTERFACE_ENTRY2(IDispatch, ITStreamControl)
  130. COM_INTERFACE_ENTRY(ITStreamControl)
  131. COM_INTERFACE_ENTRY(IObjectSafety)
  132. COM_INTERFACE_ENTRY(ITPhoneMSPCallPrivate)
  133. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  134. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  135. END_COM_MAP()
  136. protected:
  137. StreamArray m_StreamArray;
  138. TerminalPrivateArray m_TerminalArray;
  139. PhoneMSPCallState m_State;
  140. T3PHONE m_t3Phone;
  141. CPhoneMSP * m_pPhoneMSP;
  142. void AddStream( ITStream * pStream );
  143. void AddTerminal( ITTerminalPrivate * pTerminal );
  144. void RemoveTerminal( ITTerminalPrivate * pTerminal );
  145. public:
  146. void static HandlePrivateHookSwitch( PASYNCEVENTMSG pParams );
  147. STDMETHOD(CreateStream)(
  148. long lMediaType,
  149. TERMINAL_DIRECTION td,
  150. ITStream ** ppStream
  151. );
  152. STDMETHOD(RemoveStream)(ITStream * pStream);
  153. STDMETHOD(EnumerateStreams)(IEnumStream ** ppEnumStream);
  154. STDMETHOD(get_Streams)(VARIANT * pVariant);
  155. //
  156. // ITPhoneMSPCallPrivate
  157. //
  158. STDMETHOD(Initialize)( CPhoneMSP * pPhoneMSP );
  159. STDMETHOD(OnConnect)();
  160. STDMETHOD(OnDisconnect)();
  161. STDMETHOD(SelectTerminal)( ITTerminalPrivate * );
  162. STDMETHOD(UnselectTerminal)( ITTerminalPrivate * );
  163. STDMETHOD(GetGain)(long *pVal, DWORD dwHookSwitch);
  164. STDMETHOD(PutGain)(long newVal, DWORD dwHookSwitch);
  165. STDMETHOD(GetVolume)(long *pVal, DWORD dwHookSwitch);
  166. STDMETHOD(PutVolume)(long newVal, DWORD dwHookSwitch);
  167. };
  168. #endif