4 #include <Elementary.h>
5 #include <appcore-efl.h>
11 #define APP_NAME "org.tizen.call"
12 #define BUS_NAME "org.tizen.dialer"
14 #define IFACE "org.tizen.dialer.Control"
16 static E_DBus_Connection *bus_conn = NULL;
18 static void _activate_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__,
21 if (dbus_error_is_set(error)) {
22 fprintf(stderr, "Error: %s %s", error->name, error->message);
27 static void _bring_to_foreground(void)
31 msg = dbus_message_new_method_call(BUS_NAME, PATH, IFACE, "Activate");
33 EINA_SAFETY_ON_NULL_RETURN(msg);
35 e_dbus_message_send(bus_conn, msg, _activate_cb, -1, NULL);
36 dbus_message_unref(msg);
39 static void _start_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__,
42 if (dbus_error_is_set(error)) {
43 fprintf(stderr, "Error: %s %s", error->name, error->message);
48 _bring_to_foreground();
51 static void _has_owner_cb(void *data __UNUSED__, DBusMessage *msg,
57 if (dbus_error_is_set(error)) {
58 fprintf(stderr, "Error: %s %s", error->name, error->message);
62 dbus_error_init(&err);
63 dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &online,
67 e_dbus_start_service_by_name(bus_conn, BUS_NAME, 0, _start_cb, NULL);
69 _bring_to_foreground();
72 static Eina_Bool _dbus_init(void)
75 char *bus_name = BUS_NAME;
77 bus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
79 fprintf(stderr, "Could not fetch the DBus session");
83 msg = dbus_message_new_method_call(E_DBUS_FDO_BUS, E_DBUS_FDO_PATH,
87 EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE);
89 if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &bus_name,
93 e_dbus_message_send(bus_conn, msg, _has_owner_cb, -1, NULL);
94 dbus_message_unref(msg);
98 dbus_message_unref(msg);
102 static int _create(void *data __UNUSED__)
107 static int _reset(bundle *b __UNUSED__, void *data __UNUSED__)
112 static int _resume(void *data __UNUSED__)
117 static int _pause(void *data __UNUSED__)
122 static int _terminate(void *data __UNUSED__)
127 int main(int argc __UNUSED__, char **argv __UNUSED__)
130 struct appcore_ops ops = {
135 .terminate = _terminate,
140 EINA_SAFETY_ON_FALSE_RETURN_VAL(_dbus_init(), -1);
141 r = appcore_efl_main(APP_NAME, &argc, &argv, &ops);
142 e_dbus_connection_close(bus_conn);