Example Listener

This sample illustrates the use of the TwinCAT 3 EventLogger in relation to messages and alarms.

It consists of a module that can send a message and an alarm, and a module that receives these messages.

Download the sample: https://github.com/Beckhoff/Tc3Eventlogger_Samples/tree/main/C%2B%2B(RT)/Tc3EventLogger_CppListener_Sample

Publisher module

Single BOOL variables are used in the Publisher module as triggers on the input data area:

In addition there is an option to set and to remove the JSON attribute in order to send it with both messages.

Listener module

The Listener module implements both the ITCMessageListener and the ITcAlarmListener interface. The methods specified as a result of this are called by the EventLogger as callback.

The Listener module thereby registers itself with the EventLogger for the corresponding event classes on starting in the method SetObjStateSO().