From: Shilpa Singh Date: Wed, 11 May 2016 09:14:14 +0000 (+0530) Subject: [e-mod-tizen-screen-reader]: 1. Bus name update, 2. function name update, 3. predefin... X-Git-Tag: accepted/tizen/common/20160524.150219^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4ddecb00556356723f2690ecc9fe1e0acfe1e52;p=platform%2Fcore%2Fuifw%2Fe-mod-tizen-screen-reader.git [e-mod-tizen-screen-reader]: 1. Bus name update, 2. function name update, 3. predefined signal added . Change-Id: I595a48bab9d1ad132052da9e82c10e49da68a0d8 Signed-off-by: Shilpa Singh --- diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 031fb09..ceca36b 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -4,13 +4,9 @@ #include #include -#define E_A11Y_SERVICE_BUS_NAME "org.enlightnement.wm-screen-reader" +#define E_A11Y_SERVICE_BUS_NAME "org.enlightenment.wm-screen-reader" #define E_A11Y_SERVICE_NAVI_IFC_NAME "org.tizen.GestureNavigation" #define E_A11Y_SERVICE_NAVI_OBJ_PATH "/org/tizen/GestureNavigation" -#define E_A11Y_SERVICE_TRACKER_IFC_NAME "org.tizen.WindowTracker" -#define E_A11Y_SERVICE_TRACKER_OBJ_PATH "/org/tizen/WindowTracker" - -#define E_ATSPI_BUS_TIMEOUT 4000 #undef DBG int _eina_log_dom = 0; @@ -19,6 +15,7 @@ int _eina_log_dom = 0; static Eina_Bool g_gesture_navi; static Eina_List *handlers; Eldbus_Connection *conn = NULL; +Eldbus_Service_Interface *iface = NULL; EAPI E_Module_Api e_modapi = { @@ -26,6 +23,32 @@ EAPI E_Module_Api e_modapi = "Screen Reader Module of Window Manager" }; +#define GESTURE_DETECTED_SIGNAL 0 +static Eldbus_Message *_sc_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg); + +static const Eldbus_Method methods[] = { + { "ScreenReaderEnabled", ELDBUS_ARGS({"b", "bool"}), ELDBUS_ARGS({"b", "bool"}), + _sc_enable + }, + { } +}; + + +static const Eldbus_Signal signals[] = { + [GESTURE_DETECTED_SIGNAL] = {"GestureDetected", + ELDBUS_ARGS({"i", "type"}, + {"i", "x_beg"},{"i", "y_beg"}, + {"i", "x_end"}, {"i", "y_end"}, + {"i", "state"}, {"u", "event_time"}), + 0}, + { } +}; + +static const Eldbus_Service_Interface_Desc iface_desc = { + E_A11Y_SERVICE_NAVI_IFC_NAME, methods, signals +}; + + /* Use this util function for gesture enum to string conversion */ static const char *_gesture_enum_to_string(Gesture g) { @@ -113,26 +136,14 @@ int _e_mod_atspi_dbus_broadcast(Gesture_Info *gi) { /* Implement this for gesture broadcast */ DEBUG("atspi bus broadcast callback"); - const char *name; - Eldbus_Message *msg; - if (!conn) return -1; - name = _gesture_enum_to_string(gi->type); - if (!name) return -1; - - msg = eldbus_message_signal_new(E_A11Y_SERVICE_NAVI_OBJ_PATH, - E_A11Y_SERVICE_NAVI_IFC_NAME, "GestureDetected"); - if (!msg) return -1; + if (!iface) return -1; - if (!eldbus_message_arguments_append(msg, "iiiiiiu", (int)gi->type, gi->x_beg, gi->y_beg, gi->x_end, gi->y_end, gi->state, gi->event_time)) - { - eldbus_message_unref(msg); - INFO("Append failed"); - return -1; - } + eldbus_service_signal_emit(iface, GESTURE_DETECTED_SIGNAL, (int)gi->type, gi->x_beg, gi->y_beg, + gi->x_end, gi->y_end, gi->state, gi->event_time); - eldbus_connection_send(conn, msg, NULL, NULL, 0); - INFO("GestureDetected %s %d (%d %d %d %d %d %u)", name, (int)gi->type, gi->x_beg, gi->y_beg, gi->x_end, gi->y_end, gi->state, gi->event_time); + INFO("GestureDetected %s %d (%d %d %d %d %d %u)", _gesture_enum_to_string(gi->type), + (int)gi->type, gi->x_beg, gi->y_beg, gi->x_end, gi->y_end, gi->state, gi->event_time); return 0; } @@ -150,7 +161,7 @@ _gesture_cb(void *data, } static void -_events_init(void) +_atspi_gesture_init(void) { #define HANDLER_APPEND(event, cb) \ handlers = eina_list_append( \ @@ -161,7 +172,7 @@ _events_init(void) } static void -_events_shutdown(void) +_atspi_gesture_shutdown(void) { E_FREE_LIST(handlers, ecore_event_handler_del); } @@ -188,8 +199,10 @@ _e_mod_submodules_init(void) if (_e_mod_atspi_gestures_init()) goto fail_gestures; + _atspi_gesture_init(); g_gesture_navi = EINA_TRUE; return 0; + fail_gestures: ERROR("Gestures submodule initialization failed."); _e_mod_atspi_config_shutdown(); @@ -202,6 +215,7 @@ static void _e_mod_submodules_shutdown(void) { INFO("Shutdown subsystems..."); + _atspi_gesture_shutdown(); g_gesture_navi = EINA_FALSE; _e_mod_atspi_config_save(); _e_mod_atspi_config_shutdown(); @@ -214,40 +228,26 @@ _sc_enable(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg) { INFO("iface=%p.", iface); INFO("_sc_enable Method called"); - Eldbus_Message *reply = eldbus_message_method_return_new(msg); Eina_Bool bool_val = EINA_FALSE; if (!eldbus_message_arguments_get(msg, "b", &bool_val)) - printf("eldbus_message_arguments_get() error\n"); - eldbus_message_arguments_append(reply, "b", bool_val); + ERROR("eldbus_message_arguments_get() error\n"); if (bool_val) - { - INFO("Initialize events"); - _e_mod_submodules_init(); - } + { + INFO("Initialize events"); + _e_mod_submodules_init(); + } else - { - INFO("Shutdown events"); - _e_mod_submodules_shutdown(); - } - return reply; + { + INFO("Shutdown events"); + _e_mod_submodules_shutdown(); + } + return NULL; } -static const Eldbus_Method methods[] = { - { "ScreenReaderEnabled", ELDBUS_ARGS({"b", "bool"}), ELDBUS_ARGS({"b", "bool"}), - _sc_enable - }, - { } -}; - -static const Eldbus_Service_Interface_Desc iface_desc = { - E_A11Y_SERVICE_NAVI_IFC_NAME, methods -}; - static int _fetch_a11y_bus_address(void) { if (conn) return 0; - Eldbus_Service_Interface *iface = NULL; conn = eldbus_address_connection_get("unix:path=/var/run/dbus/system_bus_socket"); if (!conn) { diff --git a/src/e_screen_reader_gestures.c b/src/e_screen_reader_gestures.c index f3d294f..bb6c61d 100644 --- a/src/e_screen_reader_gestures.c +++ b/src/e_screen_reader_gestures.c @@ -1202,8 +1202,6 @@ _events_shutdown(void) static void _gesture_init() { - DEBUG("Gesture Rect Creation init."); - cover = E_NEW(Cover, 1); if (!cover) {