gpe-phone: LiPS Event Lib
1 Introduction
1.1 Brief
introduction
1.2 Dependency
2 Overview
3 Design and
Concepts
4 Package Map
1 Introduction
1.1 Brief
introduction
This package gives a framework to implement LiPS event model.
1.2 Dependency
LiPS event lib depends on the following libraries:
- Gtk+-2.0
The GTK+ library contains widgets, that is, GUI components
such as GtkButton or GtkTextView.
2 Overview
LiPS Event lib defines the event structure that was described LiPS
Event programming model. It supports both asynchronous event &
unsolicited event models.
- Structure definitions
Event lib defines an evt_t structure to represent an event. The
evt_handler_t structure will be used to store the callback function
that will be invoked when an event happens. For asynchronous
event, evt_async_t structure is defined for storing the asynchronous
request data.
Another importance is session. All the events happen in certain
sessions which are identified by a sid_t value.
- Asynchronous event model
Asynchronous event is caused by applications, and it's identified by
rid (request id) which should be unique in then same session. This
package provide functions to store the rid with it related handler, and
retrieve the handler by session id & rid.
- Unsolicited event model
Unsolicited event is caused by external reason, such as network, modem
or even other applications. This package provides a set of functions to
register / unregister a handler to an event type, and retrieve the
handler by session & event type.
- Event process
Event processing is also standardized in LiPS programming model. Event
can be gotten from an event source. Then call the related callback
function to notify the application. Finally, the event structure should
be released.
This package offers functions and structure to facilitate LiPS enabler
development. So it should be only used by enabler developers but not by
application developers.
3 Design
and Concepts
This section explains what you should know as a programmer for LiPS
enabler development with LiPS event model.
Event is defined as the way that Application communicates with
enablers. All the events happen in certain sessions. Session is a
component recording execution context. Session is identified by sid_t
type.
Asynchronous event is caused from an asynchronous request. When
asynchronous request function is invoked, a callback function must be
provided. A rid will be generated from enabler. With this package, the
callback function with the rid & sid will be stored in a hash
table.
Unsolicited event comes from outside of the application. Programmer
must to register the event type before retrieving it. To register an
event type, a callback function also should be provided. The package
offers a function to store the session id & event type with the
callback function in another hash table.
When event happens, enabler will use evt_get function to build an evt_t
structure. In fact, evt_get is just a function pointer which point to a
real function provide by enabler developers, since different enabler
have different method to get event. To build the event structure,
enabler can use the functions from this package to retrieve the handler
for the event (callback function) by the rid or event type.
After get an event structure was build, the callback function will be
called by invoking the evt_call function in this package. In this way,
the application will be notified. When the callback function returns,
the event structure should be released by evt_release. If the
event is an asynchronous event, the handler should be removed from the
hash table as well.
We provides a evt_process function to combine the evt_get, evt_call and
evt_release.
If application unregister an unsolicited event, the handler should be
removed from the hash table.
4 Package
Map
- include:
the directory contains the
head files.
- evt_type.h
some typedefs
- event.h
event structure &
functions
- src:
the directory contains the source
code of application.
- event.c:
the implementation.