4 * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * @file edbus-handler.h
22 * @desc dbus handler using edbus interface
25 #ifndef __EDBUS_HANDLE_H__
26 #define __EDBUS_HANDLE_H__
29 #include <resourced.h>
33 const char *signature;
34 const char *reply_signature;
35 E_DBus_Method_Cb func;
40 const char *interface;
42 E_DBus_Interface *iface;
45 #define DBUS_REPLY_TIMEOUT (120 * 1000)
47 #define BUS_NAME "org.tizen.resourced"
48 #define OBJECT_PATH "/Org/Tizen/ResourceD"
49 #define INTERFACE_NAME BUS_NAME
52 * The EDbus method to update the resourced counters
53 * Signal is generated after the database update
54 * and store new values of the counters
56 #define RESOURCED_NETWORK_UPDATE "Update"
57 #define RESOURCED_NETWORK_UPDATE_FINISH "UpdateFinish"
58 #define RESOURCED_NETWORK_PROCESS_RESTRICTION "ProcessRestriction"
59 #define RESOURCED_NETWORK_CREATE_QUOTA "CreateQuota"
60 #define RESOURCED_NETWORK_REMOVE_QUOTA "RemoveQuota"
61 #define RESOURCED_NETWORK_JOIN_NET_STAT "JoinNetStat"
62 #define RESOURCED_NETWORK_GET_STATS "GetStats"
67 * operations about swap
69 #define RESOURCED_PATH_SWAP OBJECT_PATH"/Swap"
70 #define RESOURCED_INTERFACE_SWAP INTERFACE_NAME".swap"
72 #define RESOURCED_PATH_OOM OBJECT_PATH"/Oom"
73 #define RESOURCED_INTERFACE_OOM INTERFACE_NAME".oom"
75 #define RESOURCED_PATH_NETWORK OBJECT_PATH"/Network"
76 #define RESOURCED_INTERFACE_NETWORK INTERFACE_NAME".network"
78 #define RESOURCED_PATH_PROCESS OBJECT_PATH"/Process"
79 #define RESOURCED_INTERFACE_PROCESS INTERFACE_NAME".process"
84 #define RESOURCED_PATH_LOGGING OBJECT_PATH"/Logging"
85 #define RESOURCED_INTERFACE_LOGGING INTERFACE_NAME".logging"
90 #define SYSTEM_POPUP_BUS_NAME "org.tizen.system.popup"
91 #define SYSTEM_POPUP_PATH_NAME "/Org/Tizen/System/Popup"
92 #define SYSTEM_POPUP_IFACE_NAME SYSTEM_POPUP_BUS_NAME
94 #define SYSTEM_POPUP_PATH_WATCHDOG SYSTEM_POPUP_PATH_NAME"/System"
95 #define SYSTEM_POPUP_IFACE_WATCHDOG SYSTEM_POPUP_BUS_NAME".System"
100 #define DEVICED_BUS_NAME "org.tizen.system.deviced"
101 #define DEVICED_PATH_PROCESS "/Org/Tizen/System/DeviceD/Process"
102 #define DEVICED_INTERFACE_PROCESS DEVICED_BUS_NAME".Process"
104 #define DEVICED_PATH_DISPLAY "/Org/Tizen/System/DeviceD/Display"
105 #define DEVICED_INTERFACE_DISPLAY DEVICED_BUS_NAME".display"
107 #define SIGNAL_LCD_ON "LCDOn"
108 #define SIGNAL_LCD_OFF "LCDOff"
118 * @desc helper function for filling params array
119 * That params array is used in dbus_method_sync/dbus_method_async
121 void serialize_params(char *params[], size_t n, ...);
124 DBusMessage *dbus_method_sync(const char *dest, const char *path,
125 const char *interface, const char *method,
126 const char *sig, char *param[]);
128 int dbus_method_async(const char *dest, const char *path,
129 const char *interface, const char *method,
130 const char *sig, char *param[]);
132 int register_edbus_signal_handler(const char *path, const char *interface,
133 const char *name, E_DBus_Signal_Cb cb);
134 E_DBus_Interface *get_edbus_interface(const char *path);
135 pid_t get_edbus_sender_pid(DBusMessage *msg);
136 int broadcast_edbus_signal_str(const char *path, const char *interface,
137 const char *name, const char *sig, char *param[]);
138 int broadcast_edbus_signal(const char *path, const char *interface,
139 const char *name, int type, void *value);
140 resourced_ret_c edbus_add_methods(const char *path,
141 const struct edbus_method *const edbus_methods,
143 int register_edbus_interface(struct edbus_object *object);
145 void edbus_init(void);
146 void edbus_exit(void);
148 #endif /* __EDBUS_HANDLE_H__ */