28 views
in Embedded Wizard Studio by
Hi Gents,

 I have a Device Property that I'm updating from DeviceDriver.c. I can see it hit the associated _Update{} method multiple times, which updates the property via a pure. And then commands a notifyobservers ^Property.

My issue is that even though the _Update{} method is being hit multiple times the Observer watching Property is only run once. Why this discrepancy?

1 Answer

0 votes
by

Hello Mike,

when you invoke Update method for one and the same property multiple times, all resulting notifications are accumulated. In this way the GUI application does process the latest (the current) value of the property ignoring all interim (outdated) values. The typical function of the Device Property is to reflect a value existing in the device, so the GUI application can display this value or calculate with it. If the value changes fast (faster than the application is able to process it), the application ignores the interim values calculating with latest one. This affects the optimization.

If you expect the application to process each value individually, the Device Properties are not the appropriate technique. Instead, following approaches are suitable:

Option 1: You can use the System Event and the System Event Handler. These don't accumulate the events. So if you trigger 5 events, the associated handler will receive 5 notifications in series. With each system event you can additionally provide an individual data object containing e.g. some values you have previously tried to relay via properties. The System Event Handler can thus process each value individually.

Option 2: Each time you invoke Update method, store the new value additionally within an array existing e.g. in the Device object. In other words, you collect all property changes. The GUI components can then access the array and evaluate each alternation of the property.

Option 3: Don't use the Property Observer, which in fact accumulates the notifications. Instead, with each Update method invocation provide the just received value directly to the GUI component (or components) interested to process the values. For this purpose, you will need to store references to the affected GUI component objects in the Device object. Knowing the GUI components, the Device object can thereupon invoke their methods and so provide each value directly to them.

Does it help you further?

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...