4.5. Notifications

When a client registers with the EC-Simulator stack the client has to determine a generic notification callback function. The stack calls this function every time an event (for example an error event or operational state change event) occurs about which the client has to be informed.

A further important rule exists due to the fact that this callback function is usually called in the context of the EC-Simulator stack timer thread. As the whole EtherCAT operation is blocked while calling this function the notification handler must not use much CPU time or even call operating system functions that may block. Time consuming operations should be executed in separate application threads.

Data structure filled with detailed information about the according notification.

struct EC_T_NOTIFYPARMS

Public Members

EC_T_VOID *pCallerData

[in] Client depending caller data parameter. This pointer is one of the parameters when the client registers

EC_T_BYTE *pbyInBuf

[in] Notification input parameters

EC_T_DWORD dwInBufSize

[in] Size of input buffer in byte

EC_T_BYTE *pbyOutBuf

[out] Notification output (result)

EC_T_DWORD dwOutBufSize

[in] Size of output buffer in byte

EC_T_DWORD *pdwNumOutData

[out] Amount of bytes written to the output buffer

4.6. esNotifyApp

EC_T_DWORD esNotifyApp(EC_T_DWORD dwInstanceID, EC_T_DWORD dwCode, EC_T_NOTIFYPARMS *pParms)

Notify application.

By calling this function the generic notification callback function setup by emRegisterClient() is called. The maximum value for dwCode is defined by EC_NOTIFY_APP_MAX_CODE.

Parameters
  • dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)

  • dwCode – [in] Application specific notification code

  • pParms – [in] Parameters for application notification.

Returns

EC_E_NOERROR or error code