Initialize Tizen 2.3
[framework/system/coord.git] / src / shared / dbus.h
1 /*
2  * coord
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 <dbus/dbus.h>
24
25 /*
26  * Template
27  *
28 #define XXX_BUS_NAME                        "org.tizen.system.XXX"
29 #define XXX_OBJECT_PATH                     "/Org/Tizen/System/XXX"
30 #define XXX_INTERFACE_NAME                  XXX_BUS_NAME
31 #define XXX_PATH_YYY                        XXX_OBJECT_PATH"/YYY"
32 #define XXX_INTERFACE_YYY                   XXX_INTERFACE_NAME".YYY"
33 #define XXX_SIGNAL_ZZZ                      "ZZZ"
34 #define XXX_METHOD_ZZZ                      "ZZZ"
35  */
36
37 /*
38  * Coordinator daemon
39  */
40 #define COORD_BUS_NAME                                          "org.tizen.system.coord"
41 #define COORD_OBJECT_PATH                                       "/Org/Tizen/System/Coord"
42 #define COORD_INTERFACE_NAME                            COORD_BUS_NAME
43 /* Rotation service: operations about rotation */
44 #define COORD_PATH_ROTATION                                     COORD_OBJECT_PATH"/Rotation"
45 #define COORD_INTERFACE_ROTATION                        COORD_INTERFACE_NAME".rotation"
46 #define COORD_SIGNAL_ROTATION_CHANGED           "Changed"
47 #define COORD_METHOD_ROTATION_DEGREE            "Degree"
48
49 /*
50  * Context daemon
51  */
52 #define CONTEXTD_BUS_NAME                                       "org.tizen.sensor.context"
53 #define CONTEXTD_OBJECT_PATH                            "/org/tizen/sensor/context"
54 #define CONTEXTD_INTERFACE_NAME                         CONTEXTD_BUS_NAME
55 /* Rotation */
56 #define CONTEXTD_PATH_ROTATION                          CONTEXTD_OBJECT_PATH"/rotation"
57 #define CONTEXTD_INTERFACE_ROTATION                     CONTEXTD_INTERFACE_NAME".rotation"
58 #define CONTEXTD_SIGNAL_CHANGED                         "Changed"
59 #define CONTEXTD_METHOD_SET                                     "Set"
60
61 struct dbus_byte {
62         const char *data;
63         int size;
64 };
65
66 int append_variant(DBusMessageIter *iter, const char *sig, char *param[]);
67
68 DBusMessage *dbus_method_sync_with_reply(const char *dest, const char *path,
69                 const char *interface, const char *method,
70                 const char *sig, char *param[]);
71
72 int dbus_method_sync(const char *dest, const char *path,
73                 const char *interface, const char *method,
74                 const char *sig, char *param[]);
75
76 int dbus_method_async(const char *dest, const char *path,
77                 const char *interface, const char *method,
78                 const char *sig, char *param[]);
79
80 typedef void (*dbus_pending_cb)(void *data, DBusMessage *msg, DBusError *err);
81
82 int dbus_method_async_with_reply(const char *dest, const char *path,
83                 const char *interface, const char *method,
84                 const char *sig, char *param[], dbus_pending_cb cb, int timeout, void *data);
85 #endif