RtecatAoeWriteCommand

RtecatAoeWriteCommand writes data to a SubDevice through AoE (Automation Device Specification over EtherCAT).

Syntax

Copy
RTECAT_COMMAND_STATUS RtecatAoeWriteCommand(
  [in]    RTECAT_HANDLE SubDevice,
  [in]    WORD Port,
  [in]    ULONG IndexGroup,
  [in]    ULONG IndexOffset,
  [in]    const BYTE* pValue,
  [in]    ULONG Length
);

Parameters

[in] SubDevice

A handle to a SubDevice. To retrieve the corresponding handle, use RtecatOpenSubDeviceByIndex, RtecatOpenSubDeviceByStationAddress, or RtecatOpenSubDeviceByExplicitId.

[in] Port

The SubDevice port.

[in] IndexGroup

An index group of an object.

[in] IndexOffset

The offset of an object in an index group.

[in] pValue

A pointer to the buffer that contains the data to write to the SubDevice.

[in] Length

The length, in bytes, of the value to write.

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.

ecatErrNullParameter

Parameter pValue is NULL.

ecatErrWrongParameter

One of the following conditions occurred:

  • Parameter SubDevice is invalid.
  • The value of parameter Length is zero (0).

ecatErrMainDeviceNotReady

The MainDevice is not ready.

ecatErrFeatureUnavailable

The SubDevice doesn't support AoE.

Remarks

RtecatAoeWriteCommand 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: