00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef POWERSAVE_DBUS_SERVER_H
00026 #define POWERSAVE_DBUS_SERVER_H
00027 #define DBUS_API_SUBJECT_TO_CHANGE 1
00028
00029 #define DBUS_NM_SERVICE "org.freedesktop.NetworkManager"
00030 #define DBUS_NM_INTERFACE "org.freedesktop.NetworkManager"
00031 #define DBUS_NM_PATH "/org/freedesktop/NetworkManager"
00032 #define DBUS_HAL_MANAGER_INTERFACE "org.freedesktop.Hal.Manager"
00033 #define DBUS_HAL_DEVICE_INTERFACE "org.freedesktop.Hal.Device"
00034
00035 #include "powersave_dbus.h"
00036
00037 #include <dbus/dbus-glib.h>
00038 #include <dbus/dbus-glib-lowlevel.h>
00039
00040 #include <string>
00041
00042 class PM_Interface;
00043
00051 class DBus_Server {
00052 public:
00053 DBus_Server();
00054 ~DBus_Server();
00055
00063 static DBusConnection *openSystemConnection();
00064
00072 static int emitSignal(const char *signal, const char *value);
00073
00083 static bool sendMethodCall(const char *interface, const char *path,
00084 const char *object, const char* method);
00085
00092 static bool serviceHasOwner(const std::string &service);
00093
00098 static gboolean dbus_reconnect();
00099 static DBusConnection* _connection;
00100 private:
00101 static DBusHandlerResult filter_function(DBusConnection * conn, DBusMessage * msg, void *data);
00102
00103 static void sendReply(DBusMessage * reply, int error_id);
00104 };
00105
00106 #endif // POWERSAVE_DBUS_SERVER_H