When the statement ewA->a1 = deviceValueofa1 is executed ewB->b1 also gets updated. Same goes the other way i.e., ewB->b1 = deviceValueofb1 updates ewA->a1.
What do mean with "...In my devicedriver file I have created objects ewA and ewB of type A and B respectively."? Do you create instances of Chora objects directly within native code? If yes, please note that the instances are discarded automatically by the Garbage Collection. See also the section Don't retain nor modify objects or strings.
Nevertheless, based on the description, it is difficult to narrow down the cause of the behaviour. Can you provide an example demonstrating this problem?
Yes I am creating the instance of Chora objects directly within my cpp file (The devicedriver is the name of the cpp file). I have a group of variables which are functionally related, for example Engine temperature, rpm and torque as one set of variables and environment temperature, pressure as another set of variables. So I grouped them in Chora as classes (Class A and Class B respectively) and update their values using observer pattern using UpdateA(deviceObject,(A)(ewA)) and UpdateB(deviceObject,(B)(ewB)).Is there any other way to group variables in Chora other than classes which doesn't cause this problem?
creating Chora objects in C is not wrong in itself. It is not documented and recommended because of the possible programming traps. You can create an object, initialise it with some data and then pass the object to Embedded Wizard. What you should avoid is to store the object in some C variable for later use. Next time when you evaluate the variable, the referred object possibly does not exist anymore. Trying to use it will result in memory corruption.
Is there any other way to group variables in Chora other than classes which doesn't cause this problem?
So far I understood, you use the object of class A to pass multiple values in the invocation of the method UpdateA(). In such case you can modify the method UpdateA() so it contains parameters for each individual value. Concrete, the DeviceClass contains then 4 properties representing the values RPM, Torque, Temperature and Pressure and 1 (one) UpdateA() method. From C code you invoke only the UpdateA() method and pass to it the four values for RPM, Torque, etc.:
Nevertheless, I still don't understand the cause of the behaviour you observed. If the problem still exists, can you provide me an example demonstrating it?
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!