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.

742 lines
20 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. phone.h
  5. Abstract:
  6. Declaration of the CPhone class
  7. Notes:
  8. Revision History:
  9. --*/
  10. #ifndef __PHONE_H_
  11. #define __PHONE_H_
  12. #include "resource.h" // main symbols
  13. #include "address.h"
  14. #include "ObjectSafeImpl.h"
  15. class CTAPI;
  16. extern CHashTable * gpPhoneHashTable;
  17. /////////////////////////////////////////////////////////////////
  18. // Intermediate classes used for DISPID encoding
  19. template <class T>
  20. class ITPhoneVtbl : public ITPhone
  21. {
  22. DECLARE_TRACELOG_CLASS(ITPhoneVtbl)
  23. };
  24. template <class T>
  25. class ITAutomatedPhoneControlVtbl : public ITAutomatedPhoneControl
  26. {
  27. DECLARE_TRACELOG_CLASS(ITAutomatedPhoneControlVtbl)
  28. };
  29. /////////////////////////////////////////////////////////////////
  30. // Constants defining default values for certain properties.
  31. const DWORD APC_DEFAULT_AEONT = 3000;
  32. const DWORD APC_DEFAULT_AKTMD = 100;
  33. const DWORD APC_DEFAULT_VCS = 4096;
  34. const DWORD APC_DEFAULT_VCRD = 500;
  35. const DWORD APC_DEFAULT_VCRP = 100;
  36. const DWORD APC_MAX_NUMBERS_GATHERED = 100;
  37. /////////////////////////////////////////////////////////////////
  38. // Types
  39. typedef enum AUTOMATED_PHONE_STATE
  40. {
  41. APS_ONHOOK_IDLE,
  42. APS_OFFHOOK_DIALTONE,
  43. APS_OFFHOOK_WARNING,
  44. APS_ONHOOK_RINGING_IN,
  45. APS_OFFHOOK_DIALING,
  46. APS_OFFHOOK_DEAD_LINE,
  47. APS_OFFHOOK_CALL_INIT,
  48. APS_OFFHOOK_CONNECTED,
  49. APS_ONHOOK_CONNECTED,
  50. APS_OFFHOOK_BUSY_TONE,
  51. APS_OFFHOOK_RINGING_OUT,
  52. APS_ONHOOK_RINGING_OUT
  53. } AUTOMATED_PHONE_STATE;
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CPhone
  56. class CPhone :
  57. public CTAPIComObjectRoot<CPhone>,
  58. public IDispatchImpl<ITPhoneVtbl<CPhone>, &IID_ITPhone, &LIBID_TAPI3Lib>,
  59. public IDispatchImpl<ITAutomatedPhoneControlVtbl<CPhone>,
  60. &IID_ITAutomatedPhoneControl, &LIBID_TAPI3Lib>,
  61. public CObjectSafeImpl
  62. {
  63. public:
  64. CPhone() : m_pTAPI(NULL),
  65. m_hPhoneApp(NULL),
  66. m_dwAPIVersion(0),
  67. m_dwDeviceID(0),
  68. m_hPhone(NULL),
  69. m_dwPrivilege(0),
  70. m_pPhoneCaps(NULL),
  71. m_pdwLineDeviceIDs(NULL),
  72. m_dwNumLineDeviceIDs(0),
  73. m_Tone(PT_SILENCE),
  74. m_fRinger(FALSE),
  75. m_fPhoneHandlingEnabled(FALSE),
  76. m_dwAutoEndOfNumberTimeout(APC_DEFAULT_AEONT),
  77. m_fAutoDialtone(TRUE),
  78. m_fAutoStopTonesOnOnHook(TRUE),
  79. m_fAutoStopRingOnOffHook(TRUE),
  80. m_fAutoKeypadTones(TRUE),
  81. m_dwAutoKeypadTonesMinimumDuration(APC_DEFAULT_AKTMD),
  82. m_pCall(NULL),
  83. m_hTimerQueue(NULL),
  84. m_hTimerEvent(NULL),
  85. m_hToneTimer(NULL),
  86. m_hDTMFTimer(NULL),
  87. m_hRingTimer(NULL),
  88. m_hVolumeTimer(NULL),
  89. m_hAutoEndOfNumberTimer(NULL),
  90. m_fUseWaveForRinger(FALSE),
  91. m_wszNumbersGathered(NULL),
  92. m_AutomatedPhoneState(APS_ONHOOK_IDLE),
  93. m_fAutoVolumeControl(TRUE),
  94. m_dwAutoVolumeControlStep(APC_DEFAULT_VCS),
  95. m_dwAutoVolumeControlRepeatDelay(APC_DEFAULT_VCRD),
  96. m_dwAutoVolumeControlRepeatPeriod(APC_DEFAULT_VCRP),
  97. m_dwOffHookCount(0),
  98. m_fInitialized(FALSE)
  99. {
  100. LOG((TL_TRACE, "CPhone[%p] - enter", this ));
  101. LOG((TL_TRACE, "CPhone - finished" ));
  102. }
  103. ~CPhone()
  104. {
  105. LOG((TL_TRACE, "~CPhone[%p] - enter", this ));
  106. LOG((TL_TRACE, "~CPhone - finished" ));
  107. }
  108. DECLARE_DEBUG_ADDREF_RELEASE(CPhone)
  109. DECLARE_QI()
  110. DECLARE_MARSHALQI(CPhone)
  111. DECLARE_TRACELOG_CLASS(CPhone)
  112. BEGIN_COM_MAP(CPhone)
  113. COM_INTERFACE_ENTRY2(IDispatch, ITPhone)
  114. COM_INTERFACE_ENTRY(ITPhone)
  115. // ITAutomatedPhoneControlQI will fall thru on SUCCESS, so we need to keep COM_INTERFACE_ENTRY(ITAutomatedPhoneControl)
  116. COM_INTERFACE_ENTRY_FUNC(IID_ITAutomatedPhoneControl, 0, CPhone::ITAutomatedPhoneControlQI)
  117. COM_INTERFACE_ENTRY(ITAutomatedPhoneControl)
  118. COM_INTERFACE_ENTRY(IObjectSafety)
  119. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  120. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  121. END_COM_MAP()
  122. void FinalRelease();
  123. private:
  124. ITTAPI * m_pTAPI;
  125. HPHONEAPP m_hPhoneApp;
  126. DWORD m_dwAPIVersion;
  127. DWORD m_dwDeviceID;
  128. HPHONE m_hPhone;
  129. DWORD m_dwPrivilege;
  130. LPPHONECAPS m_pPhoneCaps;
  131. DWORD * m_pdwLineDeviceIDs;
  132. DWORD m_dwNumLineDeviceIDs;
  133. BOOL m_fInitialized;
  134. // AutomatedPhoneControl Variables
  135. CWavePlayer m_WavePlayer;
  136. BOOL m_fUseWaveForRinger;
  137. BOOL m_fRinger;
  138. BOOL m_fPhoneHandlingEnabled;
  139. DWORD m_dwAutoEndOfNumberTimeout;
  140. BOOL m_fAutoDialtone;
  141. BOOL m_fAutoStopTonesOnOnHook;
  142. BOOL m_fAutoStopRingOnOffHook;
  143. BOOL m_fAutoKeypadTones;
  144. DWORD m_dwAutoKeypadTonesMinimumDuration;
  145. BOOL m_fAutoVolumeControl;
  146. DWORD m_dwAutoVolumeControlStep;
  147. DWORD m_dwAutoVolumeControlRepeatDelay;
  148. DWORD m_dwAutoVolumeControlRepeatPeriod;
  149. DWORD m_dwOffHookCount;
  150. ITCallInfo * m_pCall;
  151. LPWSTR m_wszNumbersGathered;
  152. PHONE_TONE m_Tone;
  153. DWORD m_dwToneDuration;
  154. DWORD m_dwTonePeriodOn;
  155. DWORD m_dwTonePeriodOff;
  156. PHONE_TONE m_DTMF;
  157. DWORD m_dwDTMFStart;
  158. DWORD m_dwRingDuration;
  159. DWORD m_dwRingPeriod;
  160. BOOL m_fVolumeUp;
  161. AUTOMATED_PHONE_STATE m_AutomatedPhoneState;
  162. BOOL m_fDefaultTerminalsSelected;
  163. // Timer Handles
  164. HANDLE m_hTimerQueue;
  165. HANDLE m_hTimerEvent;
  166. HANDLE m_hToneTimer;
  167. HANDLE m_hDTMFTimer;
  168. HANDLE m_hRingTimer;
  169. HANDLE m_hVolumeTimer;
  170. HANDLE m_hAutoEndOfNumberTimer;
  171. // Critical Sections
  172. CRITICAL_SECTION m_csAutomatedPhoneState;
  173. CRITICAL_SECTION m_csToneTimer;
  174. CRITICAL_SECTION m_csRingTimer;
  175. public:
  176. static HRESULT WINAPI ITAutomatedPhoneControlQI(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw);
  177. DWORD GetDeviceID(){ return m_dwDeviceID; }
  178. DWORD GetAPIVersion(){ return m_dwAPIVersion; }
  179. HPHONEAPP GetHPhoneApp(){ return m_hPhoneApp; }
  180. HRESULT Initialize(
  181. ITTAPI * pTAPI,
  182. HPHONEAPP hPhoneApp,
  183. DWORD dwAPIVersion,
  184. DWORD dwDeviceID
  185. );
  186. void SetPhoneCapBuffer( LPVOID pBuf );
  187. HRESULT UpdatePhoneCaps();
  188. HRESULT InvalidatePhoneCaps();
  189. BOOL IsPhoneOnAddress(ITAddress * pAddress);
  190. BOOL IsPhoneOnPreferredAddress(ITAddress *pAddress);
  191. BOOL IsPhoneUsingWaveID(DWORD dwWaveID, TERMINAL_DIRECTION nDir);
  192. CTAPI * GetTapi();
  193. void ForceClose();
  194. void Automation_CallState( ITCallInfo * pCall, CALL_STATE cs, CALL_STATE_EVENT_CAUSE cause );
  195. void Automation_ButtonDown( DWORD dwButtonId );
  196. void Automation_ButtonUp( DWORD dwButtonId );
  197. void Automation_OnHook( PHONE_HOOK_SWITCH_DEVICE phsd );
  198. void Automation_OffHook( PHONE_HOOK_SWITCH_DEVICE phsd );
  199. void Automation_EndOfNumberTimeout();
  200. //
  201. // IDispatch
  202. //
  203. STDMETHOD(GetIDsOfNames)(REFIID riid,
  204. LPOLESTR* rgszNames,
  205. UINT cNames,
  206. LCID lcid,
  207. DISPID* rgdispid
  208. );
  209. STDMETHOD(Invoke)(DISPID dispidMember,
  210. REFIID riid,
  211. LCID lcid,
  212. WORD wFlags,
  213. DISPPARAMS* pdispparams,
  214. VARIANT* pvarResult,
  215. EXCEPINFO* pexcepinfo,
  216. UINT* puArgErr
  217. );
  218. STDMETHOD_(ULONG, InternalAddRef)();
  219. STDMETHOD_(ULONG, InternalRelease)();
  220. //
  221. // ITPhone
  222. //
  223. STDMETHOD(Open)(
  224. IN PHONE_PRIVILEGE Privilege
  225. );
  226. STDMETHOD(Close)();
  227. STDMETHOD(get_Addresses)(
  228. OUT VARIANT * pAddresses
  229. );
  230. STDMETHOD(EnumerateAddresses)(
  231. OUT IEnumAddress ** ppEnumAddress
  232. );
  233. STDMETHOD(get_PreferredAddresses)(
  234. OUT VARIANT * pAddresses
  235. );
  236. STDMETHOD(EnumeratePreferredAddresses)(
  237. OUT IEnumAddress ** ppEnumAddress
  238. );
  239. STDMETHOD(get_PhoneCapsLong)(
  240. IN PHONECAPS_LONG pclCap,
  241. OUT long * plCapability
  242. );
  243. STDMETHOD(get_PhoneCapsString)(
  244. IN PHONECAPS_STRING pcsCap,
  245. OUT BSTR * ppCapability
  246. );
  247. STDMETHOD(GetPhoneCapsBuffer)(
  248. IN PHONECAPS_BUFFER pcbCaps,
  249. OUT DWORD *pdwSize,
  250. OUT BYTE **ppPhoneCapsBuffer
  251. );
  252. STDMETHOD(get_PhoneCapsBuffer)(
  253. IN PHONECAPS_BUFFER pcbCaps,
  254. OUT VARIANT *pVarBuffer
  255. );
  256. STDMETHOD(get_Terminals)(
  257. IN ITAddress * pAddress,
  258. OUT VARIANT * pTerminals
  259. );
  260. STDMETHOD(EnumerateTerminals)(
  261. IN ITAddress * pAddress,
  262. OUT IEnumTerminal ** ppEnumTerminal
  263. );
  264. STDMETHOD(get_ButtonMode)(
  265. IN long lButtonID,
  266. OUT PHONE_BUTTON_MODE * pButtonMode
  267. );
  268. STDMETHOD(put_ButtonMode)(
  269. IN long lButtonID,
  270. IN PHONE_BUTTON_MODE ButtonMode
  271. );
  272. STDMETHOD(get_LampMode)(
  273. IN long lLampID,
  274. OUT PHONE_LAMP_MODE* pLampMode
  275. );
  276. STDMETHOD(put_LampMode)(
  277. IN long lLampID,
  278. IN PHONE_LAMP_MODE pLampMode
  279. );
  280. STDMETHOD(get_ButtonFunction)(
  281. IN long lButtonID,
  282. OUT PHONE_BUTTON_FUNCTION * pButtonFunction
  283. );
  284. STDMETHOD(put_ButtonFunction)(
  285. IN long lButtonID,
  286. IN PHONE_BUTTON_FUNCTION ButtonFunction
  287. );
  288. STDMETHOD(get_ButtonText)(
  289. IN long lButtonID,
  290. OUT BSTR * ppButtonText
  291. );
  292. STDMETHOD(put_ButtonText)(
  293. IN long lButtonID,
  294. IN BSTR bstrButtonText
  295. );
  296. STDMETHOD(get_ButtonState)(
  297. IN long lButtonID,
  298. OUT PHONE_BUTTON_STATE * pButtonState
  299. );
  300. STDMETHOD(get_HookSwitchState)(
  301. IN PHONE_HOOK_SWITCH_DEVICE HookSwitchDevice,
  302. OUT PHONE_HOOK_SWITCH_STATE * pHookSwitchState
  303. );
  304. STDMETHOD(put_HookSwitchState)(
  305. IN PHONE_HOOK_SWITCH_DEVICE HookSwitchDevice,
  306. OUT PHONE_HOOK_SWITCH_STATE HookSwitchState
  307. );
  308. STDMETHOD(put_RingMode)(
  309. IN long lRingMode
  310. );
  311. STDMETHOD(get_RingMode)(
  312. OUT long * plRingMode
  313. );
  314. STDMETHOD(put_RingVolume)(
  315. IN long lRingVolume
  316. );
  317. STDMETHOD(get_RingVolume)(
  318. OUT long * plRingVolume
  319. );
  320. STDMETHOD(get_Privilege)(
  321. OUT PHONE_PRIVILEGE * pPrivilege
  322. );
  323. STDMETHOD(get_Display)(
  324. BSTR *pbstrDisplay
  325. );
  326. //
  327. // put display string at a specified location
  328. //
  329. STDMETHOD(SetDisplay)(
  330. IN long lRow,
  331. IN long lColumn,
  332. IN BSTR bstrDisplay
  333. );
  334. STDMETHOD(DeviceSpecific)(
  335. IN BYTE *pParams,
  336. IN DWORD dwSize
  337. );
  338. STDMETHOD(DeviceSpecificVariant)(
  339. IN VARIANT varDevSpecificByteArray
  340. );
  341. STDMETHOD(NegotiateExtVersion)(
  342. IN long lLowVersion,
  343. IN long lHighVersion,
  344. IN long *plExtVersion
  345. );
  346. //
  347. // ITAutomatedPhoneControl
  348. //
  349. public:
  350. STDMETHOD (StartTone)(
  351. IN PHONE_TONE Tone,
  352. IN long lDuration
  353. );
  354. STDMETHOD (StopTone)();
  355. STDMETHOD (get_Tone)(
  356. OUT PHONE_TONE * pTone
  357. );
  358. STDMETHOD (StartRinger)(
  359. IN long lRingMode,
  360. IN long lDuration
  361. );
  362. STDMETHOD (StopRinger)();
  363. STDMETHOD (get_Ringer)(
  364. OUT VARIANT_BOOL * pfRinging
  365. );
  366. STDMETHOD (put_PhoneHandlingEnabled)(
  367. IN VARIANT_BOOL fEnabled
  368. );
  369. STDMETHOD (get_PhoneHandlingEnabled)(
  370. OUT VARIANT_BOOL * pfEnabled
  371. );
  372. STDMETHOD (put_AutoEndOfNumberTimeout)(
  373. IN long lTimeout
  374. );
  375. STDMETHOD (get_AutoEndOfNumberTimeout)(
  376. OUT long * plTimeout
  377. );
  378. STDMETHOD (put_AutoDialtone)(
  379. IN VARIANT_BOOL fEnabled
  380. );
  381. STDMETHOD (get_AutoDialtone)(
  382. OUT VARIANT_BOOL * pfEnabled
  383. );
  384. STDMETHOD (put_AutoStopTonesOnOnHook)(
  385. IN VARIANT_BOOL fEnabled
  386. );
  387. STDMETHOD (get_AutoStopTonesOnOnHook)(
  388. OUT VARIANT_BOOL * pfEnabled
  389. );
  390. STDMETHOD (put_AutoStopRingOnOffHook)(
  391. IN VARIANT_BOOL fEnabled
  392. );
  393. STDMETHOD (get_AutoStopRingOnOffHook)(
  394. OUT VARIANT_BOOL * pfEnabled
  395. );
  396. STDMETHOD (put_AutoKeypadTones)(
  397. IN VARIANT_BOOL fEnabled
  398. );
  399. STDMETHOD (get_AutoKeypadTones)(
  400. OUT VARIANT_BOOL * pfEnabled
  401. );
  402. STDMETHOD (put_AutoKeypadTonesMinimumDuration)(
  403. IN long lDuration
  404. );
  405. STDMETHOD (get_AutoKeypadTonesMinimumDuration)(
  406. OUT long * plDuration
  407. );
  408. STDMETHOD (put_AutoVolumeControl)(
  409. IN VARIANT_BOOL fEnabled
  410. );
  411. STDMETHOD (get_AutoVolumeControl)(
  412. OUT VARIANT_BOOL * pfEnabled
  413. );
  414. STDMETHOD (put_AutoVolumeControlStep)(
  415. IN long lStepSize
  416. );
  417. STDMETHOD (get_AutoVolumeControlStep)(
  418. OUT long * plStepSize
  419. );
  420. STDMETHOD (put_AutoVolumeControlRepeatDelay)(
  421. IN long lDelay
  422. );
  423. STDMETHOD (get_AutoVolumeControlRepeatDelay)(
  424. OUT long * plDelay
  425. );
  426. STDMETHOD (put_AutoVolumeControlRepeatPeriod)(
  427. IN long lPeriod
  428. );
  429. STDMETHOD (get_AutoVolumeControlRepeatPeriod)(
  430. OUT long * plPeriod
  431. );
  432. STDMETHOD (SelectCall)(
  433. IN ITCallInfo * pCall,
  434. IN VARIANT_BOOL fSelectDefaultTerminals
  435. );
  436. STDMETHOD (UnselectCall)(
  437. IN ITCallInfo * pCall
  438. );
  439. STDMETHOD (EnumerateSelectedCalls)(
  440. OUT IEnumCall ** ppCallEnum
  441. );
  442. STDMETHOD (get_SelectedCalls)(
  443. OUT VARIANT * pVariant
  444. );
  445. // Private helper methods for ITAutomatedPhoneControl implementation
  446. private:
  447. void UnselectAllPreviouslySelectedTerminals(
  448. IN ITBasicCallControl2 * pCall,
  449. IN ITTerminal * pTerminalThatFailed,
  450. IN IEnumTerminal * pEnum
  451. );
  452. HRESULT InternalUnselectCall(
  453. IN ITCallInfo * pCall
  454. );
  455. HRESULT SelectDefaultTerminalsOnCall(
  456. IN ITCallInfo * pCall
  457. );
  458. HRESULT UnselectDefaultTerminalsOnCall(
  459. IN ITCallInfo * pCall
  460. );
  461. HRESULT GetPhoneWaveRenderID(
  462. IN DWORD * pdwWaveID
  463. );
  464. void OpenWaveDevice(
  465. );
  466. void CloseWaveDevice(
  467. );
  468. static VOID CALLBACK ToneTimerCallback(
  469. PVOID lpParameter,
  470. BOOLEAN TimerOrWaitFired
  471. );
  472. static VOID CALLBACK DTMFTimerCallback(
  473. PVOID lpParameter,
  474. BOOLEAN TimerOrWaitFired
  475. );
  476. static VOID CALLBACK RingTimerCallback(
  477. PVOID lpParameter,
  478. BOOLEAN TimerOrWaitFired
  479. );
  480. static VOID CALLBACK VolumeTimerCallback(
  481. PVOID lpParameter,
  482. BOOLEAN TimerOrWaitFired
  483. );
  484. static VOID CALLBACK AutoEndOfNumberTimerCallback(
  485. PVOID lpParameter,
  486. BOOLEAN TimerOrWaitFired
  487. );
  488. };
  489. class CPhoneEvent :
  490. public CTAPIComObjectRoot<CPhoneEvent, CComMultiThreadModelNoCS>, // no need to have a cs
  491. public CComDualImpl<ITPhoneEvent, &IID_ITPhoneEvent, &LIBID_TAPI3Lib>,
  492. public CObjectSafeImpl
  493. {
  494. public:
  495. DECLARE_MARSHALQI(CPhoneEvent)
  496. DECLARE_TRACELOG_CLASS(CPhoneEvent)
  497. BEGIN_COM_MAP(CPhoneEvent)
  498. COM_INTERFACE_ENTRY(IDispatch)
  499. COM_INTERFACE_ENTRY(ITPhoneEvent)
  500. COM_INTERFACE_ENTRY(IObjectSafety)
  501. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  502. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  503. END_COM_MAP()
  504. static HRESULT FireEvent(
  505. CPhone * pCPhone,
  506. PHONE_EVENT Event,
  507. PHONE_BUTTON_STATE ButtonState,
  508. PHONE_HOOK_SWITCH_STATE HookSwitchState,
  509. PHONE_HOOK_SWITCH_DEVICE HookSwitchDevice,
  510. DWORD dwRingMode,
  511. DWORD dwButtonLampId,
  512. PWSTR pNumber,
  513. ITCallInfo * pCallInfo
  514. );
  515. void FinalRelease();
  516. protected:
  517. ITPhone * m_pPhone;
  518. PHONE_EVENT m_Event;
  519. PHONE_BUTTON_STATE m_ButtonState;
  520. PHONE_HOOK_SWITCH_STATE m_HookSwitchState;
  521. PHONE_HOOK_SWITCH_DEVICE m_HookSwitchDevice;
  522. DWORD m_dwRingMode;
  523. DWORD m_dwButtonLampId;
  524. BSTR m_pNumber;
  525. ITCallInfo * m_pCallInfo;
  526. #if DBG
  527. PWSTR m_pDebug;
  528. #endif
  529. public:
  530. STDMETHOD(get_Phone)( ITPhone ** ppPhone );
  531. STDMETHOD(get_Event)( PHONE_EVENT * pEvent );
  532. STDMETHOD(get_ButtonState)( PHONE_BUTTON_STATE * pState );
  533. STDMETHOD(get_HookSwitchState)( PHONE_HOOK_SWITCH_STATE * pState );
  534. STDMETHOD(get_HookSwitchDevice)( PHONE_HOOK_SWITCH_DEVICE * pDevice );
  535. STDMETHOD(get_RingMode)( long * plRingMode );
  536. STDMETHOD(get_ButtonLampId)( LONG * plButtonLampId );
  537. STDMETHOD(get_NumberGathered)( BSTR * ppNumber );
  538. STDMETHOD(get_Call)( ITCallInfo ** ppCallInfo );
  539. };
  540. class CPhoneDevSpecificEvent :
  541. public CTAPIComObjectRoot<CPhoneDevSpecificEvent, CComMultiThreadModelNoCS>, // no need to have a cs
  542. public CComDualImpl<ITPhoneDeviceSpecificEvent, &IID_ITPhoneDeviceSpecificEvent, &LIBID_TAPI3Lib>,
  543. public CObjectSafeImpl
  544. {
  545. public:
  546. DECLARE_MARSHALQI(CPhoneDevSpecificEvent)
  547. DECLARE_TRACELOG_CLASS(CPhoneDevSpecificEvent)
  548. BEGIN_COM_MAP(CPhoneDevSpecificEvent)
  549. COM_INTERFACE_ENTRY(IDispatch)
  550. COM_INTERFACE_ENTRY(ITPhoneDeviceSpecificEvent)
  551. COM_INTERFACE_ENTRY(IObjectSafety)
  552. COM_INTERFACE_ENTRY_FUNC(IID_IMarshal, 0, IMarshalQI)
  553. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pFTM)
  554. END_COM_MAP()
  555. static HRESULT FireEvent(
  556. CPhone *pPhone,
  557. long lParam1,
  558. long lParam2,
  559. long lParam3
  560. );
  561. void FinalRelease();
  562. CPhoneDevSpecificEvent();
  563. protected:
  564. //
  565. // phone for which the event was fired
  566. //
  567. ITPhone *m_pPhone;
  568. //
  569. // data received from the TSP
  570. //
  571. long m_l1;
  572. long m_l2;
  573. long m_l3;
  574. #if DBG
  575. PWSTR m_pDebug;
  576. #endif
  577. public:
  578. STDMETHOD(get_Phone)( ITPhone **ppPhone );
  579. STDMETHOD(get_lParam1)( long *plParam1 );
  580. STDMETHOD(get_lParam2)( long *plParam2 );
  581. STDMETHOD(get_lParam3)( long *plParam3 );
  582. };
  583. #endif //__PHONE_H_