Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Applet

This primitive is used to declare an Applet class, which is uniquely identified by a 32-bit ID known as an Applet ID that is specified by the appletid field. The C function that implements this class can also be specified by the newfunc element. However, the CIFC compiler will issue an error if the constructor function is not specified in any of the included headers.

Prototype:
Applet { 
  appletid = AEECLSID_APPLET, 
  resbaseid = APPLET_RESBASEID,
  applethostid = 0, 
  privs = { AEEPRIVID_UDP_NET_URGENT, AEEPRIVID_FS_FULL_READ }, 
  type = 0, 
  flags = 0,
  newfunc = Foo_New,
}
  • appletid: The ClassID of the applet class. A unique 32-bit ID that callers use to create an instance of this object.
  • resbaseid: The applet base resource ID. Pick a "base ID" for each applet. (The BREW MIF Editor, deprecated in Brew MP, picked them sequentially starting at 1000). The "base ID" tells AppMgr and other bits of Brew MP, such as the display code, where to go look for extended information about the applet. The "extended info" offsets from the baseID are listed in the AEEShell.h file:

    #define IDR_NAME_OFFSET 0
    #define IDR_ICON_OFFSET 1
    #define IDR_IMAGE_OFFSET 2
    #define IDR_THUMB_OFFSET 3
    #define IDR_SETTINGS_OFFSET 4
    #define IDR_VERSION_OFFSET 5
    #define IDR_ENVIRONMENT_OFFSET 6
    #define IDR_OFFSET_STEP 20

    Then, at each of the offsets from the applet's base ID, you can use ModRsc to place a resource of the appropriate type (e.g., the name should be RESTYPE_STRING, but the icon, image, and thumb should be RESTYPE_IMAGE).

  • applethostid: Identifies the ID of the user process that hosts and launches this applet. Zero (0) specifies that the applet is hosted in the kernel process; this is the default behavior of Brew MP version 1.0, and the only option available for BREW 3.x and earlier versions.
  • privs: Privileges that are granted to the applet in addition to those granted to the module. {0} (zero) or {} indicates that no privileges are granted to the applet. See the PrivLevel and Dependencies topics.
  • type: The type of applet. Not used by Brew MP. Used only by carriers for differentiation.
  • flags: Flags, as listed below. (Refer to the AEEAFlags.h file.)
  • newfunc: The name of the C function that creates an instance of this class

    Note: A newfunc is required for code that is written for MOD1. Code written for MOD does not require a newfunc because the AEEAppGen.c and AEEModGen.c files that the Brew MP application wizard provides create a newfunc automatically. Additional information about MOD vs MOD1 is available on the Brew MP website.

Flag Description
AEE_AFLAG_HIDDEN Applet is hidden.
AEE_AFLAG_CFG Applet has a CFG menu.
AEE_AFLAG_SYSTEM_CFG Applet has a hidden CFG menu.
AEE_AFLAG_TOOL Applet is a tool.
AEE_AFLAG_GAME Applet is a game.
AEE_AFLAG_PIM Applet is a PIM.
AEE_AFLAG_WEB Applet is a web applet.
AEE_AFLAG_PHONE Applet is a phone applet (requires PL_SYSTEM).
AEE_AFLAG_SCREENSAVER Applet is a screen saver.
AEE_AFLAG_RUNNING Applet is top-visible or suspended.
AEE_AFLAG_POPUP Applet is popup - no display clear.
AEE_AFLAG_STATIC System use only - Static application.
AEE_AFLAG_BADSHUTDOWN System use only - Applet failed to shutdown properly.

Example:

For example, where there is a file named myApp.bid that contains the following definition of a friendly ClassID:

#define AEECLSID_myApp 0x6F3B438B

The CIF file that contains the Applet primitive can include AEECLSID_myApp.bid, which provides a definition of the friendly ClassID. You can use either friendly ClassIDs or raw ClassIDs.

include "myApp.bid" -- Need to include to use AEECLSID_myApp for appletid.
include "AEEAFlags.h" -- Need to include to use AEE_AFLAG_XXX for flags.
include "AEEDispSettings.bid" -- Need to include to use AEEPRIVID_DISPSETTINGS.
include "AEEPLPrivs.bid" -- Need to include to use AEEPRIVID_PLXXXX.

Applet { 
   appletid = AEECLSID_myApp, 
   resbaseid = 20,
   applethostid = 0, -- default to BMP kernel and omitted for BMP 1.0
   type = 0, -- Of no use to BMP; carrier-specific 
   flags = bit.bor(AEE_AFLAG_HIDDEN, AEE_AFLAG_CFG),
   privs = {AEEPRIVID_PLFile, AEEPRIVID_PLNetwork, AEEPRIVID_DISPSETTINGS},
}