RtecatRequestState

RtecatRequestState requests a MainDevice to switch to a specified EtherCAT state.

Syntax

Copy
RTECAT_COMMAND_STATUS RtecatRequestState(
  [in]    RTECAT_HANDLE MainDevice,
  [in]    RTECAT_ETHERCAT_STATE State
);

Parameters

[in] MainDevice

A handle to a MainDevice. To retrieve the corresponding handle, use RtecatOpenMainDevice.

[in] State

A requested EtherCAT state. See RTECAT_ETHERCAT_STATE.

Return Values

The function returns an RTECAT_COMMAND_STATUS structure. If an error occurs, field State of the structure is set to ecatCommandError and the error code is stored in field ErrorId (see RTECAT_ERROR for error values). If the function succeeds, ErrorId is set to ecatErrNoError (which is represented by the value 0). If the function fails, it stores a different error value.

Possible return values:

Return value Meaning

ecatErrNoError

The function succeeded.

ecatErrWrongParameter

Parameter MainDevice or State is invalid.

ecatErrMainDeviceNotReady

The MainDevice instance does not exist.

ecatErrWrongEnvironment

One of the following conditions occurred:

  • The MainDevice has not started.
  • State requests are not allowed when RtecatStop is in progress.
  • Parameter State is ecatStateOffline when the MainDevice is stopped.

Remarks

RtecatRequestState is an asynchronous function that takes time to complete. It allows for background execution and requires you to check its status by calling RtecatGetCommandStatus or wait for it to complete by calling RtecatWaitForCommand.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

RtecatApi.h

RtecatApi_W64.lib (Windows), RtecatApi.lib (RTSS)

See Also: