6.6. Notifications
6.6.1. Notification handler
The application can register a notification handler using esRegisterClient() for notifications as described below.
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:
6.6.2. EC_NOTIFY_SLAVE_PRESENCE
This notification is given, if slave appears or disappears from the network.
This notification is enabled by default.
- emNotify - EC_NOTIFY_SLAVE_PRESENCE
- Parameter
pbyInBuf: [in] Pointer to EC_T_SLAVE_PRESENCE_NTFY_DESCdwInBufSize: [in] Size of the input buffer provided at pbyInBuf in bytes.pbyOutBuf: [out] Should be set to EC_NULLdwOutBufSize: [in] Should be set to 0pdwNumOutData: [out] Should be set to EC_NULL
Disconnecting the slave from the network, powering it off or a bad connection will generate this notification.
6.6.3. EC_NOTIFY_SLAVE_STATECHANGED
This notification is given, when a slave changed its EtherCAT state. This notification is disabled by default.
- emNotify - EC_NOTIFY_SLAVES_STATECHANGED
- Parameter
pbyInBuf: [in] Pointer to EC_T_SLAVE_STATECHANGED_NTFY_DESCdwInBufSize: [in] Size of the input buffer provided at pbyInBuf in bytes.pbyOutBuf: [out] Should be set to EC_NULLdwOutBufSize: [in] Should be set to 0pdwNumOutData: [out] Should be set to EC_NULL
6.6.4. EC_NOTIFY_HC_TOPOCHGDONE
This notification is given by eUsrJob_SimulatorTimer when the topology changes.
- emNotify - EC_NOTIFY_HC_TOPOCHGDONE
- Parameter
pbyInBuf: [in] Should be set to EC_NULLdwInBufSize: [in] Should be set to 0pbyOutBuf: [out] Should be set to EC_NULLdwOutBufSize: [in] Should be set to 0pdwNumOutData: [out] Should be set to EC_NULL
See also
6.6.5. EC_NOTIFY_SLAVE_ERROR_STATUS_INFO
This notification is given, when the Error bit on the specific slave is set or cleared Detailed error information is stored in structure EC_T_SLAVE_ERROR_INFO_DESC of EC_T_ERROR_NOTIFICATION_DESC.
6.6.6. EC_NOTIFY_EEPROM_OPERATION
This notification is given, when a slave EEPROM is written by the master.
- emNotify - EC_NOTIFY_EEPROM_OPERATION
- Parameter
pbyInBuf: [in] Pointer to EC_T_EEPROM_OPERATION_NTFY_DESCdwInBufSize: [in] Size of the input buffer provided at pbyInBuf in bytes.pbyOutBuf: [out] Should be set to EC_NULLdwOutBufSize: [in] Should be set to 0pdwNumOutData: [out] Should be set to EC_NULL
-
struct EC_T_EEPROM_OPERATION_NTFY_DESC
Public Members
-
EC_T_DWORD dwTferId
Transfer ID. For every new EEPROM operation a unique ID has to be assigned. This ID can be used after completion to identify the transfer
-
EC_T_EEPROM_OPERATION_TYPE eType
Type of EEPROM operation
-
EC_T_DWORD dwTferId
6.6.7. esNotifyApp
-
EC_T_DWORD esNotifyApp(EC_T_DWORD dwInstanceID, EC_T_DWORD dwCode, EC_T_NOTIFYPARMS *pParms)
Calls the notification callback functions of all registered clients.
Note
EC_E_ERROR and EC_E_INVALIDPARM from registered clients’ callback functions are ignored.
- Parameters
dwInstanceID – [in] Instance ID (Multiple EtherCAT Network Support)
dwCode – [in] Application specific notification code. dwCode must be <= EC_NOTIFY_APP_MAX_CODE. The callback functions get “EC_NOTIFY_APP | dwCode” as parameter.
pParms – [in] Parameter to all callback functions. Note: Output parameters are not transferred from RAS client to RAS server.
- Returns
EC_E_ERROR or first error code different from EC_E_ERROR and EC_E_INVALIDPARM of registered clients’ callback functions