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

Developer

resources

Event handling concepts

IApplet is the event-handling interface that implements services provided by an applet. All applets must implement IApplet. IApplet is called by the shell in response to specific events. IApplet provides a mechanism to the shell to pass events to an applet. When the shell responds to an applet, it calls IApplet_HandleEvent(), and passes event-specific parameters to the function. This includes an event code (ecode), defined in AEEEvent.h. Based on the event code, word (wParam) or doubleword (dwParam) event-specific, context-sensitive data may also be sent.

IApplet_HandleEvent() is only called by AEE Shell. To send events to other applications, use IShell_SendEvent().

The following is a prototype of the main applet event handler:

boolean myapp_HandleEvent    //Main Event Handler
(
   myapp * pMe,               //pointer to applet
   AEEEvent eCode,            //event eCode 
   uint16 wParam,             //context sensitive short param
   uint32 dwParam             //context sensitive long param
)

There are three event-related inputs that applets receive, passed in as the second, third, and fourth parameters of the HandleEvent() function.

  • AEEEvent specifies the event code received by the applet. EVT_APP_START, EVT_KEY, and EVT_ALARM are examples of events received by applets.
  • The third parameter is a short word value, which is context-sensitive and dependent on the event. There may or may not be a wParam related to the event.
  • The fourth parameter is a long (doubleword), context-sensitive value that is dependent on the event. This can be a bit modifier, constant string, or other long value that is dependent on the event. There may or may not be a dwParam related to the event.

See the http://developer.brewmp.com/reference/api-all for details on the wParam and dwParam parameters for each event.