[open]lipc
Open-source LIPC header file
|
Listening for and emitting events. More...
Typedefs | |
typedef void | LIPCevent |
typedef LIPCcode(* | LipcEventCallback) (LIPC *lipc, const char *name, LIPCevent *event, void *data) |
Listening for and emitting events.
typedef void LIPCevent |
LIPC event handler.
Event dispatching callback function.
lipc | LIPC library handler. |
name | The event name. |
event | The LIPC event handler. |
data | Data pointer passed during subscription. |
Create a new event object.
In order to use this function the LIPC handler has to be opened with the service name given using LipcOpen() or LipcOpenEx().
lipc | LIPC library handler. |
name | The event name. |
void LipcEventFree | ( | LIPCevent * | event | ) |
Free memory allocated by the LIPC.
event | LIPC event handler. |
Send event object.
lipc | LIPC library handler. |
event | LIPC event handler. |
Create and send event.
This function is an equivalent of using LipcNewEvent(), LipcSendEvent() and LipcEventFree() all together. If you want to send a simple event object - one without any parameters - use this function.
lipc | LIPC library handler. |
name | The event name. |
LIPCcode LipcCreateAndSendEventWithParameters | ( | LIPC * | lipc, |
const char * | name, | ||
const char * | format, | ||
... | |||
) |
Create and send event.
This function creates an event object and sets its parameters according to the format string. This function takes variable number of arguments.
LIPC supports two kinds of event parameters: integers and strings. It is possible to specify both of these types via the format string in the same way the printf() function family does. The format string can contain any number of "%d" or/and "%s" conversion specifiers. It is also possible to pass an empty string in the format argument, which will be an equivalent of calling the LipcCreateAndSendEvent().
The format string also supports the ".0" precision modifier. However, its purpose is yet to be discovered.
lipc | LIPC library handler. |
name | The event name. |
format | The format string. |
... | Variable list of parameters. |
LIPCcode LipcCreateAndSendEventWithVAListParameters | ( | LIPC * | lipc, |
const char * | name, | ||
const char * | format, | ||
va_list | ap | ||
) |
Create and send event.
This function creates an event object and sets its parameters according to the format string. Parameter values should be passed as a variable argument list. For the list of all supported formats, see the documentation of the LipcCreateAndSendEventWithParameters() function.
lipc | LIPC library handler. |
name | The event name. |
format | The format string. |
ap | Variable argument list. |
const char* LipcGetEventSource | ( | LIPCevent * | event | ) |
Get the source name associated with the event.
event | LIPC event handler. |
const char* LipcGetEventName | ( | LIPCevent * | event | ) |
Get the name of the event.
event | LIPC event handler. |
Get the integer parameter from the event.
event | LIPC event handler. |
value | The address where the integer value will be stored. |
Add the integer parameter to the event.
event | LIPC event handler. |
value | The new value to add. |
Get the string parameter from the event.
event | LIPC event handler. |
value | The address where the pointer to the string will be stored. |
Add the string parameter to the event.
event | LIPC event handler. |
value | The new value to add. |
Rewind parameters of the event.
event | LIPC event handler. |
LIPCcode LipcSetEventCallback | ( | LIPC * | lipc, |
LipcEventCallback | callback | ||
) |
Set default event callback function.
The callback function will be called when one uses the LipcSubscribe() subscription mechanism. Note, that it is not possible to pass user-defined data via this approach - if one wants to pass extra data to the callback function, one should use the LipcSubscribeExt() instead.
lipc | LIPC library handler. |
callback | Event dispatching callback function. |
Subscribe for all events emitted by the service.
In order to receive event notifications, one has to set default callback function using the LipcSetEventCallback() function. Using them both, is an equivalent of using the extended version with parameters set as follows: LipcSubscribeExt(lipc, service, NULL, callback, NULL)
lipc | LIPC library handler. |
service | The service name. |
LIPCcode LipcSubscribeExt | ( | LIPC * | lipc, |
const char * | service, | ||
const char * | name, | ||
LipcEventCallback | callback, | ||
void * | data | ||
) |
Subscribe for events emitted by the service.
This function is an extended version of the LipcSubscribe(), which allows to set the event name for which one wants to subscribe and the user-defined data passed to the callback function. Passing NULL instead of the event name will subscribe for all events.
lipc | LIPC library handler. |
service | The service name. |
name | The event name. |
callback | Event dispatching callback function. |
data | Data pointer passed to the callback function. |
Unsubscribe from event or events.
If the event name is NULL, this function will unsubscribe from events delivered to the callback set with the LipcSetEventCallback().
lipc | LIPC library handler. |
service | The service name. |
name | The event name or NULL. |
data | Address where the data pointer is returned or NULL. |