RtecatFoeReadFileToBuffer
RtecatFoeReadFileToBuffer reads a file from a SubDevice and saves it to a buffer through FoE (File Access over EtherCAT).
Syntax
RTECAT_COMMAND_STATUS RtecatFoeReadFileToBuffer(
[in] RTECAT_HANDLE SubDevice,
[in] BOOL BootState,
[in] const char* pName,
[in] DWORD Password,
[in] ULONG BufferLength,
[out] BYTE* pBuffer
);
Parameters
[in] SubDevice
A handle to a SubDevice. To retrieve the corresponding handle, use RtecatOpenSubDeviceByIndex, RtecatOpenSubDeviceByStationAddress, or RtecatOpenSubDeviceByExplicitId.
[in] BootState
Set to TRUE to switch to Bootstrap (Boot) state when using FoE, set to FALSE otherwise.
[in] pName
The file name to read from the SubDevice.
[in] Password
The password to access the file in a SubDevice. Set the value to zero (0) if there is no password.
[in] BufferLength
The length, in bytes, of the buffer that stores a file from the SubDevice.
[out] pBuffer
A pointer to the buffer that stores a file from the SubDevice.
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 pName or pBuffer is NULL. |
|
ecatErrWrongParameter |
One of the following conditions occurred:
|
|
ecatErrMainDeviceNotReady |
The MainDevice is not ready. |
|
ecatErrFeatureUnavailable |
The SubDevice doesn't support FoE. |
Remarks
RtecatFoeReadFileToBuffer is only available for real-time interfaces.
RtecatFoeReadFileToBuffer 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.lib (RTSS) |
See Also: