Hi,
We are working on the server example 2 and we are interested in a special feature concerning the event notification. In fact, the example is already including a sendPush function that is sending a data notification by pushing on the medium of communication a push setup object each 30 seconds. We are interested in a different approach that i will explain below. We only want to send a notification to the client when a special event happened.
1- First, we should have a log filter a simple data object (check the picture "log filter"). The value is equal to an Array [2] of Bit-string[256]. The first element of the array tell if we should or not log the event into the buffer. The second element of the array tell if we should or not send a notification event.
For example: GURUX_EVENT_CODES_OUTPUT_RELAY_STATE = 0x80 (128)
Array[0] if bit128 = 1 => event will be logged into the buffer
bit128 = 0 => event will not be logged into the buffer
Array[1] if bit128 = 1 => event will be sent as notification event
bit128 = 0 => event will not be sent as notification event
2- Let's take the example of the GURUX_EVENT_CODES_OUTPUT_RELAY_STATE. When the output relay state changed, an event occurred. The first step is to check the log filter based on the event number (data object). The above event code is 128 so we check the 128 bit of the array[0] if it is equal to 1 we capture the event and the associated time into the event log buffer (profile generic object), if it is equal to 0, we don't.
In our project the updateState() function is already implemented (log the eventCode and the time in the event log buffer), but we just want to add the condition based on the log filter. We don't want to log all the events into the buffer all the time, we should be able to control it through the log filter.
3- Then we check the 128 bit of the array[1] if it is equal to 1 the server should build an EVENT-NOTIFICATION-Request APDU and send it out in order to inform the client of the value of it. The EVENT-NOTIFICATION-Request APDU should be generated based on a specific structure (check the picture "event notification structure"). This APDU should respect the wanted structure and should be sent directly to the client through the available medium of communication without using a push setup object. If the array[1] is equal to 0, we send nothing.
We hope that you can implement these features. If you need more information or details don't hesitate to ask.
Best Regards,
Lara Wakim
The event notification request with log filter
Hi,
There is sendEventNotification method. It will send date-time and activePowerL1Value in event notification message. If you want to send more complex structures, you need to use notify_generateEventNotificationMessages2 and set data by your self. This example is updated later today.
BR,
Mikko