D-Bus helper functions
[Support libraries]


Classes

struct  icd_dbus_unique_name_data
struct  icd_dbus_mcall_table
struct  icd_dbus_sig_table
struct  icd_dbus_prop_table

Typedefs

typedef void(* icd_dbus_get_unique_name_cb_fn )(const gchar *name, const gchar *id, gpointer user_data)

Functions

static DBusConnection * icd_dbus_get_system_bus (void)
static gboolean icd_dbus_connect_path (DBusConnection *connection, const char *path, DBusObjectPathMessageFunction cb, void *user_data)
gboolean icd_dbus_connect_system_path (const char *path, DBusObjectPathMessageFunction cb, void *user_data)
gboolean icd_dbus_disconnect_system_path (const char *path)
gboolean icd_dbus_connect_system_bcast_signal (const char *interface, DBusHandleMessageFunction cb, void *user_data, const char *extra_filters)
gboolean icd_dbus_disconnect_system_bcast_signal (const char *interface, DBusHandleMessageFunction cb, void *user_data, const char *extra_filters)
static gboolean icd_dbus_register_service (DBusConnection *connection, const char *path, const char *service, guint service_flags, DBusObjectPathMessageFunction cb, void *user_data)
gboolean icd_dbus_register_system_service (const char *path, const char *service, guint service_flags, DBusObjectPathMessageFunction cb, void *user_data)
static void icd_dbus_unregister_service (DBusConnection *connection, const char *path, const char *service)
void icd_dbus_unregister_system_service (const char *path, const char *service)
static DBusPendingCall * icd_dbus_mcall_send (DBusConnection *connection, DBusMessage *mcall, gint timeout, DBusPendingCallNotifyFunction cb, void *user_data)
DBusPendingCall * icd_dbus_send_system_mcall (DBusMessage *message, gint timeout, DBusPendingCallNotifyFunction cb, void *user_data)
static gboolean icd_dbus_send_msg (DBusConnection *connection, DBusMessage *message)
gboolean icd_dbus_send_system_msg (DBusMessage *message)
static GSList ** icd_dbus_get_unique_name_list (void)
void icd_dbus_cancel_unique_name (DBusPendingCall *pending)
static void icd_dbus_get_unique_reply (DBusPendingCall *pending, gpointer user_data)
gboolean icd_dbus_get_unique_name (const gchar *name, icd_dbus_get_unique_name_cb_fn cb, gpointer user_data)
void icd_dbus_close (void)

Variables

static DBusConnection * dbus_system_connection = NULL

Typedef Documentation

typedef void(* icd_dbus_get_unique_name_cb_fn)(const gchar *name, const gchar *id, gpointer user_data)

Callback function for receiving the unique D-Bus id

Parameters:
name D-Bus service name
id D-Bus id
user_data user data


Function Documentation

void icd_dbus_cancel_unique_name ( DBusPendingCall *  pending  ) 

Cancel the unique name pending call

Parameters:
pending the pending call or NULL to cancel all

References icd_dbus_get_unique_name_list().

Referenced by icd_dbus_close(), and icd_dbus_get_unique_reply().

void icd_dbus_close ( void   ) 

Close D-Bus system bus.

References dbus_system_connection, and icd_dbus_cancel_unique_name().

static gboolean icd_dbus_connect_path ( DBusConnection *  connection,
const char *  path,
DBusObjectPathMessageFunction  cb,
void *  user_data 
) [static]

Helper function for connecting D-Bus paths to callbacks.

Parameters:
connection the D-Bus bus to connect to
path the D-Bus signal path to connect
cb the callback function to call when any signal is received
user_data user data passed to the callback function
Returns:
TRUE on success, FALSE on failure

References ILOG_ERR.

Referenced by icd_dbus_connect_system_path(), and icd_dbus_register_service().

gboolean icd_dbus_connect_system_bcast_signal ( const char *  interface,
DBusHandleMessageFunction  cb,
void *  user_data,
const char *  extra_filters 
)

Function for connecting a callback to receive broadcast signals.

Note:
Since the broadcast reception is implemented as a filter for the specified interface, all sorts of D-Bus actions related to that interface will be captured. It is safe to return DBUS_HANDLER_RESULT_NOT_YET_HANDLED for unknown actions involving the callback.
Parameters:
interface the interface name of the broadcasted signal
cb the DBusHandleMessageFunction callback for receiving messages
user_data user data to be supplied to the callback function
extra_filters other filters to be included in the match or NULL
Returns:
TRUE on success, FALSE on failure

References icd_dbus_get_system_bus(), and ILOG_ERR.

Referenced by icd_name_owner_add_filter(), icd_osso_ic_init(), and icd_policy_init().

gboolean icd_dbus_connect_system_path ( const char *  path,
DBusObjectPathMessageFunction  cb,
void *  user_data 
)

Helper function for connecting D-Bus system bus paths to callbacks. Unregister with dbus_connection_unregister_object_path().

Parameters:
path the D-Bus signal path to connect
cb the callback function to call when any signal is received
user_data user data passed to the callback function
Returns:
TRUE on success, FALSE on failure

References icd_dbus_connect_path(), icd_dbus_get_system_bus(), and ILOG_ERR.

gboolean icd_dbus_disconnect_system_bcast_signal ( const char *  interface,
DBusHandleMessageFunction  cb,
void *  user_data,
const char *  extra_filters 
)

Function for disconnecting a broadcast signal callback function

Note:
In the D-Bus documentation it is noted that it is a programming error to try to remove a callback function and user data that has not been added previously, in this case with 'icd_dbus_connect_system_bcast_signal()'
Parameters:
interface the interface name of the broadcasted signal
cb the previously added DBusHandleMessageFunction callback
user_data the previously supplied user data
extra_filters other filters to be included in the match or NULL
Returns:
TRUE on successful diconnection, FALSE otherwise

References icd_dbus_get_system_bus(), and ILOG_ERR.

Referenced by icd_name_owner_remove_filter(), icd_osso_ic_deinit(), policy_always_online_destruct(), and policy_change_destruct().

gboolean icd_dbus_disconnect_system_path ( const char *  path  ) 

Helper function for disconnecting a system D-Bus path

Parameters:
path path
Returns:
TRUE on success, FALSE on failure

References icd_dbus_get_system_bus().

static DBusConnection* icd_dbus_get_system_bus ( void   )  [static]

gboolean icd_dbus_get_unique_name ( const gchar *  name,
icd_dbus_get_unique_name_cb_fn  cb,
gpointer  user_data 
)

Get the unique D-Bus bus name for a service

Parameters:
name D-Bus service name
cb callback
user_data user data
Returns:
the D-Bus pending call for the request
Get the unique D-Bus bus name for a service
Parameters:
name D-Bus service name
cb callback
user_data user data
Returns:
TRUE on success, FALSE on failure

References icd_dbus_get_unique_name_list(), icd_dbus_get_unique_reply(), icd_dbus_send_system_mcall(), and ILOG_ERR.

static GSList** icd_dbus_get_unique_name_list ( void   )  [static]

Get the static unique name request list

Returns:
the list

Referenced by icd_dbus_cancel_unique_name(), and icd_dbus_get_unique_name().

static void icd_dbus_get_unique_reply ( DBusPendingCall *  pending,
gpointer  user_data 
) [static]

Handle 'GetNameOwner' reply

Parameters:
pending the pending call
user_data callback data

References icd_dbus_cancel_unique_name().

Referenced by icd_dbus_get_unique_name().

static DBusPendingCall* icd_dbus_mcall_send ( DBusConnection *  connection,
DBusMessage *  mcall,
gint  timeout,
DBusPendingCallNotifyFunction  cb,
void *  user_data 
) [static]

Helper function for sending a D-Bus method call message used by the 'icd_dbus_send_message()' and 'icd_dbus_send_session_method_call()' functions. The auto activation flag will also be set in the D-Bus message.

Parameters:
connection the D-Bus session/system bus connection to use
mcall the D-Bus method call message to send
timeout reply timeout in milliseconds or -1 for D-Bus default value
cb callback function for the pending call, if NULL no callback will be set
user_data user data to pass to the callback
Returns:
TRUE on success, FALSE on failure

References ILOG_ERR.

Referenced by icd_dbus_send_system_mcall().

static gboolean icd_dbus_register_service ( DBusConnection *  connection,
const char *  path,
const char *  service,
guint  service_flags,
DBusObjectPathMessageFunction  cb,
void *  user_data 
) [static]

Helper function for registering a D-Bus service.

Parameters:
connection the dbus connection
path the D-Bus signal path to connect.
service the service to provide
service_flags D-Bus service flags
cb the callback function to call when any signal is received
user_data user data passed to the callback function
Returns:
TRUE on success, FALSE on failure

References icd_dbus_connect_path(), and ILOG_ERR.

Referenced by icd_dbus_register_system_service().

gboolean icd_dbus_register_system_service ( const char *  path,
const char *  service,
guint  service_flags,
DBusObjectPathMessageFunction  cb,
void *  user_data 
)

Helper function for registering a D-Bus system bus service.

Parameters:
path the D-Bus signal path to connect.
service the service to provide
service_flags D-Bus service flags
cb the callback function to call when any signal is received
user_data user data passed to the callback function
Returns:
TRUE on success, FALSE on failure

References icd_dbus_get_system_bus(), and icd_dbus_register_service().

Referenced by icd_dbus_api_init(), and icd_osso_ic_init().

static gboolean icd_dbus_send_msg ( DBusConnection *  connection,
DBusMessage *  message 
) [static]

Helper function to send the D-Bus message (signal, error, method call reply) over the given bus. Does not unref() the message.

Parameters:
connection the D-Bus system or session connection
message the D-Bus signal to send
Returns:
TRUE if the message was queued for sending, FALSE otherwise

References ILOG_ERR.

Referenced by icd_dbus_send_system_msg().

DBusPendingCall * icd_dbus_send_system_mcall ( DBusMessage *  message,
gint  timeout,
DBusPendingCallNotifyFunction  cb,
void *  user_data 
)

Function for sending a system D-Bus method call message

Parameters:
message the D-Bus method call message to send
timeout reply timeout in milliseconds or -1 for D-Bus default value
cb callback function for the pending call, if NULL no callback will be set
user_data user data to pass to the callback
Returns:
a D-Bus pending call if a callback function is given and the method call is successfully sent, NULL otherwise; the pending call returned is referenced, the caller must unreference it after use

References icd_dbus_get_system_bus(), and icd_dbus_mcall_send().

Referenced by icd_dbus_get_unique_name(), icd_osso_ic_shutdown(), icd_osso_ui_send_retry(), icd_osso_ui_send_save(), policy_always_online_flightmode_init(), policy_change_confirm(), policy_iap_ask_flightmode(), and policy_iap_ask_request().

gboolean icd_dbus_send_system_msg ( DBusMessage *  message  ) 

static void icd_dbus_unregister_service ( DBusConnection *  connection,
const char *  path,
const char *  service 
) [static]

Helper function for unregistering a service

Parameters:
connection the D-Bus connection
path object path
service registered service name

References ILOG_ERR.

Referenced by icd_dbus_unregister_system_service().

void icd_dbus_unregister_system_service ( const char *  path,
const char *  service 
)

Helper function for unregistering a D-Bus system bus service

Parameters:
path object path
service registered service name

References icd_dbus_get_system_bus(), and icd_dbus_unregister_service().

Referenced by icd_dbus_api_deinit(), icd_osso_ic_deinit(), and icd_osso_ic_init().


Variable Documentation

DBusConnection* dbus_system_connection = NULL [static]

D-Bus connection

Referenced by icd_dbus_close(), and icd_dbus_get_system_bus().


Generated on Thu Mar 11 09:04:50 2010 for ICd2 by  doxygen 1.5.6