General Info

Interface: InterManager
Files: intermanager.h
Last Change: 02/07/2003
Author: Luiz Henrique Shigunov
Description
Structures
System Functions

0x08 - GetInputInfo - Get informations about an input device
0x09 - GetOutputInfo - Get informations about an output device
0x00 - RegisterInput - Register an input device

0x01 - RegisterOutput - Register an output device
0x02 - SendEvent - Send an event to a task
User Functions

0x03 - UFlushEventQueue - Remove events from the event queue
0x04 - UGetInputInfo - Get informations about an input device
0x05 - UGetOutputInfo - Get informations about an output device

0x06 - USetFocus - Set the task that has input focus
0x07 - UWaitEvent - Wait an event

Description

This page describes the InterManager interface which provides functions to manage the system interface (receive events from input devices and forwarding them to tasks, provide informations about IO devices, etc).

The model used for user data input is the event model, that is, each pressed key, each mouse movement, is an event to be forward to a task.

Each input device has a task with focus and all events are forward to the task that has the focus.

Tasks can write to output devices in any order, there's no focus.

Every created task inherits all input and output devices from the parent task.

Each input device must implement the InputDev interface and all output devices must implement the OutputDev interface.

Structures

typedef struct {
    unsigned int type;
    unsigned int data[7];
} InterManager_Event;

data are event specific data.

The following values of type are already in use:

ValueMeaning
0x0000-0x000fUsed by Keyboard interface
0x0010-0x001fUsed by UserModManager interface
typedef struct {
    unsigned short interSize;
    unsigned short impSize;
    char names[1];
} InterManager_InputInfo;

Where interSize it's the size of the name of the interface including the terminating zero, impSize it's the size of the name of the implementation including the terminating zero and names it's the area where the names are, first the name of the interface followed by the name of the implementation.

typedef struct {
    unsigned short interSize;
    unsigned short impSize;
    char names[1];
} InterManager_OutputInfo;

Where interSize it's the size of the name of the interface including the terminating zero, impSize it's the size of the name of the implementation including the terminating zero and names it's the area where the names are, first the name of the interface followed by the name of the implementation.

System Functions

These functions are exclusive for system modules.

0x08 - GetInputInfo

Syntax

int InterManager_GetInputInfo(unsigned int index, InterManager_InputInfo *info, unsigned int size);

Properties

Description

This function gets informations about the input device index used by the caller task.

index starts with zero and should be incremented on each call.

size it's the total size of info.

In case of success, info will be filled with the informations about the input device.

Return value

0x09 - GetOutputInfo

Syntax

int InterManager_GetOutputInfo(InterManager_OutputInfo *info, unsigned int size);

Properties

Description

This function gets informations about the output device used by the caller task.

size it's the total size of info.

In case of success, info will be filled with the informations about the output device.

Return value

0x00 - RegisterInput

Syntax

int InterManager_RegisterInput(TaskManager_Task *task, const char *imp);

Properties

Description

This function registers device imp, that must implement the InputDev interface, to task.

If task is NULL, will register to caller task.

task will have device focus if it doesn't has a task with focus.

Return value

0x01 - RegisterOutput

Syntax

int InterManager_RegisterOutput(TaskManager_Task *task, const char *imp);

Properties

Description

This function registers device imp, that must implement the OutputDev interface, to task.

If task is NULL, will register to caller task.

Only one output device can be registered to a task.

Return value

0x02 - SendEvent

Syntax

int InterManager_SendEvent(TaskManager_Task *task, const InterManager_Event *event);

Properties

Description

This function sends event to task.

If task is NULL, sends to caller task.

This function doesn't free event.

Return value

User Functions

These functions were designed for user modules.

0x03 - UFlushEventQueue

Syntax

void InterManager_UFlushEventQueue(int mask);

Properties

User modules

Description

This function removes all events from event queue where mask & event type is zero.

For instance: to remove all keyboard events mask must be 0xfffffff0.

Return value

Nothing.

0x04 - UGetInputInfo

Syntax

int InterManager_UGetInputInfo(unsigned int index, InterManager_InputInfo *info, unsigned int size);

Properties

User modules

Description

The same of GetInputInfo.

Return value

The same of GetInputInfo.

0x05 - UGetOutputInfo

Syntax

int InterManager_UGetOutputInfo(InterManager_OutputInfo *info, unsigned int size);

Properties

User modules

Description

The same of GetOutputInfo.

Return value

The same of GetOutputInfo.

0x06 - USetFocus

Syntax

int InterManager_USetFocus(int task);

Properties

User modules

Description

This functions sets the focus of all input devices of the caller task to task.

task must have the same input devices that has the caller task.

Return value

0x07 - UWaitEvent

Syntax

int InterManager_UWaitEvent(InterManager_Event *event, int prop);

Properties

User modules

Description

This function waits for an event. prop says what happens if there's no events.

prop must be 0 or:

If all goes ok, event will contain the event.

Return value