Muteki
EABI code execution on Besta® RTOS devices.
Loading...
Searching...
No Matches
event.h File Reference

Low-level UI event handing API. More...

Go to the source code of this file.

Data Structures

struct  key_press_event_config_t
 Configuration struct for key press event generator. More...

Enumerations

enum  toggle_key_state_e { TOGGLE_KEY_INACTIVE = 0 , TOGGLE_KEY_ACTIVE , TOGGLE_KEY_TRIGGERED }
 Toggle key states. More...

Functions

void GetSysKeyState (key_press_event_config_t *config)
 Read current configuration of key event generator.
void SetSysKeyState (const key_press_event_config_t *config)
 Configure key event generator.
int GetPenEvent (ui_event_sys_t *event)
 Consume event from the system UI event queue (mostly for touch).
int CheckPenEvent (void)
 Check whether or not there are any pending system UI events.
void ClearPenEvent (void)
 Discard all unconsumed system UI events.
int PutSystemEvent (ui_event_sys_t *event)
 Produce a system UI event.
bool GetEvent (ui_event_t *event)
 Consume an event.
bool GetPendEvent (ui_event_t *event)
 Consume an event from the main event queue.
unsigned int SetEventType (unsigned int mask)
 Set the event type bit mask.
unsigned int GetEventType (void)
 Get the current event type bit mask.
bool PutEvent (ui_event_t *event)
 Produce an event in the main event queue.
void PutEventExt (int type, unsigned int value, void *user_data)
 Produce an event in the main event queue (by values).
bool TestPendEvent (ui_event_t *event)
 Peek pending events in the main event queue, and also special events.
void ClearPendEvent (void)
 Empty all unconsumed events in the main event queue.
void ClearPenState (void)
 Reset the touch state tracker only.
void ClearEvent (ui_event_t *event)
 Invalidate an event struct.
void ClearAllEvents (void)
 Discard unprocessed UI events.
bool TestKeyEvent (ui_event_t *event)
 Peek pending events in the system event queue.
unsigned short SetShiftState (unsigned short new_state)
 Manually set the state of the SHIFT toggle key.
unsigned short SetCapsState (unsigned short new_state)
 Manually set the state of the CAPS toggle key.
unsigned short GetShiftState (void)
 Get the state of the SHIFT toggle key.
unsigned short GetCapsState (void)
 Get the state of the SHIFT toggle key.
bool SendMessage (ui_event_t *event)
 Synchronously send an event to a recipient, bypassing the event queuing mechanism.
bool SendMessageExt (ui_component_t *recipient, int event_type, unsigned int value, void *user_data)
 Synchronously send an event to a recipient (by values).

Detailed Description

Low-level UI event handing API.

There are 2 event queues:

  • The main event queue, which is primarily used for broadcasting events to components.
  • The system event queue, which is primarily used for input events like key presses and touch.

GetEvent() consolidates events from both event queues into a single handler.

As a part of inter-component communication, the event subsystem also includes a way to send an event directly to a UI component. See SendMessage() and SendMessageExt().

Enumeration Type Documentation

◆ toggle_key_state_e

Toggle key states.

Enumerator
TOGGLE_KEY_INACTIVE 

Toggle key is inactive.

No event will/should be modified.

TOGGLE_KEY_ACTIVE 

Toggle key is active.

Events may modified in case of SHIFT, and should be modified by the user in case of CAPS.

TOGGLE_KEY_TRIGGERED 

Toggle key is triggered and will deactivate itself.

This is only seen on SHIFT where once another key is pressed, the toggle state will be set to this value.

Function Documentation

◆ CheckPenEvent()

int CheckPenEvent ( void )
extern

Check whether or not there are any pending system UI events.

Syscall Number
0x1003c
Parameters
None.
Return values
0No event available, and touch is not active.
1Some event is available, or touch is active.

◆ ClearAllEvents()

void ClearAllEvents ( void )
extern

Discard unprocessed UI events.

This drains both the main and the system event queues, the UI_EVENT_TYPE_SPECIAL flag, and resets the touch state tracker.

Note
This does not clear flags related to UI_EVENT_TYPE_INTERNAL. However a UI_EVENT_TYPE_INTERNAL event with value UI_EVENT_INTERNAL_BYPASS will be cleared during the clearing of the system event queue.
Syscall Number
0x1004a
Parameters
None.
Returns
None.

◆ ClearEvent()

void ClearEvent ( ui_event_t * event)
extern

Invalidate an event struct.

This function zeros out ui_event_t::event_type and ui_event_t::event_source.

Syscall Number
0x10049
Parameters
[in,out]eventPointer to a ui_event_t struct.
Returns
None.

◆ ClearPendEvent()

void ClearPendEvent ( void )
extern

Empty all unconsumed events in the main event queue.

Syscall Number
0x10047
Parameters
None.
Returns
None.

◆ ClearPenEvent()

void ClearPenEvent ( void )
extern

Discard all unconsumed system UI events.

Syscall Number
0x1003d
Parameters
None.
Returns
None.

◆ ClearPenState()

void ClearPenState ( void )
extern

Reset the touch state tracker only.

Syscall Number
0x10048
Parameters
None.
Returns
None.

◆ GetCapsState()

unsigned short GetCapsState ( void )
extern

Get the state of the SHIFT toggle key.

Syscall Number
0x100af
Parameters
None.
Returns
The current state.
See also
toggle_key_state_e Valid toggle key states.

◆ GetEvent()

bool GetEvent ( ui_event_t * event)
extern

Consume an event.

This will try to consume the next event from firstly the main event queue, and when the main event queue is empty, the system event queue.

Note
This function will subscribe to the OS event of the UI event subsystem and will block when there is currently no event to be processed.
Syscall Number
0x1003f
Parameters
[out]eventPointer to a ui_event_t struct.
Return values
trueSome events were consumed and returned.
falseNo event was consumed and returned.

◆ GetEventType()

unsigned int GetEventType ( void )
extern

Get the current event type bit mask.

Syscall Number
0x10042
Parameters
None.
Returns
The current event type bit mask.

◆ GetPendEvent()

bool GetPendEvent ( ui_event_t * event)
extern

Consume an event from the main event queue.

This pops an event from the main event queue only without blocking.

This is mostly used as a pass in GetEvent() internally.

Syscall Number
0x10040
Parameters
[out]eventEvent.
Return values
trueAn event has been consumed.
falseNo event has been consumed.

◆ GetPenEvent()

int GetPenEvent ( ui_event_sys_t * event)
extern

Consume event from the system UI event queue (mostly for touch).

If touch is active, this will generate a touch hold event on the fly. Similarly, a touch release event will be generated if touch is not active. Due to this behavior, this function never blocks.

Note
The name suggests that it is only for touch/pen event but it can also consume a key event, or anything that is in the system event queue.
Syscall Number
0x1003b
Parameters
[out]eventA simplified event struct that contains only the fields related to input.
Return values
0No event was consumed.
1Event is consumed.

◆ GetShiftState()

unsigned short GetShiftState ( void )
extern

Get the state of the SHIFT toggle key.

Syscall Number
0x100af
Parameters
None.
Returns
The current state.
See also
toggle_key_state_e Valid toggle key states.

◆ GetSysKeyState()

void GetSysKeyState ( key_press_event_config_t * config)
extern

Read current configuration of key event generator.

Syscall Number
0x10032
Parameters
[out]configThe configuration struct for holding the exported configuration.
Returns
None.
See also
key_press_event_config_t The config struct and details on the expected format.

◆ PutEvent()

bool PutEvent ( ui_event_t * event)
extern

Produce an event in the main event queue.

Syscall Number
0x10043
Parameters
[in,out]eventThe event.
Return values
trueSuccessfully signaled the subscribers.
falseAttempt to produce an invalidated event, or failed to signal the subscribers.

◆ PutEventExt()

void PutEventExt ( int type,
unsigned int value,
void * user_data )
extern

Produce an event in the main event queue (by values).

This zero-allocates a temporary event struct on the stack, sets the user-specified fields and then calls PutEvent() to produce an event.

Syscall Number
0x10045
Parameters
typeEvent type.
valueRaw 32-bit event value.
user_dataUser data pointer.
Returns
None.
See also
ui_event_type_e

◆ PutSystemEvent()

int PutSystemEvent ( ui_event_sys_t * event)
extern

Produce a system UI event.

Syscall Number
0x1003e
Parameters
eventNew system UI event.
Return values
trueSuccessfully signaled the subscribers.
falseError occurred when signaling the subscribers.

◆ SendMessage()

bool SendMessage ( ui_event_t * event)
extern

Synchronously send an event to a recipient, bypassing the event queuing mechanism.

Note
Some events have different data layout. For example UI_EVENT_COMPONENT_CALL_SET_STATE requires the ui_event_state_change_t instead of ui_event_t. Either cast them into ui_event_t or pass the parent event member.
Syscall Number
0x10188
Parameters
[in,out]eventThe event. Must contain a valid ui_event_t::recipient.
Returns
true Event is consumed by the recipient.
false Event is not consumed by the recipient or recipient is NULL.

◆ SendMessageExt()

bool SendMessageExt ( ui_component_t * recipient,
int event_type,
unsigned int value,
void * user_data )
extern

Synchronously send an event to a recipient (by values).

This allocates a temporary event struct on the stack, sets the user-specified fields and then calls SendMessage() to send the generated event.

Syscall Number
0x10189
Parameters
[in,out]recipientThe UI component receiving the event.
event_typeEvent type.
valueRaw 32-bit event value.
[in,out]user_dataUser data pointer.
Returns
true Event is consumed by the recipient.
false Event is not consumed by the recipient or recipient is NULL.

◆ SetCapsState()

unsigned short SetCapsState ( unsigned short new_state)
extern

Manually set the state of the CAPS toggle key.

Syscall Number
0x100ae
Parameters
new_stateThe new state.
Returns
The previous state.
See also
toggle_key_state_e Valid toggle key states.

◆ SetEventType()

unsigned int SetEventType ( unsigned int mask)
extern

Set the event type bit mask.

The default is to allow all event types (0xffffffff). If the corresponding bit is 0, the event processing with GetEvent() will stall until the bit is set back to 1.

Syscall Number
0x10041
Parameters
maskNew event type bit mask of allowed event types.
Returns
The old event type bit mask.
See also
ui_event_type_e List of event types.

◆ SetShiftState()

unsigned short SetShiftState ( unsigned short new_state)
extern

Manually set the state of the SHIFT toggle key.

Syscall Number
0x100ad
Parameters
new_stateThe new state.
Returns
The previous state.
See also
toggle_key_state_e Valid toggle key states.

◆ SetSysKeyState()

void SetSysKeyState ( const key_press_event_config_t * config)
extern

Configure key event generator.

Syscall Number
0x10033
Parameters
[in]configThe configuration struct to be imported.
Returns
None.
See also
key_press_event_config_t The config struct and details on the expected format.

◆ TestKeyEvent()

bool TestKeyEvent ( ui_event_t * event)
extern

Peek pending events in the system event queue.

Syscall Number
0x1004b
Parameters
[out]eventpointer to a ui_event_t struct.
Return values
trueSome events were processed.
falseNo event was processed.
See also
TestPendEvent

◆ TestPendEvent()

bool TestPendEvent ( ui_event_t * event)
extern

Peek pending events in the main event queue, and also special events.

Syscall Number
0x10046
Parameters
[out]eventpointer to a ui_event_t struct.
Return values
trueSome events need to be consumed. This may be a special event that has no data. In that case event.event_type is cleared.
falseNo event needs to be consumed.
See also
TestKeyEvent Related function that peeks the system events.