From: sungwook79.park Date: Fri, 9 Sep 2016 02:41:18 +0000 (+0900) Subject: Delete unused file X-Git-Tag: accepted/tizen/common/20160912.181453~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab8c757e63473d0c4a7bd591091542f24937db4a;p=platform%2Fcore%2Fuifw%2Fise-default.git Delete unused file Change-Id: I9788a47a1d0a7e3f292501d4b8b7146fedd48ada Signed-off-by: sungwook79.park --- diff --git a/src/ise-stt-engine.cpp b/src/ise-stt-engine.cpp deleted file mode 100644 index aee2088..0000000 --- a/src/ise-stt-engine.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ise.h" -#include "ise-stt-engine.h" -#include "ise-stt-option.h" - -stt_h g_stt = NULL; -char *language; - -const char* ErrorString(int ecode); - -static Eina_Bool __stt_get_volume(void *data) -{ - float volume = 0.0; - if (!g_stt) { - LOGW("STT handle is NULL\n"); - return EINA_FALSE; - } - - int ret = stt_get_recording_volume(g_stt, &volume); - if (STT_ERROR_NONE != ret) { - LOGW("[ERROR] Fail to get volume : err = %s", ErrorString((stt_error_e)ret)); - return EINA_FALSE; - } - - LOGD("Get volume : %f", volume); - - return EINA_TRUE; -} - -static Eina_Bool __stt_start(void *data) -{ - int ret; - - if (!g_stt) { - LOGW("STT handle is NULL\n"); - return EINA_FALSE; - } - - LOGD("STT set silence detection"); - ret = stt_set_silence_detection(g_stt, STT_OPTION_SILENCE_DETECTION_TRUE); - if (STT_ERROR_NONE != ret) { - LOGW("[ERROR] Fail to set silence detection : err = %s", ErrorString((stt_error_e)ret)); - } - - LOGD("STT start"); - ret = stt_start(g_stt, language, STT_RECOGNITION_TYPE_FREE); - if (STT_ERROR_NONE != ret) { - LOGW("[ERROR] Fail to start : err = %s", ErrorString((stt_error_e)ret)); - } - - ecore_timer_add(0.1, __stt_get_volume, NULL); - - return EINA_FALSE; -} - -static void __stt_state_changed_cb(stt_h stt, stt_state_e previous, stt_state_e current, void* user_data) -{ - if (STT_STATE_CREATED == previous && STT_STATE_READY == current) { - LOGD("State is Created -> Ready"); - ecore_timer_add(0, __stt_start, NULL); - } -} - -static void __stt_finalize(void *data) -{ - int ret; - LOGD("STT destroy"); - if (g_stt) { - ret = stt_unprepare(g_stt); - if (STT_ERROR_NONE != ret) { - LOGW("[ERROR] Fail to stt unprepare : err = %s", ErrorString((stt_error_e)ret)); - } - ret = stt_destroy(g_stt); - if (STT_ERROR_NONE != ret) { - LOGW("[ERROR] Fail to stt destroy : err = %s", ErrorString((stt_error_e)ret)); - } - } -} - -static void __stt_recognition_result_cb(stt_h stt, stt_result_event_e event, const char** data, int data_count, const char* msg, void *user_data) -{ - LOGD("==== STT result cb ===="); - - if (NULL != data) { - LOGD("( %s )", data[0]); - ise_send_string(data[0]); - } -} - -const char* ErrorString(int ecode) { - const char *str = NULL; - - switch (ecode) { - case STT_ERROR_OUT_OF_MEMORY: - str = (const char *) "STT_ERROR_OUT_OF_MEMORY"; - break; - case STT_ERROR_IO_ERROR: - str = (const char *) "STT_ERROR_IO_ERROR"; - break; - case STT_ERROR_INVALID_PARAMETER: - str = (const char *) "STT_ERROR_INVALID_PARAMETER"; - break; - case STT_ERROR_TIMED_OUT: - str = (const char *) "STT_ERROR_TIMED_OUT"; - break; - case STT_ERROR_RECORDER_BUSY: - str = (const char *) "STT_ERROR_RECORDER_BUSY"; - break; - case STT_ERROR_OUT_OF_NETWORK: - str = (const char *) "STT_ERROR_OUT_OF_NETWORK"; - break; - case STT_ERROR_INVALID_STATE: - str = (const char *) " STT_ERROR_INVALID_STATE"; - break; - case STT_ERROR_INVALID_LANGUAGE: - str = (const char *) "STT_ERROR_INVALID_LANGUAGE"; - break; - case STT_ERROR_ENGINE_NOT_FOUND: - str = (const char *) "STT_ERROR_ENGINE_NOT_FOUND"; - break; - case STT_ERROR_OPERATION_FAILED: - str = (const char *) "STT_ERROR_OPERATION_FAILED"; - break; - case STT_ERROR_NOT_SUPPORTED_FEATURE: - str = (const char *) "STT_ERROR_NOT_SUPPORTED_FEATURE"; - break; - } - return str; -} - -void ise_stt_start() -{ - int ret; - - language = get_stt_default_language(); - - LOGD("STT Create"); - ret = stt_create(&g_stt); - if (STT_ERROR_NONE != ret) { - LOGW("Fail to create : err = %s", ErrorString((stt_error_e)ret)); - return; - } - - LOGD("Set callback"); - ret = stt_set_state_changed_cb(g_stt, __stt_state_changed_cb, NULL); - if (STT_ERROR_NONE != ret) { - stt_destroy(g_stt); - LOGW("Fail to set state changed cb : err = %s", ErrorString((stt_error_e)ret)); - return; - } - - ret = stt_set_recognition_result_cb(g_stt, __stt_recognition_result_cb, NULL); - if (STT_ERROR_NONE != ret) { - stt_destroy(g_stt); - LOGW("Fail to set recognition result cb : err = %s", ErrorString((stt_error_e)ret)); - return; - } - - LOGD("STT prepare"); - ret = stt_prepare(g_stt); - if (STT_ERROR_NONE != ret) { - stt_destroy(g_stt); - LOGW("Fail to prepare : err = %s", ErrorString((stt_error_e)ret)); - return; - } -} - -void ise_stt_finish() -{ - __stt_finalize(NULL); -}