Main Page | Data Structures | File List | Data Fields | Globals

rpc-dbus.h

Go to the documentation of this file.
00001 /**
00002  * This file is part of alarmd
00003  *
00004  * Contact Person: David Weinehall <david.weinehall@nokia.com>
00005  *
00006  * Copyright (C) 2006 Nokia Corporation
00007  * alarmd and libalarm are free software; you can redistribute them
00008  * and/or modify them under the terms of the GNU Lesser General Public
00009  * License version 2.1 as published by the Free Software Foundation.
00010  *
00011  * alarmd and libalarm are distributed in the hope that they will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this software; if not, write to the Free
00018  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00019  * 02110-1301 USA
00020  */
00021 
00022 #ifndef _RPC_DBUS_H_
00023 #define _RPC_DBUS_H_
00024 
00025 #include <glib/gtypes.h>
00026 #include <libosso.h>
00027 #include <dbus/dbus.h>
00028 
00029 /**
00030  * SECTION:rpc-dbus
00031  * @short_description: Helpers for sending dbus messages and for wathching
00032  * for services.
00033  *
00034  * These functions are helpers for dbus communication.
00035  **/
00036 
00037 /**
00038  * DBusNameNotifyCb:
00039  * @user_data: user data set when the signal handler was connected.
00040  *
00041  * Callback to be called when a watched name changes owner.
00042  **/
00043 typedef void (*DBusNameNotifyCb)(gpointer user_data);
00044 
00045 /**
00046  * dbus_do_call:
00047  * @bus: #DBusConnection to make the method call on.
00048  * @reply: Location to store reply or NULL for no replies.
00049  * @activation: Should the receiver be started if necessary.
00050  * @service: Service to be called.
00051  * @path: Path to be called.
00052  * @interface: Interface to be called.
00053  * @name: Name of the method call.
00054  * @first_arg_type: Type of the first argument.
00055  * @...: Value of first argument, type of second argument...
00056  *
00057  * Does a method call over dbus. End the list of argument type / value pairs
00058  * with a DBUS_TYPE_INVALID. The argument values must be passed by pointer.
00059  **/
00060 void dbus_do_call(DBusConnection *bus, DBusMessage **reply, gboolean activation, const gchar *service, const gchar *path, const gchar *interface, const gchar *name, int first_arg_type, ...);
00061 
00062 /**
00063  * dbus_watch_name:
00064  * @name: Name to watch.
00065  * @cb: Callback to call when name changes owner.
00066  * @user_data: user data to pass to the @cb.
00067  *
00068  * Watches the name, when it changes owner, cb will be called.
00069  **/
00070 void dbus_watch_name(const gchar *name, DBusNameNotifyCb cb, gpointer user_data);
00071 /**
00072  * dbus_unwatch_name:
00073  * @name: Name to stop watching.
00074  * @cb: Callback that should no longer be called.
00075  * @user_data: user data to pass to the @cb.
00076  *
00077  * Stops watching for owner changes of @name.
00078  **/
00079 void dbus_unwatch_name(const gchar *name, DBusNameNotifyCb cb, gpointer user_data);
00080 
00081 /**
00082  * dbus_set_osso:
00083  * @osso: osso context to get connections from.
00084  *
00085  * Sets a singleton osso context that is used to get dbus connections wherever
00086  * they are needed, See #get_dbus_connection.
00087  **/
00088 void dbus_set_osso(osso_context_t *osso);
00089 
00090 /**
00091  * get_dbus_connection:
00092  * @type DBUS_BUS_SESSION for session bus or DBUS_TYPE_SYSTEM for system bus.
00093  *
00094  * Gets system or session bus from the osso context registered with
00095  * #dbus_set_osso. #dbus_set_osso _must_ be called before this can be called.
00096  * Returns: A dbus connection to the bus specified by @type. Callers owns a
00097  * reference, unref with dbus_connection_unref.
00098  **/
00099 DBusConnection *get_dbus_connection(DBusBusType type);
00100 
00101 #endif /* _RPC_DBUS_H_ */

Generated on Thu Dec 21 18:23:30 2006 for Alarmd by  doxygen 1.4.2