Teledyne-lecroy Automation API for Bluetooth Analyzers Instrukcja Użytkownika Strona 83

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 110
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 82
77
Automation API for CATC Bluetooth Analyzers
CATC Ver. 1.40
2.9 Analyzer events callback interface
In order to retrieve the events from BTAnalyzer application you must implement
_IAnalyzerEvents interface.
Since this interface is default source interface for BTAnalyzer object there is very
simple implementation from such languages like Visual Basic, VBA, VBScript,
WSH etc.
C++ implementation used in the examples below utilizes implements a sink object
by deriving from IDispEventImpl but not specifying the type library as a template argu-
ment. Instead the type library and default source interface for the object are deter-
mined using AtlGetObjectSourceInterface(). A SINK_ENTRY() macro is used for each event
from each source interface which is to be handled:
class CAnalyzerSink : public IDispEventImpl<IDC_SRCOBJ, CAnalyzerSink>
{
BEGIN_SINK_MAP(CAnalyzerSink)
//Make sure the Event Handlers have __stdcall calling convention
SINK_ENTRY(IDC_SRCOBJ, 1, OnTraceCreated)
SINK_ENTRY(IDC_SRCOBJ, 2, OnStatusReport)
END_SINK_MAP()
. . .
}
Then, after you established the connection with server you need to advise your implementation of
the event interface:
hr = CoCreateInstance( CLSID_BTAnalyzer, NULL,
CLSCTX_SERVER, IID_IBTAnalyzer, (LPVOID *)&m_poBTAnalyzer );
m_poAnalyzerSink = new CAnalyzerSink();
// Make sure the COM object corresponding to pUnk implements
IProvideClassInfo2 or
// IPersist*. Call this method to extract info about source type library if
you
// specified only 2 parameters to IDispEventImpl
hr = AtlGetObjectSourceInterface(m_poBTAnalyzer,&m_poAnalyzerSink->m_libid,
&m_poAnalyzerSink->m_iid, &m_poAnalyzerSink->m_wMajorVerNum,
&m_poAnalyzerSink->m_wMinorVerNum);
if ( FAILED(hr) )
return 1;
// connect the sink and source, m_poBTAnalyzer is the source COM object
hr = m_poAnalyzerSink->DispEventAdvise(m_poBTAnalyzer,
&m_poAnalyzerSink->m_iid);
if ( FAILED(hr) )
return 1;
Przeglądanie stron 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 109 110

Komentarze do niniejszej Instrukcji

Brak uwag