frameworkd-glib-dbus: don't call deprecated g_type_init for glib-2.35* and newer
[libframeworkd-glib.git] / src / ousaged / frameworkd-glib-ousaged.h
blob082285a4429a34d3fea0035b9094b1063fb9e08e
1 /*
2 * Copyright (C) 2008
3 * Authors (alphabetical) :
4 * quickdev
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Public License as published by
8 * the Free Software Foundation; version 2 of the license.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser Public License for more details.
16 #ifndef FRAMEWORKD_GLIB_OUSAGED_H
17 #define FRAMEWORKD_GLIB_OUSAGED_H
19 #include <glib.h>
20 #include <dbus/dbus-glib.h>
22 G_BEGIN_DECLS
23 #define USAGE_ERROR g_quark_from_static_string(USAGE_INTERFACE)
24 #define IS_USAGE_ERROR(error, code) g_error_matches(error, USAGE_ERROR, code)
25 #define DBUS_USAGE_ERROR_POLICY_UNKNOWN "org.freesmartphone.Usage.PolicyUnknown"
26 #define DBUS_USAGE_ERROR_POLICY_DISABLED "org.freesmartphone.Usage.PolicyDisabled"
27 #define DBUS_USAGE_ERROR_RESOURCE_UNKNOWN "org.freesmartphone.Usage.ResourceUnknown"
28 #define DBUS_USAGE_ERROR_RESOURCE_EXISTS "org.freesmartphone.Usage.ResourceExists"
29 #define DBUS_USAGE_ERROR_RESOURCE_IN_USE "org.freesmartphone.Usage.ResourceInUse"
30 #define DBUS_USAGE_ERROR_USER_EXISTS "org.freesmartphone.Usage.UserExists"
31 #define DBUS_USAGE_ERROR_USER_UNKNOWN "org.freesmartphone.Usage.UserUnknown"
32 #define RESOURCE_ERROR g_quark_from_static_string(RESOURCE_INTERFACE)
33 #define IS_RESOURCE_ERROR(error, code) g_error_matches(error, RESOURCE_ERROR, code)
34 #define DBUS_RESOURCE_ERROR_NOT_ENABLED "org.freesmartphone.Resource.NotEnabled"
35 typedef enum {
36 USAGE_ERROR_POLICY_UNKNOWN = -1,
37 USAGE_ERROR_POLICY_DISABLED = -2,
38 USAGE_ERROR_RESOURCE_UNKNOWN = -3,
39 USAGE_ERROR_RESOURCE_EXISTS = -4,
40 USAGE_ERROR_RESOURCE_IN_USE = -5,
41 USAGE_ERROR_USER_EXISTS = -6,
42 USAGE_ERROR_USER_UNKNOWN = -7
43 } UsageErrors;
45 typedef enum {
46 RESOURCE_ERROR_NOT_ENABLED = -1
47 } ResourceErrors;
49 typedef enum {
50 OUSAGED_RESOURCE_UNKNOWN = 0,
51 OUSAGED_RESOURCE_GSM = 1,
52 OUSAGED_RESOURCE_GPS = 2,
53 OUSAGED_RESOURCE_WIFI = 3,
54 OUSAGED_RESOURCE_BLUETOOTH = 4,
55 OUSAGED_RESOURCE_DISPLAY = 5,
56 OUSAGED_RESOURCE_CPU = 6
57 } OUsagedResources;
59 #define OUSAGED_RESOURCE_COUNT 7
61 GError *ousaged_handle_errors(GError * dbus_error);
62 GError *ousaged_handle_resource_errors(GError * dbus_error);
63 int ousaged_resource_name_to_int(const char *resource);
65 void ousaged_list_resources(void (*callback) (GError *, char **, gpointer),
66 gpointer userdata);
68 void ousaged_get_resource_policy(const char *name,
69 void (*callback) (GError *, char *, gpointer),
70 gpointer userdata);
72 void ousaged_set_resource_policy(const char *name, const char *policy,
73 void (*callback) (GError *, gpointer),
74 gpointer userdata);
76 void ousaged_get_resource_state(const char *name,
77 void (*callback) (GError *, gboolean, gpointer),
78 gpointer userdata);
80 void ousaged_get_resource_users(const char *name,
81 void (*callback) (GError *, char **, gpointer),
82 gpointer userdata);
84 void ousaged_request_resource(const char *name,
85 void (*callback) (GError *, gpointer),
86 gpointer userdata);
88 void ousaged_release_resource(const char *name,
89 void (*callback) (GError *, gpointer),
90 gpointer userdata);
92 void ousaged_suspend(void (*callback) (GError *, gpointer), gpointer userdata);
94 void ousaged_shutdown(void (*callback) (GError *, gpointer), gpointer userdata);
96 void ousaged_resource_available_handler(DBusGProxy * proxy, const char *name,
97 gboolean availability,
98 gpointer userdata);
100 void ousaged_resource_changed_handler(DBusGProxy * proxy, const char *name,
101 gboolean state, GHashTable * attributes,
102 gpointer userdata);
104 extern DBusGProxy *ousagedBus;
106 G_END_DECLS
107 #endif