Resources | Resources |



Applet structure and other data structures

A Brew MP application has an applet structure, which is the data definition of the application. A pointer this structure is passed to all functions in the application to provide access to application data.

The functions provided by Brew MP interfaces use data structures to define the format and content of the data passed between interface functions and calling applications.

Brew MP applet structure

Application data, such as interface pointers, buffer pointers, and global data, should be stored in the applet structure. If you use the C Application Wizard to create an application, the wizard creates a default applet structure that contains the minimum data needed for the application. You can add interface pointers and other data required for the application to this structure.

The following is an example of an applet structure that was created by the Brew MP C Application Wizard:

typedef struct _example_app {
    AEEApplet  applet;    // First element of this structure must be AEEApplet.
    IDisplay * piDisplay; // Copy of IDisplay Interface pointer for easy access.
    IShell   * piShell;   // Copy of IShell Interface pointer for easy access.
    AEEDeviceInfo  deviceInfo; // Copy of device info for easy access.
    // Add your own variables here...

} example_app;

The following variables are included in the Wizard-generated applet structure:
  • The first variable in the applet structure must be of type AEEApplet. AEEApplet is defined in AEE.h as a Brew applet type. Placing this element in the first position defines the address of the applet with the same address as the data structure for the applet. In the code above, "applet" is declared as an AEEApplet type.
  • IDisplay is a primary interface used by all applets for rendering text and other information to the display. The pointer *piDisplay is declared here to make the instance of the IDisplay interface available to all applications.
  • IShell is an interface used by all Applets. All applets can use the IShell pointer defined here to access shell services throughout the application.
  • AEEDeviceInfo is a Brew data structure defined in AEEShell.h, used for holding device configuration and capability information. The deviceinfo variable is declared to be an AEEDeviceinfo structure.

For more information, see the Brew MP Best Practices Technology Guide on the

Data structures used by Brew MP interfaces

Most data structures are specific to a particular Brew MP interface, and their type definitions are contained in the header file for that interface. More general, widely used data structures are found in the AEE.h file. The description of each function in the contains links to the descriptions of all relevant data structures.

The following data structure types are used by Brew MP interfaces:

  • Structures and unions - Many Brew MP functions take pointers to structures as input parameters. To use these functions, an instance of a structure is populated, and a pointer is passed to the instance when calling the function. For example, the IGraphics shape-drawing functions have structures as input parameters that define the dimensions of the shape to be drawn. Many Brew MP functions return pointers to structures as output. The IFile and IImage interface functions, for example, return information about files and images in structures.
  • Enumerated types - Many Brew MP variables and structure members take values from a finite set defined by the C typedef enum construct. For example, the font types supported by the IDisplay interface's text-drawing functions are specified with an enumerated-type definition.
  • Constants - The Brew MP API functions make use of a number of constants defined with the #define directive. For example, all of the Brew MP event codes are defined in this manner in AEEEvent.h.