power: Fixed a bug to use the wrong dbus path and interface for reboot.
[platform/core/api/device.git] / src / dbus.h
1 /*
2  * system-dbus
3  *
4  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the License);
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19
20 #ifndef __DBUS_H__
21 #define __DBUS_H__
22
23 #include <gio/gio.h>
24
25 #define DEVICED_BUS_NAME                "org.tizen.system.deviced"
26 #define DEVICED_OBJECT_PATH             "/Org/Tizen/System/DeviceD"
27 #define DEVICED_INTERFACE_NAME  DEVICED_BUS_NAME
28
29 /* Display service: start/stop display(pm), get/set brightness operations about display */
30 #define DEVICED_PATH_DISPLAY                DEVICED_OBJECT_PATH"/Display"
31 #define DEVICED_INTERFACE_DISPLAY           DEVICED_INTERFACE_NAME".display"
32
33 /* Battery service */
34 #define DEVICED_PATH_BATTERY                DEVICED_OBJECT_PATH"/Battery"
35 #define DEVICED_INTERFACE_BATTERY           DEVICED_INTERFACE_NAME".Battery"
36
37 /* Haptic service: operatioins about haptic */
38 #define VIBRATOR_BUS_NAME                   "org.tizen.system.vibrator"
39 #define VIBRATOR_OBJECT_PATH                "/Org/Tizen/System/Vibrator"
40 #define VIBRATOR_INTERFACE_NAME             VIBRATOR_BUS_NAME
41
42 #define VIBRATOR_PATH_HAPTIC                VIBRATOR_OBJECT_PATH"/Haptic"
43 #define VIBRATOR_INTERFACE_HAPTIC           VIBRATOR_INTERFACE_NAME".haptic"
44
45 /* Led service: play/stop led operations about led */
46 #define DEVICED_PATH_LED                    DEVICED_OBJECT_PATH"/Led"
47 #define DEVICED_INTERFACE_LED               DEVICED_INTERFACE_NAME".Led"
48
49 /* Power service: request to reboot */
50 #define DEVICED_PATH_POWER                  DEVICED_OBJECT_PATH"/Power"
51 #define DEVICED_INTERFACE_POWER             DEVICED_INTERFACE_NAME".power"
52
53 /* Reboot service: request reboot operation */
54 #define DEVICED_PATH_REBOOT                 DEVICED_OBJECT_PATH"/Reboot"
55 #define DEVICED_INTERFACE_REBOOT            DEVICED_INTERFACE_NAME".reboot"
56
57 /* IR service: transmit IR commands */
58 #define DEVICED_PATH_IR                  DEVICED_OBJECT_PATH"/Ir"
59 #define DEVICED_INTERFACE_IR             DEVICED_INTERFACE_NAME".ir"
60
61 struct dbus_int {
62         int *list;
63         int size;
64 };
65
66 int dbus_method_sync(const char *dest, const char *path,
67                 const char *interface, const char *method,
68                 const char *sig, char *param[]);
69 int dbus_method_sync_with_reply(const char *dest,
70                 const char *path, const char *interface,
71                 const char *method, const char *sig,
72                 char *param[], GVariant **info);
73
74 /**
75  * If result is NULL, err is set.
76  * Do not invoke g_variant_unref() with result.
77  */
78 typedef void (*dbus_pending_cb)(void *data, GVariant *result, GError *err);
79
80 int dbus_method_async_with_reply(const char *dest, const char *path,
81                 const char *interface, const char *method,
82                 const char *sig, char *param[], dbus_pending_cb cb, int timeout, void *data);
83
84 void restart_callback(void);
85
86 int register_signal_handler(void);
87 int unregister_signal_handler(void);
88 #endif