|
From: Zaheer M. <za...@gr...> - 2001-11-05 18:29:37
|
I have just completed the asynchronous model framework for PreViking
drivers. This framework is driver-independent and is in the
drivers/common directory of the CVS.
Using this framework, porting drivers to support the asynchronous model
is trivial.
What is required in the driver is one function of the form:
typedef void (*pvAsyncDriverCommand)(struct pvChannel*,
struct pvAsyncModelCommand*);
where pvAyncModelCommand is:
struct pvAsyncModelCommand
{
gint type;
GHashTable *params;
struct pvAsyncModelChannel* chan;
};
type is an integer specifying the type of the command.
params is a hash table with the parameters that the command requires (I
will define these soon, on a per command basis).
chan is unimportant and can be ignored by the driver.
The function would have to start the execution of the command
represented by the pvAsyncModelCommand, and that is all so here is an
example function:
void dummyDriverCommand(struct pvChannel* pvchan,
struct pvAsyncModelCommand* command)
{
switch (command->type) {
case PV_ASYNC_COMMAND_PLACECALL:
dummyPlaceCall(pvchan,(gchar*)g_hash_table_lookup(
command->params,"dialnumber"),
(gchar*)g_hash_table_lookup(
command->params,"callingnumber"));
break;
....
}
}
More details can be found by asking me or looking at the code.
Zaheer
|