contextc.h File Reference

#include <stdlib.h>
#include <dbus/dbus.h>

Go to the source code of this file.

Typedefs

typedef void(* ContextProviderSubscriptionChangedCallback )(int subscribe, void *user_data)

Functions

int context_provider_init (DBusBusType bus_type, const char *bus_name)
 Initializes and starts the service with a given bus_type and a bus_name.
void context_provider_stop (void)
 Stops the currently started service with context_provider_init.
void context_provider_install_key (const char *key, int clear_values_on_subscribe, ContextProviderSubscriptionChangedCallback subscription_changed_cb, void *subscription_changed_cb_target)
 Installs (adds) a key to be provided by the service.
void context_provider_install_group (char *const *key_group, int clear_values_on_subscribe, ContextProviderSubscriptionChangedCallback subscription_changed_cb, void *subscription_changed_cb_target)
 Installs (adds) a key_group to be provided by the service.
void context_provider_set_integer (const char *key, int value)
 Sets the key to a specified integer value.
void context_provider_set_double (const char *key, double value)
 Sets the key to a specified double value.
void context_provider_set_boolean (const char *key, int value)
 Sets the key to a specified boolean value.
void context_provider_set_string (const char *key, const char *value)
 Sets the key to a specified string value.
void context_provider_set_null (const char *key)
 Sets the key to NULL. In other words - unsets the key.
void context_provider_set_map (const char *key, void *map, int free_map)
 Sets the value of key to the specified map.
void * context_provider_map_new ()
 Creates an opaque map for use with the context_provider_map_set_* family of functions.
void context_provider_map_free (void *map)
 Free the map created by context_provider_map_new().
void context_provider_map_set_integer (void *map, const char *key, int value)
 Sets key to the integer value in map.
void context_provider_map_set_double (void *map, const char *key, double value)
 Sets key to the double value in map.
void context_provider_map_set_boolean (void *map, const char *key, int value)
 Sets key to the boolean value in map.
void context_provider_map_set_string (void *map, const char *key, const char *value)
 Sets key to the string value in map.
void context_provider_map_set_map (void *map, const char *key, void *value)
 Sets key to the map value in map.
void context_provider_map_set_list (void *map, const char *key, void *value)
 Sets key to the list value in map.
void context_provider_set_list (const char *key, void *list, int free_list)
 Sets the value of key to the specified list.
void * context_provider_list_new ()
 Creates an opaque list for use with the context_provider_list_add_* family of functions.
void context_provider_list_free (void *list)
 Frees the list created by context_provider_list_new().
void context_provider_list_add_integer (void *list, int value)
 Appends the integer value to list.
void context_provider_list_add_double (void *list, double value)
 Appends the double value to list.
void context_provider_list_add_boolean (void *list, int value)
 Appends the boolean value to list.
void context_provider_list_add_string (void *list, const char *value)
 Appends the string value to list.
void context_provider_list_add_map (void *list, void *value)
 Appends the specified map (value) to list.
void context_provider_list_add_list (void *list, void *value)
 Appends the specified list value to list.

Typedef Documentation

typedef void(* ContextProviderSubscriptionChangedCallback)(int subscribe, void *user_data)

Function Documentation

int context_provider_init ( DBusBusType  bus_type,
const char *  bus_name 
)

Initializes and starts the service with a given bus_type and a bus_name.

The bus_type can be DBUS_BUS_SESSION or DBUS_BUS_SYSTEM. This function can be called only once till a matching context_provider_stop is called.

void context_provider_install_group ( char *const *  key_group,
int  clear_values_on_subscribe,
ContextProviderSubscriptionChangedCallback  subscription_changed_cb,
void *  subscription_changed_cb_target 
)

Installs (adds) a key_group to be provided by the service.

The key_group is a NULL-terminated array containing the keys. The callback function subscription_changed_cb will be called with the passed user data subscription_changed_cb_target when the status of the subscription changes -- when the first subscriber appears or the last subscriber disappears. The clear_values_on_subscribe when enabled will automatically clear (set to null/undetermined) the group keys on first subscribe.

void context_provider_install_key ( const char *  key,
int  clear_values_on_subscribe,
ContextProviderSubscriptionChangedCallback  subscription_changed_cb,
void *  subscription_changed_cb_target 
)

Installs (adds) a key to be provided by the service.

The callback function subscription_changed_cb will be called with the passed user data subscription_changed_cb_target when the status of the subscription changes -- when the first subscriber appears or the last subscriber disappears. The clear_values_on_subscribe when enabled will automatically clear (set to null/undetermined) the group keys on first subscribe.

void context_provider_list_add_boolean ( void *  list,
int  value 
)

Appends the boolean value to list.

void context_provider_list_add_double ( void *  list,
double  value 
)

Appends the double value to list.

void context_provider_list_add_integer ( void *  list,
int  value 
)

Appends the integer value to list.

void context_provider_list_add_list ( void *  list,
void *  value 
)

Appends the specified list value to list.

NOTE: value is freed, and becomes invalid after this call.

void context_provider_list_add_map ( void *  list,
void *  value 
)

Appends the specified map (value) to list.

NOTE: value is freed and becomes invalid after this call.

void context_provider_list_add_string ( void *  list,
const char *  value 
)

Appends the string value to list.

void context_provider_list_free ( void *  list  ) 

Frees the list created by context_provider_list_new().

Use context_provider_list_free() to free it.

void* context_provider_list_new (  ) 

Creates an opaque list for use with the context_provider_list_add_* family of functions.

Free it with context_provider_list_free().

void context_provider_map_free ( void *  map  ) 

Free the map created by context_provider_map_new().

void* context_provider_map_new (  ) 

Creates an opaque map for use with the context_provider_map_set_* family of functions.

Free it with context_provider_map_free().

void context_provider_map_set_boolean ( void *  map,
const char *  key,
int  value 
)

Sets key to the boolean value in map.

void context_provider_map_set_double ( void *  map,
const char *  key,
double  value 
)

Sets key to the double value in map.

void context_provider_map_set_integer ( void *  map,
const char *  key,
int  value 
)

Sets key to the integer value in map.

void context_provider_map_set_list ( void *  map,
const char *  key,
void *  value 
)

Sets key to the list value in map.

NOTE: value is freed, and becomes invalid after this call.

void context_provider_map_set_map ( void *  map,
const char *  key,
void *  value 
)

Sets key to the map value in map.

NOTE: value is freed, and becomes invalid after this call.

void context_provider_map_set_string ( void *  map,
const char *  key,
const char *  value 
)

Sets key to the string value in map.

void context_provider_set_boolean ( const char *  key,
int  value 
)

Sets the key to a specified boolean value.

void context_provider_set_double ( const char *  key,
double  value 
)

Sets the key to a specified double value.

void context_provider_set_integer ( const char *  key,
int  value 
)

Sets the key to a specified integer value.

void context_provider_set_list ( const char *  key,
void *  list,
int  free_list 
)

Sets the value of key to the specified list.

If free_list is TRUE, the list is freed.

See also:
context_provider_list_new, context_provider_list_add_*
void context_provider_set_map ( const char *  key,
void *  map,
int  free_map 
)

Sets the value of key to the specified map.

If free_map is TRUE, frees the map, which becomes invalid afterwards.

See also:
context_provider_map_new, context_provider_map_set_*
void context_provider_set_null ( const char *  key  ) 

Sets the key to NULL. In other words - unsets the key.

void context_provider_set_string ( const char *  key,
const char *  value 
)

Sets the key to a specified string value.

void context_provider_stop ( void   ) 

Stops the currently started service with context_provider_init.

After calling this function a new service can be started by calling context_provider_init.


Generated on Thu Nov 26 11:45:56 2009 for libcontextprovider by  doxygen 1.6.1