[Screen-reader]: Play sound on start/end of focus shift and on highlight of object. 01/79501/4
authorShilpa Singh <shilpa.singh@samsung.com>
Mon, 11 Jul 2016 13:45:06 +0000 (19:15 +0530)
committerShilpa Singh <shilpa.singh@samsung.com>
Tue, 12 Jul 2016 06:24:14 +0000 (11:54 +0530)
Change-Id: I57b2434f4e3d6a7781bd913b2520f1420c9eca32
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
include/smart_notification.h
src/flat_navi.c
src/navigator.c
src/smart_notification.c
tests/CMakeLists.txt
tests/smart_navi_suite.c

index 7255419a1b2b6e3fedceca18c6dfb969c1c71c20..380fb2fdce1de32b6a247294f244bc461a5da688 100644 (file)
@@ -14,6 +14,7 @@ enum _Notification_Type
 {
    FOCUS_CHAIN_END_NOTIFICATION_EVENT,
    REALIZED_ITEMS_NOTIFICATION_EVENT,
+   HIGHLIGHT_NOTIFICATION_EVENT
 };
 
 typedef enum _Notification_Type Notification_Type;
index 7b94e179663cb71187c401daa46e21b729d639c3..e102fbd04c9cfa74a129a9307c1c014e26c448af 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "flat_navi.h"
 #include "logger.h"
+#include "smart_notification.h"
 
 struct _FlatNaviContext {
        AtspiAccessible *root;
@@ -571,6 +572,7 @@ AtspiAccessible *_next(FlatNaviContext * ctx)
        if (current && !ret) {
                DEBUG("Last item reached, pass last item again");
                ret = current;
+               smart_notification(FOCUS_CHAIN_END_NOTIFICATION_EVENT, 0, 0);
        }
        return ret;
 }
@@ -586,6 +588,7 @@ AtspiAccessible *_prev(FlatNaviContext * ctx)
        if (current && !ret) {
                DEBUG("first item reached, pass first item again");
                ret = current;
+               smart_notification(FOCUS_CHAIN_END_NOTIFICATION_EVENT, 0, 0);
        }
        return ret;
 }
index 73740c5e451ee75172734ab2f14945aca4919282..279084b803fff2d34f6e33eec8f11506e17e47ab 100755 (executable)
@@ -924,6 +924,11 @@ static void _current_highlight_object_set(AtspiAccessible * obj)
                if (current_comp) {
                        atspi_component_clear_highlight(current_comp, &err);
                }
+
+               smart_notification(HIGHLIGHT_NOTIFICATION_EVENT, 0, 0);
+               if (haptic)
+                       haptic_vibrate_start(HAPTIC_VIBRATE_DURATION, HAPTIC_VIBRATE_INTENSITY);
+
                role = atspi_accessible_get_role(obj, NULL);
                if (role != ATSPI_ROLE_PAGE_TAB) {
                        atspi_component_grab_highlight(comp, &err);
@@ -2307,9 +2312,6 @@ static void _new_highlighted_obj_changed(AtspiAccessible * new_highlighted_obj,
        if (context && flat_navi_context_current_get(context) != new_highlighted_obj) {
                flat_navi_context_current_set(context, g_object_ref(new_highlighted_obj));
        }
-       if (haptic)
-               haptic_vibrate_start(HAPTIC_VIBRATE_DURATION, HAPTIC_VIBRATE_INTENSITY);
-
 }
 
 void clear(gpointer d)
index 70b0a16a905af748ab093d5feabc59ba0127af59..728041e4ca38598f8d6c786c7a6acfd3feeae0e3 100644 (file)
@@ -31,6 +31,7 @@ static Eina_Bool status = EINA_FALSE;
 
 static void _smart_notification_focus_chain_end(void);
 static void _smart_notification_realized_items(int start_idx, int end_idx);
+static void _smart_notification_highlight(void);
 
 /**
  * @brief Smart Notifications event handler
@@ -52,6 +53,9 @@ void smart_notification(Notification_Type nt, int start_index, int end_index)
        case REALIZED_ITEMS_NOTIFICATION_EVENT:
                _smart_notification_realized_items(start_index, end_index);
                break;
+       case HIGHLIGHT_NOTIFICATION_EVENT:
+               _smart_notification_highlight();
+               break;
        default:
                DEBUG("Gesture type %d not handled in switch", nt);
        }
@@ -175,6 +179,21 @@ static void _smart_notification_focus_chain_end(void)
        tone_player_start(TONE_TYPE_SUP_CONFIRM, SOUND_TYPE_MEDIA, 200, NULL);
 }
 
+/**
+ * @brief Smart notifications hightlight event handler
+ *
+ */
+static void _smart_notification_highlight(void)
+{
+       if (!status)
+               return;
+
+       DEBUG(RED "Smart notification - HIGHLIGHT" RESET);
+
+       tone_player_stop(0);
+       tone_player_start(TONE_TYPE_PROP_BEEP, SOUND_TYPE_MEDIA, 200, NULL);
+}
+
 /**
  * @brief Smart notifications realized items event handler
  *
index 75034d8154927c35dac64ad622d45f8bed9b38c9..64e2eb0e99b71c8be0ed1b308419b993cf5160b2 100644 (file)
@@ -21,6 +21,8 @@ pkg_check_modules(tests REQUIRED
     check
     vconf
     elementary
+    capi-media-tone-player
+    capi-system-device
 )
 
 FOREACH(flag ${tests_CFLAGS})
@@ -35,6 +37,8 @@ SET(TESTED_SRCS ${CMAKE_SOURCE_DIR}/src/screen_reader.c
                 ${CMAKE_SOURCE_DIR}/src/screen_reader_vconf.c
                 ${CMAKE_SOURCE_DIR}/src/screen_reader_spi.c
                 ${CMAKE_SOURCE_DIR}/src/screen_reader_tts.c
+                ${CMAKE_SOURCE_DIR}/src/screen_reader_haptic.c
+                ${CMAKE_SOURCE_DIR}/src/smart_notification.c
                 ${CMAKE_SOURCE_DIR}/src/flat_navi.c)
 ADD_DEFINITIONS(-DSCREEN_READER_FLAT_NAVI_TEST_DUMMY_IMPLEMENTATION)
 
index 9edf9cc9ffc54637230265ecd71e68f3deb91963..b813ac7dd4495376867eac22ac8bb64b50d98de3 100644 (file)
@@ -15,6 +15,8 @@
  */
 
 #include "screen_reader_spi.h"
+#include "screen_reader_haptic.h"
+#include "smart_notification.h"
 #include "flat_navi.h"
 #include <check.h>
 #include <stdio.h>