WaitForCommand

Waits a command to be finished.

Syntax

KsCommandStatus WaitForCommand(
     double Timeout,
     BOOL AbortOnTimeout,
     KsCommandStatus Status
);

Parameters

Timeout: the time period after which the command will be aborted if it is not finished, or the time period in which the EtherCAT state must be changed to the requested one. The unit of time is second.

AbortOnTimeout: TRUE: the command will be aborted after the time in Timeout has elapsed. FALSE: the command won't be aborted. The program keeps running no matter this command is finished or not.

Status: the command you want to wait. It can be filled with a command whose return type is KsCommandStatus, or a returned KsCommandStatus structure.

Return value

Returns the KsCommandStatus structure.

Remarks

Usable EtherCAT states

ecatOffline, ecatInit, ecatBoot, ecatPreOP, ecatSafeOP, ecatOP

Example

Copy
// Case 1: Directly pass the KsCommandStatus
KsCommandStatus resultStart = WaitForCommand(30, TRUE, Start());

// Case 2: Save the returned KsCommandStatus and then pass to WaitForCommand
KsCommandStatus commandStart = Start();
// Some operation in your application
commandStart = WaitForCommand(30, TRUE, commandStart);

Requirements

  RT Win32
Minimum supported version 4.0 4.0
Header ksapi.h ksapi.h
Library KsApi_Rtss.lib KsApi.lib

See also

AbortCommand

GetCommandStatus