Home

mlamp

Download project

Event Manager

This example shows how to receive and send system events like start, stop, login or logout.

More information

There are two kinds of registration. One is the registration of an interface function and
the other one is the registration of a normal function. The registration is done within the
FB_Init method.

  • EventCallbackFB:
    The ICmpEventCallback Interface with the EventCallback method is implemented here. After the function block was created the EventCallback method and the event will be registered in the FB_Init method. If the function block gets deleted the FB_Exit method is called which unregisters from the event. In case the stop event occurs the method will save the cause of the event in the g_ulStopReason variable.

  • EventCallbackFunctionFB:
    This function block registers login and logout events with the EventCallbackFunction function. Every time one of the two events occurs the function will be called.

  • EventCallbackFunction:
    Counts the occurred events.

  • Main:
    Here a logout event is generated manually. This event is also caught by the EventCallbackFunction function and increments the counter by one.