beautypg.com

Teledyne LeCroy Sierra SAS_SATA Protocol Analyzer STX API Reference Manual User Manual

Page 164

background image


Sierra SAS/SATA Protocol Suite, STX Software API Reference Manual

Using Infusion API 164

Call ConnectFromAPI function to connect to a specified board

NOTE: The ConnectFromAPI() method is only for running Jammer scenarios.

To call the ConnectFromAPI function, you must get your device, by its name or its MacId. Then

it will be ready to connect.

// Get Device List Manager to call Connect from specified board.

CIBApiDeviceCollection * DevListManager;

DevListManager = pDeviceManager->GetDeviceCollection();

int

DeviceCount = DevListManager->GetDeviceCount();

for

(

int

i=0; i < DeviceCount; i++)

{

CIBApiDevice* pDevice = DevListManager->GetNextDevice();

INFDeviceID DevId = pDevice->GetDeviceInfo()->GetID();

CString sDevMacId = DevId.GetText();

// If the MacId of the device in the list is equal to the device

// to which you want to connect, then call ConnectFromAPI.

if

(sDevMacId == sMacId)

{

pConnectedDevice = pDevice;

HRESULT hr = pConnectedDevice->ConnectFromAPI(sDevMacId);

}

}

NOTE: The ConnectFromAPI function has three parameters, as shown below. The second and

third parameters have default values.

The second parameter specifies connection type (CEI_CONNECTION_USB or
CEI_CONNECTION_TCP

)

The third parameter specifies project type (PROJECT_TYPE_SAS or
PROJECT_TYPE_SATA

).

ConnectFromAPI(CString strDeviceId,

BYTE yPort = CEI_CONNECTION_TCP ,

int

nProductType = PROJECT_TYPE_SAS)

You can change defaults by passing the connection type and project type as second and third

parameters.
NOTE: Define these values in your API before you use them in a function.

#define

CEI_CONNECTION_USB

0x02

#define

CEI_CONNECTION_TCP

0x04

#define

PROJECT_TYPE_SAS

0

#define

PROJECT_TYPE_SATA

1