Disable voicetyping in no asr and nlu agents 54/225454/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 20 Feb 2020 05:24:19 +0000 (14:24 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 20 Feb 2020 05:35:48 +0000 (14:35 +0900)
Change-Id: Id651d8c5aee80313372332e7202680691197d648
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/ise-stt-mode.cpp
src/ise.cpp
src/voicetyping.cpp

index 44a5979..e972eb1 100644 (file)
@@ -50,6 +50,8 @@ extern CONFIG_VALUES g_config_values;
 
 static bool g_voicetyping_mode = false;
 
+extern bool g_support_voicetyping;
+
 extern sclu32 _context_layout;
 extern sclu32 _context_layout_variation;
 
@@ -786,26 +788,30 @@ Evas_Object *create_fullview(Evas_Object *win, VoiceData *r_voicedata)
     if (_context_layout == ISE_LAYOUT_STYLE_EMAIL ||
         _context_layout == ISE_LAYOUT_STYLE_PASSWORD) {
 #ifdef SUPPORT_VOICETYPING
-        LOGD("voicetyping mode");
-        g_voicetyping_mode = true;
+        if (g_support_voicetyping) {
+            LOGD("voicetyping mode");
+            g_voicetyping_mode = true;
 
-        ret = VoiceTyping::getInstance()->set_locale("ko-KR");
-        if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) {
-            LOGE("Failed to set locale (%d)", ret);
-        }
+            ret = VoiceTyping::getInstance()->set_locale("ko-KR");
+            if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) {
+                LOGE("Failed to set locale (%d)", ret);
+            }
 
-        VoiceTyping::getInstance()->set_result_cb(vt_result_cb, NULL);
-        if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) {
-            LOGE("Failed to set result callback (%d)", ret);
-        }
+            VoiceTyping::getInstance()->set_result_cb(vt_result_cb, NULL);
+            if (ret != SAMSUNG_AI_VOICETYPING_ERROR_NONE) {
+                LOGE("Failed to set result callback (%d)", ret);
+            }
 
-        VoiceTyping::getInstance()->set_state_changed_cb(vt_state_changed_cb, voicedata);
+            VoiceTyping::getInstance()->set_state_changed_cb(vt_state_changed_cb, voicedata);
 
-        samsung_ai_voicetyping_state_e state = SAMSUNG_AI_VOICETYPING_STATE_NONE;
-        VoiceTyping::getInstance()->get_state(&state);
-        if (SAMSUNG_AI_VOICETYPING_STATE_READY == state) {
-            VoiceTyping::getInstance()->start();
+            samsung_ai_voicetyping_state_e state = SAMSUNG_AI_VOICETYPING_STATE_NONE;
+            VoiceTyping::getInstance()->get_state(&state);
+            if (SAMSUNG_AI_VOICETYPING_STATE_READY == state) {
+                VoiceTyping::getInstance()->start();
+            }
         }
+        else
+            g_voicetyping_mode = false;
 #else
         LOGD("non voice typing mode");
 #endif
index 8d2b218..20cdf47 100644 (file)
@@ -69,6 +69,7 @@ static sclboolean g_set_mime_type = FALSE;
 #endif
 
 int g_imdata_state = 0;
+bool g_support_voicetyping = false;
 
 extern emoticon_group_t current_emoticon_group;
 extern std::vector <int> emoticon_list_recent;
@@ -2003,7 +2004,8 @@ ise_create()
     }
 
 #ifdef SUPPORT_VOICETYPING
-    VoiceTyping::getInstance()->init(vt_connection_status_changed_cb, NULL);
+    if (VoiceTyping::getInstance()->init(vt_connection_status_changed_cb, NULL) == SAMSUNG_AI_VOICETYPING_ERROR_NONE)
+        g_support_voicetyping = true;
 #endif
 
     init_recent_used_punctuation();
index 40ec200..8ad8bbd 100644 (file)
@@ -73,12 +73,24 @@ int VoiceTyping::init(voicetyping_connection_status_changed_cb callback, void *u
         case SAMSUNG_AI_VOICETYPING_ERROR_NONE:
             LOGD("[VT] Succeed to initialize voice typing");
             break;
-        case SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED:
-            LOGE("[VT] permission denied");
-            break;
         case SAMSUNG_AI_VOICETYPING_ERROR_NOT_SUPPORTED:
             LOGE("[VT] Not support");
             break;
+        case SAMSUNG_AI_VOICETYPING_ERROR_INVALID_PARAMETER:
+            LOGE("[VT] Invalid parameter");
+            break;
+        case SAMSUNG_AI_VOICETYPING_ERROR_PERMISSION_DENIED:
+            LOGE("[VT] Permission denied");
+            break;
+        case SAMSUNG_AI_VOICETYPING_ERROR_SERVICE_UNAVAILABLE:
+            LOGE("[VT] Service unavilable");
+            break;
+        case SAMSUNG_AI_VOICETYPING_ERROR_OUT_OF_MEMORY:
+            LOGE("[VT] Out of memory");
+            break;
+        case SAMSUNG_AI_VOICETYPING_ERROR_OPERATION_FAILED:
+            LOGE("[VT] Operation failed");
+            break;
         default:
             LOGE("[VT] Failed to initialize voice typing. error: %d", ret);
             break;