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

Developer

resources

Device integration

Handling joystick events

The IJoystick interface controls the joystick on a mobile device. When created, an IJoystick interface object enables the generation of joystick (X,Y) coordinates, which are received by the application as Brew MP joystick events (recommended), or through a polling read functionality (provided for versions of BREW earlier than 3.1.4). The IJoystick interface further provides the capability for controlling the sample rate and inactivity timeout configuration parameters to the joystick device.

Create an object of type IJoystick to control the joystick device's sample rate and other configuration parameters.

Sending joystick events

The addition of two events to AEE_Event, EVT_JOYSTICK_POS (sent by OEMs) and EVT_JOYSTICK_STALE_POS (sent by Brew MP), allows you to send joystick events through the OEM layer to Brew MP and Brew MP applications. The events and their parameters appear below.

AEE_Event joystick events sent by OEMs

The AEE_Event() (EVT_JOYSTICK_POS) is sent when the joystick moves.

AEE_Event joystick event sent by Brew MP

The AEE_Event() (EVT_JOYSTICK_STALE_POS) event must not be sent by OEMs. Brew MP will send this event to the applications when it sees an EVT_JOYSTICK_POS event, and when there is a move near the EVT_JOYSTICK_POS event in the queue.

Note: If there are between 30 and 39 joystick events in the queue, half of the new joystick events are dropped. If there are between 40 and 44 joystick events in the queue, two-thirds of the new joystick events are dropped. If there are between 45 and 48 joystick events in the queue, three-fourths of the new joystick events are dropped. If there are 49 joystick events in the queue, four-fifths of the new joystick events are dropped. If there are 50 joystick events in the queue, all of the new joystick events are dropped.

Joystick event parameters
Parameter Value Description
AEEEvent evt EVT_JOYSTICK_POS Sent when the joystick moves.
wparam (16 bit) Ignored.

Note: The wparam from the OEM layer is ignored and later filled in with the lower 16 bits of time.

Lower 16 bits of current time of day in milliseconds (ms).

dwparam (32 bit) The joystick position of the x coordinate on the display. Upper 16 bits = the signed x-coordinate.
dwparam (32 bit) The joystick position of the y coordinate on the display. Lower 16 bits = the signed y-coordinate.