beautypg.com

3 itrace::save, Itrace::save – Teledyne LeCroy USB Analyzer Automation Manual User Manual

Page 45

background image

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

45

3.1.3 ITrace::Save


HRESULT Save (

[in] BSTR file_name,
[in, defaultvalue(-1)] long packet_from,
[in, defaultvalue(-1)] long packet_to );

Saves the trace into a file and allows you to save a range of packets.

Parameters

file_name

String providing the full pathname to file where trace is saved

packet_from

Beginning packet number when you are saving a range of packets.
Value

–1 means that the first packet of saved trace would be the first packet of

this trace.


packet_to

Ending packet number when you are saving a range of packets.
Value

–1 means that the last packet of saved trace would be the last packet of

this trace.

Return values

ANALYZERCOMERROR_UNABLESAVE

Unable to save trace file.

Remarks


Use this method if you want to save a recorded or opened trace into a file. If display options

apply to this trace (see

ITrace::ApplyDisplayOptions

or

IAnalyzer::LoadDisplayOptions

), then hidden

packets are not saved.

If packet range is specified and it is invalid (for example packet_to is more then last packet

number in the trace, or packet_from is less than first packet number in the trace, or packet_from is
more then packet_to), then packet range adjusts automatically.

Example


WSH:

Set Analyzer = WScript.CreateObject("CATC.USBTracer")
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Set Trace = Analyzer.MakeRecording (CurrentDir & "Input\test_ro.rec")
Trace.ApplyDisplayOptions CurrentDir & "Input\test_do.opt"
Trace.Save CurrentDir & "Output\saved_file.usb"

C++:

IUsbTrace* usb_trace;
TCHAR file_name[_MAX_PATH];
LONG packet_from;
LONG packet_to;

. . .
try

{

usb_trace->Save( file_name, packet_from, packet_to );

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

}