RtecatRegisterCallbackOnReceive
RtecatRegisterCallbackOnReceive registers a function to be called every cycle when new input data arrives. The function runs on the selected processor core.
Syntax
RTECAT_ERROR RtecatRegisterCallbackOnReceive(
[in] RTECAT_HANDLE MainDevice,
[in] APP_CALLBACK UserCallback,
[in] VOID* pContext,
[in] ULONG IdealProcessor,
[in] ULONG Priority
);
Parameters
[in] MainDevice
A handle to a MainDevice. To retrieve the corresponding handle, use RtecatOpenMainDevice.
[in] UserCallback
A pointer to a callback function of type APP_CALLBACK to be called every cycle. APP_CALLBACK is defined in RtecatApi.h:
typedef int(*APP_CALLBACK)(PVOID Context);
Parameter:
Context: A pointer to the user data.
[in] pContext
A pointer that passes data to a callback function.
[in] IdealProcessor
The index of the RTSS core to run a callback function thread.
[in] Priority
The priority of a callback function thread. The valid range is 0-124.
Return Values
The function returns an RTECAT_ERROR value. If the function succeeds, it returns ecatErrNoError. If the function fails, it returns a different value.
Possible return values:
| Return value | Meaning |
|---|---|
|
ecatErrNoError |
The function succeeded. |
|
ecatErrNullParameter |
Parameter UserCallback is NULL. |
|
ecatErrWrongParameter |
One of the following conditions occurred:
|
|
ecatErrMainDeviceNotReady |
The MainDevice instance does not exist. |
|
ecatErrWrongEnvironment |
The MainDevice is switching to the Offline state. |
Remarks
RtecatRegisterCallbackOnReceive is only available for real-time interfaces.
RtecatRegisterCallbackOnReceive is a synchronous function that executes immediately and returns a result upon completion.
wRTOS Runtime stops calling the callback function if it returns a non-zero return code.
Requirements
| Minimum supported version | Header | Library |
|---|---|---|
|
wRTOS 1.0 SDK |
RtecatApi.h |
RtecatApi.lib (RTSS) |
See Also: