WaitForCommand

等待命令完成。

語法

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

參數

Timeout:若未完成命令將被中止的時間段,或必須將 EtherCAT 狀態更改為請求狀態的時間段。其時間單位為秒。

AbortOnTimeout: TRUE: the command will be aborted after the time in Timeout has elapsed.FALSE:命令不會被中止。不管此命令結束與否程式皆繼續運作。

Status:欲等待的命令。可用返回類型為 KsCommandStatus 的命令或返回的 KsCommandStatus 結構來輸入。

回傳值

返回 KsCommandStatus 結構。

備註

可用的 EtherCAT 狀態

ecatOffline, ecatInit, ecatBoot, ecatPreOP, ecatSafeOP, ecatOP

範例

複製
// 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);

使用需求

  RT Win32
最低支援版本 4.0 4.0
標頭檔 ksapi.h ksapi.h
程式庫 KsApi_Rtss.lib KsApi.lib

參見

AbortCommand

GetCommandStatus