PROFINET Device4.2.0
 
Loading...
Searching...
No Matches

◆ PN_API_IOD_dataReadCbf

typedef PN_API_IOD_IOXS(* PN_API_IOD_dataReadCbf) (PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_DevAddr_t *const addr, const uint32_t bufLen, uint8_t *const buffer, const PN_API_IOD_IOXS remoteIops)

Callback function prototype to write output data received from the IO controller to the physical output of a submodule.

This function is called by Profinet stack after the user application calls PN_API_IOD_initiateDataRead(). IOCS must be returned to the stack as a return value. This value is communicated to the IO controller in the next cycle.

Parameters
[in]pnHandleProfinet API Handle.
[in]addrGeographical address (slot/subslot) of the module/submodule.
[in]bufLenLength of data.
[in]bufferPointer to data buffer to read from.
[in]remoteIopsIOPS from the IO controller, can be: PN_API_IOD_STATUS_BAD or PN_API_IOD_STATUS_GOOD.
Returns
Local IOCS as PN_API_IOD_IOXS.
Return values
PN_API_IOD_STATUS_GOODData received is good.
PN_API_IOD_STATUS_BADData received is bad.
Example
#include "pn_api_iod_callbacks.h"
#include "pn_api_iod_data.h"
#include "pn_api_iod_startup.h"
//Implement the callback function in the user application
PN_API_IOD_Handle_t *const pnHandle,
PN_API_IOD_DevAddr_t *const addr,
const uint32_t bufLen, uint8_t *const buffer,
const PN_API_IOD_IOXS remoteIops)
{...}
PN_API_IOD_Handle_t* pnHandle = NULL;
uint32_t status;
pnHandle = PN_API_IOD_new();
//Store callback functions implemented by the user application
...}
//Register callback function
status = PN_API_IOD_registerCallbacks(pnHandle, &callbacks);
PN_API_IOD_Handle_t * PN_API_IOD_new(void)
Creates Profinet API handle.
uint32_t PN_API_IOD_registerCallbacks(PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_Callbacks_t *callbacksInst)
Register callback functions.
#define PN_API_IOD_IOXS
IO provider/consumer status.
Definition pn_api_iod_types.h:44
struct PN_API_IOD_Handle PN_API_IOD_Handle_t
API handle instance which holds IO device's info.
Definition pn_api_iod_types.h:61
PN_API_IOD_IOXS PN_APP_IOD_cbDataRead(PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_DevAddr_t *const addr, const uint32_t bufLen, uint8_t *const buffer, const PN_API_IOD_IOXS remoteIops)
Callback function to read output data from the IO controller to the physical output of a submodule....
Module/Submodule address (logical/geographical).
Definition pn_api_iod_types.h:445
PN_API_IOD_dataReadCbf readData
Definition pn_api_iod_callbacks.h:54
Structure representing a set of callbacks.
Definition pn_api_iod_callbacks.h:41