beautypg.com

10 itrace::getpacketscount, Itrace::getpacketscount – Teledyne LeCroy USB Analyzer Automation Manual User Manual

Page 57

background image

Teledyne LeCroy Automation API Reference Manual for USBTracer, USB Advisor, and Voyager USB Protocol
Suite

57

3.1.10 ITrace::GetPacketsCount


HRESULT GetPacketsCount (

[out, retval] long* number_of_packets );

Retrieves total number of packets in the trace.

Parameters

number_of_packets

Points to long value where number of packets in the
trace is retrieved.

Return values

Remarks

Example


WSH:

Set Analyzer = WScript.CreateObject("CATC.USBTracer")
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Set Trace = Analyzer.MakeRecording (CurrentDir & "Input\test_ro.rec")
MsgBox Trace.GetPacketsCount & " packets recorded"


C++:

IUsbTrace* usb_trace;


. . .

long number_of_packets;
long trigg_packet_num;
try
{

bstr_trace_name = usb_trace->GetName();
number_of_packets = usb_trace->GetPacketsCount();
trigg_packet_num = usb_trace->GetTriggerPacketNum();

}

catch ( _com_error& er)
{

if (er.Description().length() > 0)
::MessageBox( NULL, er.Description(), _T("UsbAnalyzer client"), MB_OK );
else
::MessageBox( NULL, er.ErrorMessage(),_T("UsbAnalyzer client"), MB_OK );
return 1;

}

TCHAR str_trace_name[256];
_tcscpy( str_trace_name, (TCHAR*)( bstr_trace_name) );
SysFreeString( bstr_trace_name );

TCHAR trace_info[256];
_stprintf( trace_info, _T("Trace:'%s', total packets:%ld, trigger packet:%ld"),

str_trace_name, number_of_packets, trigg_packet_num );

::SetWindowText( m_hwndStatus, trace_info );