Teledyne LeCroy USB Analyzer Automation Manual User Manual

Page 64

background image

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

64

Example


WSH:


Set Analyzer = WScript.CreateObject("CATC.UsbTracer")
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))

' Please specify the real path to the trace file instead of 'C:\test.usb'.
Set Trace = Analyzer.OpenFile ( "C:\test.usb" )

' Instructs the USB Protocol Suite application to locate packet # 15
' (transaction level 0) in the trace viewer.
Trace.GotoUnit 0, 15

' Instructs the USB Protocol Suite trace viewer to jump to the trace unit
' with the timestamp close to 6000 ns (6 microsecond).
Trace.GotoTime 6000

' Exports USB transactions (from #0 to #10 ) into CSV format.
' 1st parameter - file name of the export file
' 2nd parameter - transaction level ( 0 - packets, 1 - transactions )
' 3rd parameter - unit number to start with
' 4th parameter - unit number to end by
Trace.ExportToCsv CurrentDir & "Output\text_csv_export.csv", 1, 0, 10

MsgBox "Done"

C++:

IUsbTrace2* usb_trace;


. . .


IAnalyzerErrors* analyser_errors;
try
{

analyser_errors = usb_trace-> ExportToCsv (_bstr_t( “c:\\test.csv” ),

1, 0 , 10 ) ;

}
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;

}

. . .

analyser_errors->Release();