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 |
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.
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:
Value | Meaning |
---|---|
0x0000-0x000f | Used by Keyboard interface |
0x0010-0x001f | Used 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.
These functions are exclusive for system modules.
int InterManager_GetInputInfo(unsigned int index, InterManager_InputInfo *info, unsigned int size);
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.
int InterManager_GetOutputInfo(InterManager_OutputInfo *info, unsigned int size);
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.
int InterManager_RegisterInput(TaskManager_Task *task, const char *imp);
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.
int InterManager_RegisterOutput(TaskManager_Task *task, const char *imp);
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.
int InterManager_SendEvent(TaskManager_Task *task, const InterManager_Event *event);
This function sends event to task.
If task is NULL, sends to caller task.
This function doesn't free event.
These functions were designed for user modules.
void InterManager_UFlushEventQueue(int mask);
User modules
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.
int InterManager_UGetInputInfo(unsigned int index, InterManager_InputInfo *info, unsigned int size);
User modules
The same of GetInputInfo.
The same of GetInputInfo.
int InterManager_UGetOutputInfo(InterManager_OutputInfo *info, unsigned int size);
User modules
The same of GetOutputInfo.
The same of GetOutputInfo.
int InterManager_USetFocus(int task);
User modules
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.
int InterManager_UWaitEvent(InterManager_Event *event, int prop);
User modules
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.