Dear all,
We are implementing a UI who have a lot of things to be set based on parameters coming from the Device.
As an example the Gauges need to set it's value, it's background color and view-state (enabled or disabled) based on some information coming from the Device directly.
We have see the examples of the integration (DeviceDrivers) which uses standard method with integer parameters. Doing this for every single gauge we have on the project will results in having a lot of method per each single gauge.
We was looking at an optimized way to pass parameters to the update method, like by using structs.
Is it possible to pass a struct (with all the data) instead of a list of parameter?
We tried to add a Chora Class and pass it as parameter but when wen we instance a variable of the struct that has been translated from Chora to C, seems it need to be initialized (but we don't know how).
ApplicationProvaDavide tst;
uint8_t workerQueue_GUISide(void)
{
osStatus_t retQueue ;
mw_update_message msg;
retQueue = osMessageQueueGet( queueGUI, &msg, NULL, 0U);
if ( retQueue == osOK )
{
ApplicationMiddlewareClass homepage = EwGetAutoObject( &ApplicationaoMiddleware, ApplicationMiddlewareClass );
if ( homepage != NULL )
{
switch ( msg.subject )
{
case UPDATE_GAUGE :
{
tst->Variable = 30;
tst->Variable1 = 40;
tst->Variable2 = 50;
ApplicationMiddlewareClass__MethodDAVIDE( homepage, tst );
testVAL++;
if ( testVAL == 100 )
testVAL = 0;
}
break;
}
}
return 1;
}
return 0;
}
basically the tst variable have wrong addresses in memory due to a missing initialization at our side (in my opinion), and when we try to change the "Variable" fields, the value is not updated.
The queue , de-queue the message and trigger the operations at the EwProcess function side so it's within the same thread. Other thread just enqueue messages.
Is there any good way to do what we're trying to do? Is it safe?
Thanks
Davide