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

Developer

resources

Utility panel

Utility panel is an applet grouping example. Applets from fs:/usermods are displayed if they are marked in their .mif files.

Requirements

To run the c_basicapp sample code, you need the following:

  • Brew MP 1.0 SDK rev 7.11.1 or higher
  • Brew MP-enabled device or a Simulator target
  • Installed copy of Sample Code from the SDK Manager

Sample code location

Filename

Location

Run application

utilitypanel

Sample code installation folder

  • Open the utilitypanel.sln in Visual Studio.
  • Compile the applet.
  • Click the Click2Run icon.

Event handling

Utility Panel handles both touch and keyboard events. Touch events are used to allow the arrangement of icons on the Utility Panel desktop. Touch and keyboard events allow the user to launch applications and change the selected application on the desktop.

Example

A set of applications can be grouped by marking them in the .cif file. Utility Panel applications are marked as follows:
--Mark this app for inclusion in Utility Panel
ModRsc {
   id    = 1020, -- Applet base resource id + 1000
   type  = 1,  --RESTYPE_ENCSTRING (see AEEResType.h)
   data  = EncStringRscData(0xff, "UTILITY")
}

Utility Panel then iterates through the fs:/usermods directory, reading through each .mif file, checking for the above marking.

AECHAR szUtils[MAX_APP_NAME];
szUtils[0] = 0;
ISHELL_LoadResString(pMe->piShell, pNewItem->m_pMifName, IDB_MIF_UTILITYAPPLET, 
   szUtils, MAX_APP_NAME);
if (WSTRCMP(L"UTILITY", szUtils) != 0)
{
   //then app is a utility
}

Error handling

The Utility Panel application uses the following macros for error handling:

#define ERR_CATCH        __errcatch
#define ERR_TRY(x)  do{nErr = (x); if(AEE_SUCCESS != nErr) goto ERR_CATCH;} while(0)
#define ERR_THROW(e) do { nErr = (e); goto ERR_CATCH; } while(0)
#define ERR_CHECK_PTR(p)      if (NULL == p) ERR_THROW(AEE_EFAILED);