10. Generic notification interface
One of the parameters the client has to set when registering with the EC-Monitor is a generic notification callback function ( emonNotify()). This function is called every time an event occurs about which the client needs to be informed.
Within this callback function the client must not call any active EtherCAT® functions which finally would lead to send EtherCAT® commands (e.g. initiation of mailbox transfers, starting/stopping the MainDevice, sending raw commands). In such cases the behavior is undefined. Only EtherCAT® functions which are explicitly marked to be callable within emonNotify() may be called.
This callback function is usually called in the context of the EC-Monitor timer thread or the EtherCAT® Real-time Ethernet Driver receiver thread. To avoid dead-lock situations the notification callback handler may not use mutex semaphores.
As the whole EtherCAT® operation is blocked while calling this function the error handling must not use much CPU time or even call operating system functions that may block. Usually the error handling will be done in a separate application thread.