3385 Scott Blvd.
Santa Clara, CA 95054
Tel: +1/408.727.6600
Fax: +1/408.727.6622
Automation API
for
LeCroy SAS/SATA Tracer/Trainer
Reference Manual
Manual Version 1.11
For SAS/SATA Tracer/Trainer Software Version 2.60/4.60
May 2010
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
Document Disclaimer
The information contained in this document has been carefully checked and is believed to
be reliable. However, no responsibility can be assumed for inaccuracies that may not have been
detected.
LeCroy reserves the right to revise the information presented in this document without
notice or penalty.
Trademarks and Servicemarks
LeCroy, CATC, SASTracer, SATracer, SASTrainer, SATrainer Automation are trademarks
of LeCroy Corporation.
Microsoft and Windows are registered trademarks of Microsoft Inc.
All other trademarks are property of their respective companies.
This document may be printed and reproduced without additional permission, but all copies
should contain this copyright notice.
Version
This is version 1.11 of the SASTracer/SATracer Automation API Reference Manual. This
manual applies to SASTracer/SATracer software version 2.60/4.60 and higher.
ii
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
LeCroy’s SASTracer/SATracer software provides a rich, functional COM/Automation API to
the most important functionalities of the LeCroy SASTracer/SATracer Protocol Analyzer and
LeCroy SASTrainer/SATrainer Exerciser. This makes it a great tool for implementation of
automated programs for complicated testing, development and debugging. The "dual" nature of
the interfaces provided makes it easy to use the SASTracer/SATracer COM API in different
Integrated Development Environments (IDE) supporting the COM architecture.
Special support for typeless script languages (such as VB and JavaScript), while overri ding
some restrictions imposed by script engines (remote access, dynamic object creation, and
handling events), allows you to write client applications quickly and easily. You do not need
significant programming skills. or installation of expensive and powerful programming language
systems. All these features, along with the ability to set up all necessary DCOM permissions
during the installation process, make the LeCroy SASTracer/SATracer an attractive tool for
automating and speeding many engineering processes.
1.1 System Requirements
The Automation API was introduced with the following release: SASTracer/SATracer
software 2.60/4.60.
This document covers the functionality available in SASTracer/SATracer 2.60/4.60.
1.2 Support Resources
As new functionalities are added to the API, not all of them are supported by older versions
of the analyzer's software. For newer releases of analyzer software, please refer to the LeCroy
web site: www.lecroy.com
1.3 Setting Up Automation for Local Use
To run Automation on the SASTracer/SATracer's Host Controller (the PC attached to the
SASTracer/SATracer), you do not need to perform any special configuration. You can simply
execute the scripts or programs that you have created and they will run the analyzer. In order to
use the SASTracer/SATracer COM API, during the installation process the application should be
registered as a COM server in a system registry.
1.4 Setting Up Automation for Remote Use
To access SASTracer/SATracer remotely over a network, install the SASTracer/SATracer
application on both server and client systems and accept the Enabling Remote Access option
during installation. You can also perform a manual DCOM configuration.
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
2 SASTracer/SATracer Object Model
LeCroy’s SASTracer/SATracer API programmatically exposes its functionality through
objects. You work with an object by using its properties and methods. Objects are named
according to the portion of an application they represent, and they are ordered in a hierarchy.
A single object occupies the topmost tier of LeCroy SASTracer/SATracer object hierarchy:
SASAnalyzer.
The following object model diagram shows how the objects in an object model fit together:
Only the SASAnalyzer object is creatable at the top level (for instance, via the
CoCreateInstance call from a C/C++ client). Instantiation of an object of other classes requires
API calls.
The Class ID and App ID for the SASAnalyzer object are the following.
Class ID: SASAnalyzer 12A4B62B-107A-42AE-9C56-08C5EC3C26E2
AppID: SASAnalyzer Lecroy.SASAnalyzer
All interfaces are dual interfaces that allow simple use from typeless languages (like
VBScript), as well as from C/C++.
All objects implement the ISupportErrorInfo interface for easy error handling from the client.
6
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
Objects Interfaces Description
SASAnalyzer ISASAnalyzer
_ISASAnalyzerEvents
SASTrace ITrace
ISASTrace*
ISASVerificationScript*
SASRecOptions IRecOptions
ISASRecOptions
SASPacket IPacket
ISASPacket*
SASTraceErrors ISASAnalyzerErrors*
* Primary interfaces
The examples of C++ code given in this document assume using the “import” technique of
creating COM clients. That means the corresponding include is used:
Appropriate wrapper classes are created in .tli and .tlh files by the compiler.
Examples of WSH, VBScript, and C++ client applications are provided.
Represents the SASTracer application.
Represents recorded trace.
Represents recording options.
Represents single packet of the recorded
trace.
Represents the collection of errors that
occurred in the recorded trace.
7
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
3 SASAnalyzer Object
The SASAnalyzer object is the top-level object of the SASTracer API. The SASAnalyzer
object allows you to control recording and traffic generation, open trace files, and access
recording and generation options. The SASAnalyzer object supports the following interfaces:
Interfaces Description
ISASAnalyzer
_ISASAnalyzerEvents
The ISASAnalyzer interface is the primary interface for the SASAnalyzer object.
The Class ID and App ID for the SASAnalyzer object are the following:
Class ID SASAnalyzer 12A4B62B-107A-42AE-9C56-08C5EC3C26E2
App ID SASAnalyzer Lecroy.SASAnalyzer
Example
WSH:
Set Analyzer = WScript.CreateObject( “Lecroy.SASAnalyzer” )
C++:
ISASAnalyzer* poSASAnalyzer;
// create SASAnalyzer object
if ( FAILED( CoCreateInstance(
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
3.1.5 ISASAnalyzer::StartRecording
HRESULT StartRecording (
Starts recording with specified recording options.
Parameters
ro_file_name String providing the full pathname to the recording options file;
Return values
ANALYZERCOMERROR_UNABLESTARTRECORDING -
Remarks
After recording starts, this function will return. The Analyzer continues recording until it is
finished or until the StopRecording method call is performed. During recording, events are sent to
the event sink (see _ISASAnalyzerEvents
The recording options file is the file with extension .rec created by the SASTracer
application. You can create this file when you select “Setup –> Recording Options…” from the
SASTracer application menu, change the recording options in the “Recording Options” dialog,
and select the “Save…” button.
Example
VBScript:
<OBJECT
>
</OBJECT>
<INPUT TYPE=TEXT VALUE="" NAME="TextRecOptions">
<SCRIPT LANGUAGE="VBScript">
<!--
Sub BtnStartRecording_OnClick
On Error Resume Next
Analyzer.StartRecording TextRecOptions.value
If Err.Number <> 0 Then
MsgBox Err.Number & ":" & Err.Description
End If
-->
</SCRIPT>
[in] BSTR ro_file_name );
If the parameter is omitted, then recording starts with default recording
options.
unable to start recording
interface).
RUNAT=Server
ID = Analyzer
CLASSID = " clsid: 297CD804-08F5-4A4F-B3BA-779B2654B27C "
End Sub
16
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
3.1.7 ISASAnalyzer::MakeRecording
HRESULT MakeRecording (
Makes recording with the specified recording options file.
Parameters
ro_file_name String providing the full pathname to a recording options file;
trace Address of a pointer to the SASTrace object interface
Return values
ANALYZERCOMERROR_UNABLESTARTRECORDING -
Remarks
This method acts like the StartRecording method but will not return until recording is
completed. The SASTrace object is created via this method call, if the call was
successful.
The recording options file is the file with extension .rec created by the SASTracer
application. You can create this file when you select “Setup –> Recording Options…”
from the SASTracer application menu, change the recording options in the
“Recording Options” dialog, and select the “Save…” button.
Example
WSH:
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Set Analyzer = WScript.CreateObject("Lecroy.SASAnalyzer")
Set Trace = Analyzer.MakeRecording (CurrentDir & "Input\test_ro.rec")
Attaches the SASAnalyzer object to the board and lets it work with connected boards.
Parameters
yDefaultPort An enumeration indicates a TCP or USB connection.
bstrDeviceId A BSTR object specifies the Board ID as a string.
bstrSystemPath Specifies the path of the system folder in which the software has been
installed.
pnErrorCode A pointer to an integer which contains an error code about the situation
Return values
Remarks
This function is used to connect to a board. This function will not connect to the specified board if
any other objects have been already connected to the same board.
[out, retval] int* pnErrorCode)
in which one or more error(s) has occurred.
23
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
3.1.12 ISASAnalyzer::Detach
HRESULT Detach (
[out, retval] int* pnErrorCode)
Detaches the object from the board.
Parameters
pnErrorCode A pointer to an integer which contains an error code about the
situation in which one or more error(s) has occurred.
Return values
Remarks
This method detaches the object from the board.
24
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
4 SASTrace Object
The SASTrace object represents the recorded trace file.
The SASTrace object allows users to:
o Get trace information.
o Access trace packets.
o Access trace errors.
o Save/export the trace or a portion of the trace.
The SASTrace object can be created by:
o Using the ISASAnalyzer::OpenFile
o Using the ISASAnalyzer::MakeRecording
o Handling the _ISASAnalyzerEvents::OnTraceCreated
The SASTrace object supports the following interfaces:
Interfaces Description
Itrace
ISASTrace
ISASVerificationScript
The ISASTrace interface is a primary interface for the SASTrace object.
Implements trace packets and trace errors access,
different report types, export, and saving.
Extends ITrace interface:
Adds functionality for accessing the SASTracePacket
object.
Exposes functionality for running verification scripts.
method
method
event
25
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
4.1 ITrace Interface
The ITrace interface is a dual interface for the SASTrace object.
It implements the following methods:
GetName
ApplyDisplayOptions
Save
ExportToText
Close
ReportFileInfo
ReportErrorSummary
GetPacket
GetPacketsCount
GetTriggerPacketNum
AnalyzerErrors
Note: All methods of the ITrace interface are also available in ISASTrace
interface.
26
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
4.1.1 ITrace::GetName
HRESULT GetName (
Retrieves the trace name.
Parameters
trace_name Name of the trace
Return values
Remarks
This name can be used for presentation purposes.
Do not forget to free the string returned by this method call.
Example
WSH:
Set Analyzer = WScript.CreateObject("Lecroy.SASAnalyzer ")
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
4.1.2 ITrace::ApplyDisplayOptions
HRESULT ApplyDisplayOptions (
Applies the specified display options to the trace.
Parameters
do_file_name String providing the full pathname to the display options file
Return values
ANALYZERCOMERROR_UNABLELOADDO -
Remarks
Use this method if you want to filter traffic of some type in the recorded or opened trace.
The display options file is the file with extension .opt created by the SASTrainer
LeCroy Corporation Automation API for SAS/SATATracer/Trainer Manual Version 1.11
4.1.3 ITrace::Save
HRESULT Save (
Saves trace into a file while allowing you to specify a range of packets.
Parameters
file_name
packet_from Beginning packet number when you are saving a range of packets,
packet_to Ending packet number when you are saving a range of packets,
Return values
ANALYZERCOMERROR_UNABLESAVE – unable to save the trace file
ANALYZERCOMERROR_INVALIDPACKETNUMBER - bad packet range
Remarks
Use this method if you want to save a recorded or opened trace into a file. If the display
options apply to this trace (see ITrace::ApplyDisplayOptions
ISASAnalyzer::LoadDisplayOptions
If the packet range specified is invalid (for example, packet_to is more than the last packet
number in the trace, or packet_from is less than the first packet number in the trace, or
packet_from is more than packet_to) then the packet range will be adjusted automatically.
Example
WSH:
Set Analyzer = WScript.CreateObject("LeCroy.SASAnalyzer")