From 45edf54f6aaf54adb7b42f786b60cd3f23d9be2f Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 1 Jun 2006 12:28:44 +0000 Subject: Initial work on pjsua ActiveX component git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@487 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h | 151 +++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h (limited to 'pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h') diff --git a/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h b/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h new file mode 100644 index 00000000..db150156 --- /dev/null +++ b/pjsip-apps/src/activex-pjsua/activex-pjsuaCP.h @@ -0,0 +1,151 @@ +#ifndef _ACTIVEXPJSUACP_H_ +#define _ACTIVEXPJSUACP_H_ + +//#import "C:\project\pjproject\pjsip-apps\src\activex-pjsua\activex-pjsua.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids //"Import typelib" +template +class CProxy_IPjsuaEvents : public IConnectionPointImpl +{ + //Warning this class may be recreated by the wizard. +public: + VOID Fire_OnCallState(INT call_index, Pjsua_Call_Info * pInfo) + { + T* pT = static_cast(this); + int nConnectionIndex; + CComVariant* pvars = new CComVariant[2]; + int nConnections = m_vec.GetSize(); + HRESULT hr; + + IRecordInfo *pRI = NULL; + hr = GetRecordInfoFromGuids( LIBID_ACTIVEPJSUALib, + 1, 0, + 0, + IID_Pjsua_Call_Info, + &pRI ); + assert(SUCCEEDED(hr)); + + pvars[1] = call_index; + + VARIANT v; + memset(&v, 0, sizeof(v)); + v.vt = VT_RECORD; + v.pRecInfo = pRI; + v.pvRecord = pInfo; + + pvars[0] = v; + + for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) + { + pT->Lock(); + CComPtr sp = m_vec.GetAt(nConnectionIndex); + pT->Unlock(); + IDispatch* pDispatch = reinterpret_cast(sp.p); + if (pDispatch != NULL) + { + + DISPPARAMS disp = { pvars, NULL, 2, 0 }; + hr = pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + } + delete[] pvars; + + } + VOID Fire_OnRegState(INT acc_index) + { + T* pT = static_cast(this); + int nConnectionIndex; + CComVariant* pvars = new CComVariant[1]; + int nConnections = m_vec.GetSize(); + + for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) + { + pT->Lock(); + CComPtr sp = m_vec.GetAt(nConnectionIndex); + pT->Unlock(); + IDispatch* pDispatch = reinterpret_cast(sp.p); + if (pDispatch != NULL) + { + pvars[0] = acc_index; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + } + delete[] pvars; + + } + VOID Fire_OnBuddyState(INT buddy_index) + { + T* pT = static_cast(this); + int nConnectionIndex; + CComVariant* pvars = new CComVariant[1]; + int nConnections = m_vec.GetSize(); + + for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) + { + pT->Lock(); + CComPtr sp = m_vec.GetAt(nConnectionIndex); + pT->Unlock(); + IDispatch* pDispatch = reinterpret_cast(sp.p); + if (pDispatch != NULL) + { + pvars[0] = buddy_index; + DISPPARAMS disp = { pvars, NULL, 1, 0 }; + pDispatch->Invoke(0x3, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + } + delete[] pvars; + + } + VOID Fire_OnIncomingPager(INT call_index, BSTR fromUri, BSTR toURI, BSTR pagerText) + { + T* pT = static_cast(this); + int nConnectionIndex; + CComVariant* pvars = new CComVariant[4]; + int nConnections = m_vec.GetSize(); + + for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) + { + pT->Lock(); + CComPtr sp = m_vec.GetAt(nConnectionIndex); + pT->Unlock(); + IDispatch* pDispatch = reinterpret_cast(sp.p); + if (pDispatch != NULL) + { + pvars[3] = call_index; + pvars[2] = fromUri; + pvars[1] = toURI; + pvars[0] = pagerText; + DISPPARAMS disp = { pvars, NULL, 4, 0 }; + pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + } + delete[] pvars; + + } + VOID Fire_OnTypingIndication(INT call_index, BSTR fromUri, BSTR toURI, INT isTyping) + { + T* pT = static_cast(this); + int nConnectionIndex; + CComVariant* pvars = new CComVariant[4]; + int nConnections = m_vec.GetSize(); + + for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) + { + pT->Lock(); + CComPtr sp = m_vec.GetAt(nConnectionIndex); + pT->Unlock(); + IDispatch* pDispatch = reinterpret_cast(sp.p); + if (pDispatch != NULL) + { + pvars[3] = call_index; + pvars[2] = fromUri; + pvars[1] = toURI; + pvars[0] = isTyping; + DISPPARAMS disp = { pvars, NULL, 4, 0 }; + pDispatch->Invoke(0x5, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL); + } + } + delete[] pvars; + + } +}; +#endif \ No newline at end of file -- cgit v1.2.3