[OAPAF-251] Implement A11Y-SCRRD-MOB-FREQ-011, pause / resume the speech
authorMichal Skorupinski <m.skorupinsk@samsung.com>
Tue, 16 Jun 2015 13:14:13 +0000 (15:14 +0200)
committerMichal Skorupinski <m.skorupinsk@samsung.com>
Thu, 25 Jun 2015 12:39:19 +0000 (14:39 +0200)
Change-Id: If25f3b8c693fd36b7379919f1e3b9f72571b8368
Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
include/screen_reader_tts.h
src/navigator.c
src/screen_reader_tts.c

index dd8cbb2..00e4405 100644 (file)
@@ -14,4 +14,7 @@ void state_changed_cb(tts_h tts, tts_state_e previous, tts_state_e current, void
 Eina_Bool tts_speak(char *text_to_speak, Eina_Bool flush_switch);
 void spi_stop(void *data);
 
+Eina_Bool tts_pause_get(void);
+Eina_Bool tts_pause_set(Eina_Bool pause_switch);
+
 #endif /* SCREEN_READER_TTS_H_ */
index 87f4677..5e90eb6 100644 (file)
@@ -1369,6 +1369,21 @@ static void _read_quickpanel(void )
    DEBUG("END");
 }
 
+static void _set_pause(void )
+{
+   DEBUG("START");
+
+   Eina_Bool res = EINA_FALSE;
+   bool pause = tts_pause_get();
+   res = tts_pause_set(!pause);
+   if(!res)
+      {
+         ERROR("Failed to set pause state");
+      }
+
+   DEBUG("END");
+}
+
 static void
 _direct_scroll_back(void)
 {
@@ -1596,6 +1611,9 @@ static void on_gesture_detected(void *data, Gesture_Info *info)
       case ONE_FINGER_DOUBLE_TAP:
          _activate_widget();
          break;
+      case TWO_FINGERS_SINGLE_TAP:
+         _set_pause();
+         break;
       case TWO_FINGERS_TRIPLE_TAP:
          _read_quickpanel();
          break;
index 5a3a5f6..49eeb73 100644 (file)
@@ -114,6 +114,13 @@ static void __tts_test_utt_completed_cb(tts_h tts, int utt_id, void* user_data)
          if(flush_flag)
             flush_flag = EINA_FALSE;
       }
+
+   if(last_utt_id == utt_id)
+      {
+         DEBUG("LAST UTTERANCE");
+         pause_state = EINA_FALSE;
+      }
+
    return;
 }
 
@@ -140,6 +147,13 @@ bool tts_init(void *data)
    return true;
 }
 
+Eina_Bool tts_pause_get(void)
+{
+   DEBUG( "PAUSE STATE: %d", pause_state);
+   return pause_state;
+}
+
+
 Eina_Bool tts_pause_set(Eina_Bool pause_switch)
 {
    Service_Data *sd = get_pointer_to_service_data_struct();
@@ -148,17 +162,23 @@ Eina_Bool tts_pause_set(Eina_Bool pause_switch)
 
    if(pause_switch)
       {
-         if(!tts_pause(sd->tts))
-            pause_state = EINA_TRUE;
-         else
-            return EINA_FALSE;
+         pause_state = EINA_TRUE;
+
+         if(tts_pause(sd->tts))
+            {
+               pause_state = EINA_FALSE;
+               return EINA_FALSE;
+            }
       }
    else if(!pause_switch)
       {
-         if(!tts_play(sd->tts))
-            pause_state = EINA_FALSE;
-         else
-            return EINA_FALSE;
+         pause_state = EINA_FALSE;
+
+         if(tts_play(sd->tts))
+            {
+               pause_state = EINA_TRUE;
+               return EINA_FALSE;
+            }
       }
    return EINA_TRUE;
 }