Platform Package reference: Function EwGetAutoObject()

Description of the function EwGetAutoObject() available in all Platform Packages for C compatible target systems. This function is intended to be used when integrating the Embedded Wizard created GUI application with the underlying graphics subsystem, graphics hardware or other external GUI applications coexisting on the same system.

Declaration

XObject EwGetAutoObject( const XVariant* aAutoObject, XClass aClass )

Parameters

aAutoObject

Pointer to a data structure representing the autoobject to access. This data structure and all associated contents are generated by Embedded Wizard.

aClass

Pointer to data structure representing the class of the autoobject to access. The specified class has to match with the class defined originally in the autoobject member.

Discussion

The function EwGetAutoObject() returns an autoobject identified by aAutoObject. The function verifies whether the required object is already instantiated and if it's true, the existing instance is returned immediately. If no instance of the desired autoobject could be found, EwGetAutoObject() prepares a new object of the class aClass and initializes it properly. For example:

ApplicationDeviceClass device = EwGetAutoObject( &ApplicationDeviceObject, ApplicationDeviceClass );

The created object will remain in memory as long as the object is in use. Objects, which are not in use anymore are automatically released during the next EwReclaimMemory() invocation.

Starting with version 15 of Embedded Wizard, the function EwGetExistingAutoObject() is available as an alternative to EwGetAutoObject(). Unlike EwGetAutoObject(), the function EwGetExistingAutoObject() does not instantiate the autoobject if it does not already exist and returns NULL instead.

Use EwGetExistingAutoObject() when implementing middleware that should only interact with the UI when the corresponding autoobject is already active. This prevents unnecessary object instantiation from external events or data feeds. Use EwGetAutoObject() when you need to ensure the autoobject is available and should be created if it doesn't exist.