9 analyzer events callback interface, 1 _ianalyzerevents dispinterface, 1 _ianalyzerevents::ontracecreated – Teledyne LeCroy USB Analyzer Automation Manual User Manual
Page 117: Analyzer events callback interface, Ianalyzerevents dispinterface, Ianalyzerevents::ontracecreated, Ianalyzerevents, Inte

Teledyne LeCroy Automation API Reference Manual for USBTracer, USB Advisor, and Voyager USB Protocol 
Suite
117
9 Analyzer Events Callback Interface
9.1
_
IAnalyzerEvents dispinterface
In order to retrieve the events from the USB Protocol Suite application, you must implement the 
_IAnalyzerEvents interface. 
 
Since this interface is the default source interface for the
UsbAnalyzer
object, there is a very simple
implementation from such languages as Visual Basic, VBA, VBScript, WSH, etc. 
 
C++ implementation used in the examples below implements a sink object by deriving it from 
IDispEventImpl
but not specifying the type library as a template argument. Instead, the type library and
default source interface for the object are determined using
AtlGetObjectSourceInterface(). A
SINK_ENTRY()
macro is used for each event from each source interface which is to be handled:
 
class CAnalyzerSink : public IDispEventImpl
{ 
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 establish the connection with the server, you need to advise your implementation of the 
event interface: 
hr = CoCreateInstance( CLSID_UsbAdvisor, NULL,
 CLSCTX_SERVER, IID_IUsbAnalyzer, (LPVOID *)&m_poUsbAnalyzer ); 
 
 
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_poUsbAnalyzer, &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_poUsbAnalyzer is the source COM object
hr = m_poAnalyzerSink->DispEventAdvise(m_poUsbAnalyzer, &m_poAnalyzerSink->m_iid);
if ( FAILED(hr) )
return 1; 
 
 
 
 
 
 
 
 
 
 
 
9.1.1 _IAnalyzerEvents::OnTraceCreated
