stamp-h1
data/themes/*.edj
ofono-efl-*.tar.*
+tizen/answer_daemon
+tizen/answer_daemon.desktop
+tizen/dialer.desktop
+tizen/dialer_daemon
+tizen/dialer_open
+tizen/order
+tizen/org.tizen.call.desktop
+tizen/org.tizen.dialer.service
+tizen/org.tizen.phone.desktop
Makefile.in \
missing \
mkinstalldirs
+EXTRA_DIST =
bin_PROGRAMS = dialer/dialer
dialer_dialer_SOURCES += dialer/contacts.c
endif
+if HAVE_TIZEN
+bin_PROGRAMS += \
+ tizen/answer_daemon \
+ tizen/dialer_open \
+ tizen/dialer_daemon
+
+tizen_answer_daemon_SOURCES = tizen/answer_daemon.c
+tizen_answer_daemon_LDADD = @EFL_LIBS@ @TIZEN_LIBS@
+
+tizen_dialer_open_SOURCES = tizen/dialer_open.c
+tizen_dialer_open_LDADD = @EFL_LIBS@ @TIZEN_LIBS@
+
+tizen_dialer_daemon_SOURCES = tizen/dialer_daemon.c
+tizen_dialer_daemon_LDADD = @EFL_LIBS@ @TIZEN_LIBS@
+
+%.service: %.service.in Makefile
+ sed 's:@bindir[@]:$(bindir):g' $< > $@
+
+dbusservicesdir = @with_dbusservicesdir@
+dbusservices_DATA = \
+tizen/org.tizen.dialer.service
+
+EXTRA_DIST += \
+tizen/org.tizen.dialer.service.in
+
+%.desktop: %.desktop.in Makefile
+ sed 's:@bindir[@]:$(bindir):g' $< > $@
+
+desktopdir = @with_desktopdir@
+desktop_DATA = \
+tizen/answer_daemon.desktop \
+tizen/dialer.desktop \
+tizen/org.tizen.call.desktop \
+tizen/org.tizen.phone.desktop
+
+EXTRA_DIST += \
+tizen/answer_daemon.desktop.in \
+tizen/dialer.desktop.in \
+tizen/org.tizen.call.desktop.in \
+tizen/org.tizen.phone.desktop.in
+
+
+tizen/order: tizen/order.in Makefile
+ sed 's:@desktopdir[@]:$(with_desktopdir):g' $< > $@
+
+tizenexamplesdir = $(pkgdatadir)/tizen-examples
+tizenexamples_DATA = \
+tizen/order
+
+EXTRA_DIST += \
+tizen/order.in
+
+endif
+
# Themes are compiled with edje_cc given by user (cross-compile)
EDJE_CC = @edje_cc@
EDJE_FLAGS_VERBOSE_ =
THEME_IMAGES = \
data/themes/images/bg_call.jpg \
+data/themes/images/arrow_right.png \
+data/themes/images/arrow_left.png \
data/themes/images/bg_keypad.jpg \
data/themes/images/ico_add_call.png \
data/themes/images/ico_add_contact.png \
data/themes/images/loading_7.png
THEME_INCLUDES = \
+data/themes/includes/action_answer.edc \
+data/themes/includes/answer_screen.edc \
data/themes/includes/buttons.edc \
data/themes/includes/call.edc \
data/themes/includes/colors.edc \
data/themes/includes/scroller.edc
-EXTRA_DIST = \
+EXTRA_DIST += \
data/themes/default-hd.edc \
data/themes/default-sd.edc \
data/themes/default.edc \
appcore-efl
ui-gadget
capi-social-contacts
+ vconf
+ capi-system-power
+ utilX
+ aul
+ appsvc
],
[have_tizen="yes"],
[have_tizen="no"])
-
fi
if test "$want_tizen" = "yes" -a "$have_tizen" = "no"; then
[with_max_log_level="${withval}"], [:])
AC_DEFINE_UNQUOTED(EINA_LOG_LEVEL_MAXIMUM, ${with_max_log_level}, [if set, logging is limited to this amount.])
+with_dbusservicesdir=`pkg-config --variable=session_bus_services_dir dbus-1`
+AC_ARG_WITH(dbusservicesdir,
+ [AC_HELP_STRING([--with-dbusservicesdir=PATH],
+ [Where to place dbus services files])],
+ [with_dbusservicesdir="${withval}"], [:])
+AC_SUBST(with_dbusservicesdir)
+
+
+with_desktopdir="/opt/share/applications"
+AC_ARG_WITH(desktopdir,
+ [AC_HELP_STRING([--with-desktopdir=PATH],
+ [Where to place desktop files. Default=/opt/share/applications/])],
+ [with_desktopdir="${withval}"], [:])
+AC_SUBST(with_desktopdir)
+
AC_CONFIG_FILES([
Makefile
])
#include "includes/scroller.edc"
#include "includes/popup.edc"
#include "includes/buttons.edc"
+#include "includes/answer_screen.edc"
+#include "includes/action_answer.edc"
}
--- /dev/null
+
+group {
+ name: "elm/actionslider/base/answer";
+
+ images {
+ image: "ico_call.png" COMP;
+ image: "arrow_right.png" COMP;
+ image: "arrow_left.png" COMP;
+ }
+
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color_class: "bg";
+ }
+ }
+
+ part {
+ name: "elm.text.left";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ color_class: "caution";
+ rel1.offset: BORDER_PADDING 0;
+ rel2.relative: 0.5 1.0;
+ text {
+ font: FONT_NORMAL;
+ size: SIZE_MEDIUM;
+ align: 0 0.5;
+ min: 0 1;
+ }
+ }
+ }
+
+ part {
+ name: "elm.image.arrow.right.1";
+ type: IMAGE;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 22 30;
+ max: 22 30;
+ color: 255 255 255 255;
+ color_class: "caution";
+ rel1 {
+ to: "elm.drag_button";
+ offset: (-190 - ITEM_PADDING) 0;
+ }
+ rel2 {
+ to: "elm.drag_button";
+ }
+ image {
+ normal: "arrow_right.png";
+ scale_hint: STATIC;
+ }
+ fill.smooth: 1;
+ }
+ }
+
+ part {
+ name: "elm.image.arrow.right.2";
+ type: IMAGE;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 22 30;
+ max: 22 30;
+ color: 255 255 255 128;
+ color_class: "caution";
+ rel1 {
+ to: "elm.drag_button";
+ offset: (-135 - ITEM_PADDING) 0;
+ }
+ rel2 {
+ to: "elm.drag_button";
+ }
+ image {
+ normal: "arrow_right.png";
+ scale_hint: STATIC;
+ }
+ fill.smooth: 1;
+ }
+ }
+
+ part {
+ name: "elm.image.arrow.left.1";
+ type: IMAGE;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 22 30;
+ max: 22 30;
+ color: 255 255 255 255;
+ color_class: "action";
+ rel1 {
+ to: "elm.drag_button";
+ offset: (ITEM_PADDING + 190) 0;
+ }
+ rel2 {
+ to: "elm.drag_button";
+ }
+ image {
+ normal: "arrow_left.png";
+ scale_hint: STATIC;
+ }
+ fill.smooth: 1;
+ }
+ }
+
+ part {
+ name: "elm.image.arrow.left.2";
+ type: IMAGE;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ min: 22 30;
+ max: 22 30;
+ color: 255 255 255 128;
+ color_class: "action";
+ rel1 {
+ to: "elm.drag_button";
+ offset: (135 +ITEM_PADDING) 0;
+ }
+ rel2 {
+ to: "elm.drag_button";
+ }
+ image {
+ normal: "arrow_left.png";
+ scale_hint: STATIC;
+ }
+ fill.smooth: 1;
+ }
+ }
+
+ part {
+ name: "elm.text.right";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ color_class: "action";
+ rel1 {
+ relative: 1.0 0.0;
+ offset: (-ACTION_HEIGHT -BORDER_PADDING) 0;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ offset: -BORDER_PADDING 0;
+ }
+ text {
+ font: FONT_NORMAL;
+ size: SIZE_MEDIUM;
+ align: 0 0.5;
+ min: 0 1;
+ }
+ }
+ }
+
+ part {
+ name: "elm.drag_button_base";
+ type: SWALLOW;
+ mouse_events: 1;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ min: 170 170;
+ align: 0.5 0.5;
+ rel1.to: "bg";
+ rel2 {
+ relative: 0.0 1.0;
+ to: "bg";
+ }
+ }
+ dragable {
+ confine: "bg";
+ x: 1 1 0;
+ y: 0 0 0;
+ }
+ }
+ part {
+ name: "elm.drag_button";
+ type: IMAGE;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ min: 170 170;
+ max: 170 170;
+ color: 255 255 255 255;
+ color_class: "action";
+ rel1.to_x: "elm.drag_button_base";
+ rel1.to_y: "bg";
+ rel2.to_x: "elm.drag_button_base";
+ rel2.to_y: "bg";
+ image {
+ normal: "ico_call.png";
+ scale_hint: STATIC;
+ }
+ fill.smooth: 1;
+ }
+ dragable {
+ events: "elm.drag_button_base";
+ }
+ }
+ }
+
+ programs {
+ program {
+ name: "elm.drag_button,mouse,up";
+ signal: "mouse,up,1";
+ source: "elm.drag_button";
+ action: SIGNAL_EMIT "elm.drag_button,mouse,up" "";
+ }
+ program {
+ name: "elm.drag_button,mouse,down";
+ signal: "mouse,down,1";
+ source: "elm.drag_button";
+ action: SIGNAL_EMIT "elm.drag_button,mouse,down" "";
+ }
+ program {
+ name: "elm.drag_button,mouse,move";
+ signal: "mouse,move";
+ source: "elm.drag_button_base";
+ action: SIGNAL_EMIT "elm.drag_button,mouse,move" "";
+ }
+ }
+}
--- /dev/null
+group {
+ name: "elm/layout/dialer/answer";
+ min: WIDTH HEIGHT;
+ parts {
+
+ images {
+ image: "bg_call.jpg" COMP;
+ }
+
+ part {
+ name: "bg";
+ type: IMAGE;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ color_class: "dark";
+ min: WIDTH HEIGHT;
+ image {
+ normal: "bg_call.jpg";
+ scale_hint: STATIC;
+ }
+ fill.smooth: 1;
+ }
+ }
+
+ part {
+ name: "elm.text.name";
+ type: TEXT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ color_class: "action";
+ rel1.offset: BORDER_PADDING SEPARATOR_HEIGHT;
+ rel2 {
+ relative: 1.0 0.0;
+ offset: -BORDER_PADDING ACTION_HEIGHT;
+ }
+ text {
+ text: "Gustavo Barbieri";
+ font: FONT_NORMAL;
+ size: SIZE_HUGE;
+ size_range: SIZE_TINY SIZE_HUGE;
+ fit: 1 1;
+ align: 0.0 0.5;
+ ellipsis: 0.0;
+ }
+ }
+ }
+
+ part {
+ name: "elm.text.state";
+ type: TEXT;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ color_class: "light";
+ fixed: 1 1;
+ align: 0.0 0.0;
+ rel1 {
+ to: "elm.text.name";
+ relative: 0.0 1.0;
+ offset: 0 -20;
+ }
+ rel2 {
+ to: "elm.text.name";
+ relative: 0.0 1.0;
+ offset: 0 -1;
+ }
+ text {
+ text: "Incoming...";
+ font: FONT_NORMAL;
+ size: SIZE_MEDIUM;
+ min: 1 1;
+ align: 0.0 0.0;
+ }
+ }
+ }
+
+ part {
+ name: "elm.swallow.slider";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 {
+ relative: 0.0 1.0;
+ offset: 0 -LIST_CONTACT_HEIGHT;
+ }
+ rel2 {
+ relative: 1.0 1.0;
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+Instructions for Tizen setup.
+
+Copy start_ofono to /etc/rc.d/init.d and create link in the /etc/rc.d/rc3.d S61ofono
+type this command: chmod +x /etc/rc.d/init.d/start_ofono
+
+Append tizen/order to /opt/home/root/.e/e/applications/startup/.order
+
+Restart your phone. And that's it !
--- /dev/null
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Ecore.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <Eina.h>
+#include <Evas.h>
+#include <Elementary.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <E_DBus.h>
+#include <Ecore_X.h>
+#include <utilX.h>
+#include <power.h>
+#include <aul.h>
+
+#define APP_NAME "org.tizen.answer"
+#define BUS_NAME "org.tizen.dialer"
+#define PATH "/"
+#define IFACE "org.tizen.dialer.Control"
+
+static int _log_domain = -1;
+#define ERR(...) EINA_LOG_DOM_ERR(_log_domain, __VA_ARGS__)
+
+static E_DBus_Connection *bus_conn = NULL;
+static E_DBus_Signal_Handler *sig_incoming_call_add = NULL;
+static E_DBus_Signal_Handler *sig_incoming_call_removed = NULL;
+static E_DBus_Signal_Handler *sig_waiting_call_add = NULL;
+static E_DBus_Signal_Handler *sig_waiting_call_removed = NULL;
+
+typedef struct _Call {
+ const char *line_id, *img, *type, *name;
+} Call;
+
+typedef struct _Call_Screen {
+ Evas_Object *win, *layout;
+ Call *call;
+ Eina_Bool screen_visible;
+} Call_Screen;
+
+static void _set_notification_type(Evas_Object *win, Eina_Bool high)
+{
+ Ecore_X_Window xwin;
+
+ xwin = elm_win_xwindow_get(win);
+
+ if (high) {
+ ecore_x_netwm_window_type_set(xwin,
+ ECORE_X_WINDOW_TYPE_NOTIFICATION);
+ utilx_set_system_notification_level(ecore_x_display_get(), xwin,
+ UTILX_NOTIFICATION_LEVEL_HIGH);
+ power_wakeup();
+ } else
+ ecore_x_netwm_window_type_set(xwin, ECORE_X_WINDOW_TYPE_NORMAL);
+}
+
+static Eina_Bool _phone_locked(void)
+{
+ int lock;
+ if (vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &lock) == -1)
+ return EINA_FALSE;
+
+ if (lock == VCONFKEY_IDLE_LOCK)
+ return EINA_TRUE;
+
+ return EINA_FALSE;
+}
+
+static Call *_call_create(DBusMessage *msg)
+{
+ DBusError err;
+ const char *img, *name, *id, *type;
+ Call *call;
+
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &img,
+ DBUS_TYPE_STRING, &id, DBUS_TYPE_STRING,
+ &name, DBUS_TYPE_STRING, &type,
+ DBUS_TYPE_INVALID);
+
+ if (dbus_error_is_set(&err)) {
+ ERR("Could not parse message: %s: %s", err.name,
+ err.message);
+ return NULL;
+ }
+ call = calloc(1, sizeof(Call));
+ EINA_SAFETY_ON_NULL_RETURN_VAL(call, NULL);
+ call->img = eina_stringshare_add(img);
+ call->line_id = eina_stringshare_add(id);
+ call->type = eina_stringshare_add(type);
+ call->name = eina_stringshare_add(name);
+ return call;
+}
+
+static void _call_destroy(Call *c)
+{
+ eina_stringshare_del(c->img);
+ eina_stringshare_del(c->line_id);
+ eina_stringshare_del(c->type);
+ eina_stringshare_del(c->name);
+ free(c);
+}
+
+static void _call_screen_show(Call_Screen *cs, const char *state)
+{
+ Call *c = cs->call;
+ _set_notification_type(cs->win, EINA_TRUE);
+ cs->screen_visible = EINA_TRUE;
+ elm_win_raise(cs->win);
+ elm_win_activate(cs->win);
+
+ if (strcmp("", c->name) == 0)
+ elm_object_part_text_set(cs->layout, "elm.text.name",
+ c->line_id);
+ else
+ elm_object_part_text_set(cs->layout, "elm.text.name",
+ c->name);
+
+ elm_object_part_text_set(cs->layout, "elm.text.state", state);
+ elm_object_signal_emit(cs->layout, "show,activecall", "gui");
+ evas_object_show(cs->win);
+ //screen can't be off
+ power_lock_state(POWER_STATE_NORMAL, 0);
+}
+
+static void _sig_call_added(void *data, DBusMessage *msg)
+{
+ Call_Screen *cs = data;
+
+ if (!_phone_locked())
+ return;
+
+ if (cs->call)
+ _call_destroy(cs->call);
+
+ cs->call = _call_create(msg);
+ _call_screen_show(cs, "Incoming...");
+}
+
+static void _call_screen_hide(Call_Screen *cs)
+{
+ cs->screen_visible = EINA_FALSE;
+ _set_notification_type(cs->win, EINA_FALSE);
+ elm_object_signal_emit(cs->layout, "hide,activecall", "gui");
+ evas_object_hide(cs->win);
+ //screen can go off again
+ power_unlock_state(POWER_STATE_NORMAL);
+}
+
+static void _sig_call_removed(void *data, DBusMessage *msg __UNUSED__)
+{
+ Call_Screen *cs = data;
+
+ if (!cs->screen_visible)
+ return;
+
+ if (cs->call) {
+ _call_destroy(cs->call);
+ cs->call = NULL;
+ }
+
+ _call_screen_hide(cs);
+}
+
+static void _signal_handlers_add(Call_Screen *cs)
+{
+ sig_incoming_call_add = e_dbus_signal_handler_add(bus_conn, BUS_NAME,
+ PATH, IFACE,
+ "AddedCall",
+ _sig_call_added,
+ cs);
+ sig_incoming_call_removed = e_dbus_signal_handler_add(bus_conn,
+ BUS_NAME, PATH,
+ IFACE,
+ "RemovedCall",
+ _sig_call_removed,
+ cs);
+}
+
+
+static void _daemon_method_call_reply(void *data __UNUSED__,
+ DBusMessage *msg __UNUSED__,
+ DBusError *err)
+{
+ if (dbus_error_is_set(err)) {
+ ERR("Error calling remote method: %s %s", err->name,
+ err->message);
+ }
+}
+
+static void _daemon_method_call_make_with_reply(const char *method,
+ E_DBus_Method_Return_Cb cb,
+ void *data)
+{
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call(BUS_NAME, PATH, IFACE, method);
+ EINA_SAFETY_ON_NULL_RETURN(msg);
+
+ e_dbus_message_send(bus_conn, msg, cb, -1, data);
+ dbus_message_unref(msg);
+}
+
+static void _daemon_method_call_make(const char *method)
+{
+ _daemon_method_call_make_with_reply(method, _daemon_method_call_reply,
+ NULL);
+}
+
+static void _daemon_available_call_reply(void *data, DBusMessage *msg,
+ DBusError *err)
+{
+ Call_Screen *cs = data;
+
+ if (dbus_error_is_set(err)) {
+ const char *err_name = "org.tizen.dialer.error.NotAvailable";
+ if (strcmp(err_name, err->name) == 0)
+ return;
+
+ ERR("Error calling remote method: %s %s", err->name,
+ err->message);
+ return;
+ }
+ if (cs->call)
+ _call_destroy(cs->call);
+
+ cs->call = _call_create(msg);
+ _call_screen_show(cs, "Incoming...");
+}
+
+static void _service_start_reply(void *data, DBusMessage *msg __UNUSED__,
+ DBusError *err)
+{
+ Call_Screen *cs = data;
+ if (dbus_error_is_set(err)) {
+ ERR("Error: %s %s", err->name, err->message);
+ return;
+ }
+ _signal_handlers_add(cs);
+ _daemon_method_call_make_with_reply("GetAvailableCall",
+ _daemon_available_call_reply,
+ cs);
+}
+
+static void _has_owner_cb(void *data, DBusMessage *msg __UNUSED__,
+ DBusError *error)
+{
+ dbus_bool_t online;
+ DBusError err;
+ Call_Screen *cs = data;
+
+
+ if (dbus_error_is_set(error)) {
+ ERR("Error: %s %s", error->name, error->message);
+ return;
+ }
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &online,
+ DBUS_TYPE_INVALID);
+
+ if (!online) {
+ e_dbus_start_service_by_name(bus_conn, BUS_NAME, 0,
+ _service_start_reply, cs);
+ return;
+ }
+
+ _signal_handlers_add(cs);
+ _daemon_method_call_make_with_reply("GetAvailableCall",
+ _daemon_available_call_reply,
+ cs);
+}
+
+static Eina_Bool _dbus_init(Call_Screen *cs)
+{
+ DBusMessage *msg;
+ char *bus_name = BUS_NAME;
+
+ bus_conn = e_dbus_bus_get(DBUS_BUS_SESSION);
+ if (!bus_conn) {
+ ERR("Could not fetch the DBus session");
+ return EINA_FALSE;
+ }
+
+ msg = dbus_message_new_method_call(E_DBUS_FDO_BUS, E_DBUS_FDO_PATH,
+ E_DBUS_FDO_INTERFACE,
+ "NameHasOwner");
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE);
+
+ if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &bus_name,
+ DBUS_TYPE_INVALID))
+ goto err_msg;
+
+ e_dbus_message_send(bus_conn, msg, _has_owner_cb, -1, cs);
+ dbus_message_unref(msg);
+
+ return EINA_TRUE;
+err_msg:
+ dbus_message_unref(msg);
+ return EINA_FALSE;
+}
+
+Evas_Object *gui_layout_add(Evas_Object *parent, const char *style)
+{
+ Evas_Object *layout = elm_layout_add(parent);
+ if (!elm_layout_theme_set(layout, "layout", "dialer", style)) {
+ evas_object_del(layout);
+ return NULL;
+ }
+ return layout;
+}
+
+static int _running_apps_iter(const aul_app_info *info, void *data __UNUSED__)
+{
+ if (strcmp(info->pkg_name, "org.tizen.draglock") == 0)
+ aul_terminate_pid(info->pid);
+ return 0;
+}
+
+static void _phone_unlock_screen(void)
+{
+ aul_app_get_running_app_info(_running_apps_iter, NULL);
+}
+
+static void _slider_pos_changed_cb(void *data, Evas_Object *obj,
+ void *event_inf __UNUSED__)
+{
+ Call_Screen *cs = data;
+ const char *label = elm_actionslider_selected_label_get(obj);
+
+ if (!label)
+ return;
+
+ if (strcmp(label, "Answer") == 0) {
+ _daemon_method_call_make("AnswerCall");
+ elm_actionslider_indicator_pos_set(obj,
+ ELM_ACTIONSLIDER_CENTER);
+ _phone_unlock_screen();
+ _call_screen_hide(cs);
+ } else if (strcmp(label, "Hangup") == 0) {
+ _daemon_method_call_make("HangupCall");
+ elm_actionslider_indicator_pos_set(obj,
+ ELM_ACTIONSLIDER_CENTER);
+ }
+}
+
+static Eina_Bool _gui_init(Call_Screen *cs)
+{
+ Evas_Object *win, *obj, *lay, *slider;
+ Evas_Coord h, w;
+ char def_theme[PATH_MAX];
+ /* should never, ever quit */
+
+ elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE);
+ elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
+ elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
+ elm_app_info_set(_gui_init, "answer-ofono-efl", "themes/default.edj");
+
+ snprintf(def_theme, sizeof(def_theme), "%s/themes/default.edj",
+ elm_app_data_dir_get());
+
+ elm_theme_extension_add(NULL, def_theme);
+ elm_theme_overlay_add(NULL, def_theme);
+
+ win = elm_win_util_standard_add("answer screen", "oFono Answer");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
+ elm_win_autodel_set(win, EINA_FALSE);
+
+ lay = gui_layout_add(win, "answer");
+ EINA_SAFETY_ON_NULL_RETURN_VAL(lay, EINA_FALSE);
+ evas_object_show(lay);
+
+ slider = elm_actionslider_add(win);
+ EINA_SAFETY_ON_NULL_GOTO(slider, err_obj);
+ elm_object_style_set(slider, "answer");
+ elm_actionslider_indicator_pos_set(slider, ELM_ACTIONSLIDER_CENTER);
+ elm_actionslider_magnet_pos_set(slider, ELM_ACTIONSLIDER_CENTER);
+ elm_object_part_text_set(slider, "left", "Hangup");
+ elm_object_part_text_set(slider, "right", "Answer");
+ evas_object_smart_callback_add(slider, "selected",
+ _slider_pos_changed_cb, cs);
+ evas_object_show(slider);
+ elm_object_part_content_set(lay, "elm.swallow.slider", slider);
+
+ obj = elm_layout_edje_get(lay);
+ edje_object_size_min_get(obj, &w, &h);
+ if ((w == 0) || (h == 0))
+ edje_object_size_min_restricted_calc(obj, &w, &h, w, h);
+ if ((w == 0) || (h == 0))
+ edje_object_parts_extends_calc(obj, NULL, NULL, &w, &h);
+ evas_object_resize(lay, w, h);
+ evas_object_resize(win, w, h);
+ cs->win = win;
+ cs->layout = lay;
+
+ return EINA_TRUE;
+
+err_obj:
+ evas_object_del(win);
+ return EINA_FALSE;
+}
+
+EAPI int elm_main(int argc __UNUSED__, char **argv __UNUSED__)
+{
+ Call_Screen *cs;
+
+ if (!elm_need_e_dbus()) {
+ ERR("Could not start E_dbus");
+ return -1;
+ }
+
+ _log_domain = eina_log_domain_register("answer_daemon", NULL);
+ cs = calloc(1, sizeof(Call_Screen));
+ EINA_SAFETY_ON_NULL_RETURN_VAL(cs, -1);
+
+ EINA_SAFETY_ON_FALSE_GOTO(_dbus_init(cs), err_dbus);
+ EINA_SAFETY_ON_FALSE_GOTO(_gui_init(cs), err_dbus);
+
+ elm_run();
+
+ e_dbus_signal_handler_del(bus_conn, sig_waiting_call_add);
+ e_dbus_signal_handler_del(bus_conn, sig_waiting_call_removed);
+ e_dbus_signal_handler_del(bus_conn, sig_incoming_call_add);
+ e_dbus_signal_handler_del(bus_conn, sig_incoming_call_removed);
+ e_dbus_connection_close(bus_conn);
+ evas_object_del(cs->win);
+ _call_destroy(cs->call);
+ free(cs);
+
+ return 0;
+
+err_dbus:
+ free(cs);
+ return -1;
+}
+ELM_MAIN()
--- /dev/null
+
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=answer_daemon
+Name[en]=answer_daemon
+Exec=@bindir@/answer_daemon
+Terminal=false
+Type=Application
+Categories=
+GenericName=
--- /dev/null
+
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=dialer
+Name[en]=Dialer
+Exec=@bindir@/dialer
+Terminal=false
+Type=Application
+Categories=
+GenericName=
--- /dev/null
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Elementary.h>
+#include <appcore-efl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <Evas.h>
+#include <E_DBus.h>
+#include <aul.h>
+#include <appsvc.h>
+#include <Eina.h>
+
+#define APP_NAME "org.tizen.call"
+#define BUS_NAME "org.tizen.dialer"
+#define PATH "/"
+#define IFACE "org.tizen.dialer.Control"
+
+static E_DBus_Connection *bus_conn = NULL;
+
+
+typedef struct _Daemon {
+ Eina_Bool online;
+ Eina_List *pending;
+} Daemon;
+
+static void _dial_return_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__,
+ DBusError *error)
+{
+ if (dbus_error_is_set(error)) {
+ fprintf(stderr, "Error: %s %s", error->name, error->message);
+ return;
+ }
+ elm_exit();
+}
+
+static void _pending_call_send(Daemon *d)
+{
+ DBusMessage *p_msg;
+ EINA_LIST_FREE(d->pending, p_msg) {
+ e_dbus_message_send(bus_conn, p_msg, _dial_return_cb, -1, NULL);
+ dbus_message_unref(p_msg);
+ }
+}
+
+static void _has_owner_cb(void *data, DBusMessage *msg, DBusError *error)
+{
+ dbus_bool_t online;
+ DBusError err;
+ Daemon *d = data;
+
+ if (dbus_error_is_set(error)) {
+ fprintf(stderr, "Error: %s %s", error->name, error->message);
+ return;
+ }
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &online,
+ DBUS_TYPE_INVALID);
+
+ if (!online)
+ e_dbus_start_service_by_name(bus_conn, BUS_NAME, 0, NULL, NULL);
+ else {
+ d->online = EINA_TRUE;
+ _pending_call_send(d);
+ }
+}
+
+static void _name_owner_changed(void *data, DBusMessage *msg)
+{
+ DBusError err;
+ const char *name, *from, *to;
+ Daemon *d = data;
+
+ dbus_error_init(&err);
+ if (!dbus_message_get_args(msg, &err,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &from,
+ DBUS_TYPE_STRING, &to,
+ DBUS_TYPE_INVALID)) {
+ fprintf(stderr,
+ "Could not get NameOwnerChanged arguments: %s: %s",
+ err.name, err.message);
+ dbus_error_free(&err);
+ return;
+ }
+
+ if (strcmp(name, BUS_NAME) != 0)
+ return;
+
+ d->online = EINA_TRUE;
+ _pending_call_send(d);
+}
+
+static Eina_Bool _dbus_init(Daemon *dialer_daemon)
+{
+ DBusMessage *msg;
+ char *bus_name = BUS_NAME;
+
+ bus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+ if (!bus_conn) {
+ fprintf(stderr, "Could not fetch the DBus session");
+ return EINA_FALSE;
+ }
+
+ e_dbus_signal_handler_add(bus_conn, E_DBUS_FDO_BUS, E_DBUS_FDO_PATH,
+ E_DBUS_FDO_INTERFACE,
+ "NameOwnerChanged",
+ _name_owner_changed, dialer_daemon);
+
+ msg = dbus_message_new_method_call(E_DBUS_FDO_BUS, E_DBUS_FDO_PATH,
+ E_DBUS_FDO_INTERFACE,
+ "NameHasOwner");
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE);
+
+ if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &bus_name,
+ DBUS_TYPE_INVALID))
+ goto err_msg;
+
+ e_dbus_message_send(bus_conn, msg, _has_owner_cb, -1, dialer_daemon);
+ dbus_message_unref(msg);
+
+ return EINA_TRUE;
+err_msg:
+ dbus_message_unref(msg);
+ return EINA_FALSE;
+}
+
+static int _dial(const char *number, Daemon *d)
+{
+ dbus_bool_t do_auto = TRUE;
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call(BUS_NAME, PATH, IFACE, "Dial");
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(msg, -1);
+
+ if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &number,
+ DBUS_TYPE_BOOLEAN, &do_auto,
+ DBUS_TYPE_INVALID))
+ goto err_msg;
+
+ if (d->online) {
+ e_dbus_message_send(bus_conn, msg, _dial_return_cb, -1, NULL);
+ dbus_message_unref(msg);
+ } else
+ d->pending = eina_list_append(d->pending, msg);
+
+ return 0;
+err_msg:
+ dbus_message_unref(msg);
+ return -1;
+}
+
+static int _create(void *data __UNUSED__)
+{
+ return 0;
+}
+
+static int _reset(bundle *b, void *data)
+{
+ const char *number, *mime_type, *tmp;
+ Daemon *d = data;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(b, -1);
+ number = bundle_get_val(b, "number");
+ if (!number) {
+ mime_type = bundle_get_val(b, AUL_K_MIME_TYPE);
+ if (mime_type){
+ if (strncmp(mime_type, "phonenum.uri", 12) == 0 ||
+ strncmp(mime_type, "tel.uri", 7) == 0) {
+ tmp = bundle_get_val(b, AUL_K_MIME_CONTENT);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tmp, -1);
+ if (strncmp(tmp, "tel:", 4) == 0)
+ number = (char *)tmp + 4;
+ else {
+ fprintf(stderr, "Phone not present");
+ return -1;
+ }
+ } else {
+ fprintf(stderr, "Unexpected mime type.");
+ return -1;
+ }
+ } else {
+ tmp = (const char *)appsvc_get_uri(b);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(tmp, -1);
+ number = (char *)tmp + 4;
+ }
+ }
+ EINA_SAFETY_ON_NULL_RETURN_VAL(number, -1);
+ return _dial(number, d);
+}
+
+static int _resume(void *data __UNUSED__)
+{
+ return 0;
+}
+
+static int _pause(void *data __UNUSED__)
+{
+ return 0;
+}
+
+static int _terminate(void *data __UNUSED__)
+{
+ return 0;
+}
+
+int main(int argc __UNUSED__, char **argv __UNUSED__)
+{
+ int r;
+ Daemon dialer_daemon;
+ dialer_daemon.pending = NULL;
+ dialer_daemon.online = EINA_FALSE;
+ struct appcore_ops ops = {
+ .create = _create,
+ .resume = _resume,
+ .reset = _reset,
+ .pause = _pause,
+ .terminate = _terminate,
+ };
+ ops.data = &dialer_daemon;
+
+ e_dbus_init();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(_dbus_init(&dialer_daemon), -1);
+ r = appcore_efl_main(APP_NAME, &argc, &argv, &ops);
+ e_dbus_connection_close(bus_conn);
+
+ e_dbus_shutdown();
+ return r;
+}
--- /dev/null
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Elementary.h>
+#include <appcore-efl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <Evas.h>
+#include <E_DBus.h>
+
+#define APP_NAME "org.tizen.call"
+#define BUS_NAME "org.tizen.dialer"
+#define PATH "/"
+#define IFACE "org.tizen.dialer.Control"
+
+static E_DBus_Connection *bus_conn = NULL;
+
+static void _activate_cb(void *data __UNUSED__, DBusMessage *msg __UNUSED__,
+ DBusError *error)
+{
+ if (dbus_error_is_set(error)) {
+ fprintf(stderr, "Error: %s %s", error->name, error->message);
+ return;
+ }
+}
+
+static int _bring_to_foreground(void)
+{
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call(BUS_NAME, PATH, IFACE, "Activate");
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(msg, -1);
+
+ e_dbus_message_send(bus_conn, msg, _activate_cb, -1, NULL);
+ dbus_message_unref(msg);
+ return 0;
+}
+
+static void _has_owner_cb(void *data __UNUSED__, DBusMessage *msg,
+ DBusError *error)
+{
+ dbus_bool_t online;
+ DBusError err;
+
+ if (dbus_error_is_set(error)) {
+ fprintf(stderr, "Error: %s %s", error->name, error->message);
+ return;
+ }
+ dbus_error_init(&err);
+ dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &online,
+ DBUS_TYPE_INVALID);
+
+ if (!online)
+ e_dbus_start_service_by_name(bus_conn, BUS_NAME, 0, NULL, NULL);
+}
+
+static void _name_owner_changed(void *data __UNUSED__, DBusMessage *msg)
+{
+ DBusError err;
+ const char *name, *from, *to;
+
+ dbus_error_init(&err);
+ if (!dbus_message_get_args(msg, &err,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &from,
+ DBUS_TYPE_STRING, &to,
+ DBUS_TYPE_INVALID)) {
+ fprintf(stderr,
+ "Could not get NameOwnerChanged arguments: %s: %s",
+ err.name, err.message);
+ dbus_error_free(&err);
+ return;
+ }
+
+ if (strcmp(name, BUS_NAME) != 0)
+ return;
+}
+
+static Eina_Bool _dbus_init(void)
+{
+ DBusMessage *msg;
+ char *bus_name = BUS_NAME;
+
+ bus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+ if (!bus_conn) {
+ fprintf(stderr, "Could not fetch the DBus session");
+ return EINA_FALSE;
+ }
+
+ e_dbus_signal_handler_add(bus_conn, E_DBUS_FDO_BUS, E_DBUS_FDO_PATH,
+ E_DBUS_FDO_INTERFACE,
+ "NameOwnerChanged",
+ _name_owner_changed, NULL);
+
+ msg = dbus_message_new_method_call(E_DBUS_FDO_BUS, E_DBUS_FDO_PATH,
+ E_DBUS_FDO_INTERFACE,
+ "NameHasOwner");
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(msg, EINA_FALSE);
+
+ if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &bus_name,
+ DBUS_TYPE_INVALID))
+ goto err_msg;
+
+ e_dbus_message_send(bus_conn, msg, _has_owner_cb, -1, NULL);
+ dbus_message_unref(msg);
+
+ return EINA_TRUE;
+err_msg:
+ dbus_message_unref(msg);
+ return EINA_FALSE;
+}
+
+static int _create(void *data __UNUSED__)
+{
+ return 0;
+}
+
+static int _reset(bundle *b __UNUSED__, void *data __UNUSED__)
+{
+ int r;
+ r = _bring_to_foreground();
+ elm_exit();
+ return r;
+}
+
+static int _resume(void *data __UNUSED__)
+{
+ return 0;
+}
+
+static int _pause(void *data __UNUSED__)
+{
+ return 0;
+}
+
+static int _terminate(void *data __UNUSED__)
+{
+ return 0;
+}
+
+int main(int argc __UNUSED__, char **argv __UNUSED__)
+{
+ int r;
+ struct appcore_ops ops = {
+ .create = _create,
+ .resume = _resume,
+ .reset = _reset,
+ .pause = _pause,
+ .terminate = _terminate,
+ };
+ ops.data = NULL;
+
+ e_dbus_init();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(_dbus_init(), -1);
+ r = appcore_efl_main(APP_NAME, &argc, &argv, &ops);
+ e_dbus_connection_close(bus_conn);
+
+ e_dbus_shutdown();
+ return r;
+}
--- /dev/null
+@desktopdir@/dialer.desktop
+@desktopdir@/answer_daemon.desktop
--- /dev/null
+Name=call
+Exec=@bindir@/dialer_daemon
+Icon=org.tizen.phone.png
+Type=Application
+MimeType=tel.uri
+Nodisplay=True
+Version=0.1.0
+X-Tizen-TaskManage=True
+X-Tizen-Multiple=False
+X-Tizen-Removable=false
+X-Tizen-Svc=http://tizen.org/appsvc/operation/call|tel|NULL
--- /dev/null
+[D-BUS Service]
+Name=org.tizen.dialer
+Exec=@bindir@/dialer
+User=root
--- /dev/null
+Name=Phone
+Exec=@bindir@/dialer_open
+Icon=org.tizen.phone.png
+Type=Application
+MimeType=
+Nodisplay=False
+Version=0.1.0
+X-Tizen-TaskManage=True
+X-Tizen-Multiple=False
+X-Tizen-Removable=false
--- /dev/null
+#!/bin/sh -e
+#### BEGIN INIT INFO
+# Provides: Profusion
+# Required-Start: $remote_fs $syslog $all
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: This will start the ofono daemon
+### END INIT INFO
+#
+
+progname=ofonod
+execname=/usr/sbin/$progname
+options=""
+
+start() {
+ $execname $options
+ RETVAL=$?
+ sleep 3
+ dbus-send --system --print-reply --type=method_call --dest=org.ofono /phonesim \
+ org.ofono.Modem.SetProperty string:"Powered" variant:boolean:true
+
+ dbus-send --system --print-reply --type=method_call --dest=org.ofono /phonesim \
+ org.ofono.Modem.SetProperty string:"Online" variant:boolean:true
+
+ echo $RETVAL
+ return $RETVAL
+}
+
+start
+
+exit 0