Connecting Property in DeviceClass with SlotMethod in ApplicationClass

106 views
asked May 6, 2019 in System Integration by rpi3usr

Hello

I am currently learning to use PathData for implementing a vector-graphics based graph display. I am using the example path-data-6 , provided on https://doc.embedded-wizard.de/path-data?v=9.20

Currently the example is generating random values to plot on the graph. I simply want to plot the values picked up from a Property in DeviceClass ( basically ADC values from the hardware). I have been able to display those values with a Numerical Indicator by configuring the Outlet of the UI element. However, now I wish to use the value of the Property in the chora expression of the SlotMethod present in the Application Class. 

I tried but was unable to build . Kindly guide me , what is the proper implementation for this.

1 Answer

+1 vote
answered May 6, 2019 by Paul Banach
 
Best answer

Hello,

you could use the Property Observer object. Following are the typical steps:

- Within your component where you intend to display the graph add a new Property Observer object. The Property Observer object is added together with an associated onEvent Slot method.

- Similarly to how you have connected the Numerical Indicator via Outlet with the DeviceClass property, connect the Property Observer with this property.

With these steps you have a Slot method (onEvent), which will be executed every time the original property in DeviceClass is notified.

- Now open the Slot method for editing and implement there the code to append a new value to PathData based on the value of the property in DeviceClass.

To access the property in Chora expression, just prepend the property name by the name of the corresponding autoobject. For example:

Examples::Device.Property

Does it help you further?

Best regards

Paul Banach

commented May 7, 2019 by rpi3usr

Hello Paul

Thanks for the help. For me, using the Chora expression by using the name of the auto-object device class seems to be the solution.

However, I am unable to view the data of the Property(in Device class) on the graph. To verify whether the device-driver is working well , I also connected a numerical indicator via outlet and that seemed to get the data correctly. Kindly suggest what improvement needs to be done.

commented May 7, 2019 by Paul Banach
Hello,

have you tried to use the Propwerty Observer as explained in my answer above?

Best regards

Paul Banach
commented May 7, 2019 by rpi3usr
The Path data is already being updated by a timer trigger as implemented in the example. Using property observer isnt useful as it will add another trigger to update path data when the ADC value changes.

I simply need to access the stored value and update it in the path data. This is why I found using autoobject expression more relevant.

To check whether the rest of the functionality worked , i used math-rand function to provide new points in path data..which worked well. The problem is that the graph stays empty when i use the autoobject chora expression
commented May 7, 2019 by Paul Banach

Hello,

there is something wrong with the property access. Are you sure, you are accessing the right property? Can you add following code to the method triggered by the timer. This will print the property values in the Log window:

// Print the actual value of the property. Please replace the name Example::Device
// by the correct name of the autoobject in your project and Property by the name
// of the correct property.
trace Example::Device.Property;

Best regards

Paul Banach

commented May 8, 2019 by rpi3usr
Thanks for your help.

The property was being accessed correctly. The values being obtained from ADC were in microvolts , and seemed to be out of range of the graph. Dividing the values by a suitable number did the job.

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

...