From 6b2f3bb420bd465eac9a86be21d2e8b62057fad0 Mon Sep 17 00:00:00 2001 From: "santhosh.au" Date: Tue, 16 Apr 2013 13:36:55 +0530 Subject: [PATCH] updated with E_UNSUPPORTED_OPERATION error value Change-Id: I283de3401fe363b23b1e3eb73a4d198df2cc92d4 Signed-off-by: santhosh.au --- src/stt/FUixSpeech_SpeechToTextImpl.cpp | 8 +++++++- src/tts/FUixSpeech_TextToSpeechImpl.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/stt/FUixSpeech_SpeechToTextImpl.cpp b/src/stt/FUixSpeech_SpeechToTextImpl.cpp index 11cb404..ad1a958 100644 --- a/src/stt/FUixSpeech_SpeechToTextImpl.cpp +++ b/src/stt/FUixSpeech_SpeechToTextImpl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ using namespace Tizen::Base; using namespace Tizen::Base::Collection; using namespace Tizen::Locales; +using namespace Tizen::System; namespace Tizen { namespace Uix { namespace Speech { @@ -265,9 +267,13 @@ _SpeechToTextImpl::Construct(ISpeechToTextEventListener& listener) result _SpeechToTextImpl::Initialize(void) { - SysAssertf(__isInitialized != true, + bool isSupported; + SysAssertf(__isInitialized != true, "Already calling Initialize() twice or more on a same instance is not allowed for this class."); + Tizen::System::SystemInfo::GetValue("http://tizen.org/feature/speech.recognition", isSupported); + SysTryReturnResult(NID_UIX_SPEECH, isSupported == true, E_UNSUPPORTED_OPERATION, "The STT is Not supported"); + int sttError = stt_set_error_cb(__sttHandle, SttErrorReceiver, __pSpeechToTextListener); SysTryLog(NID_UIX_SPEECH, sttError == STT_ERROR_NONE, "[%s] Failed to set the error callback.", GetEngineErrorMessage(sttError)); SysTryReturnResult(NID_UIX_SPEECH, sttError == STT_ERROR_NONE, E_OUT_OF_MEMORY, "The memory is insufficient."); diff --git a/src/tts/FUixSpeech_TextToSpeechImpl.cpp b/src/tts/FUixSpeech_TextToSpeechImpl.cpp index c87acde..684a112 100644 --- a/src/tts/FUixSpeech_TextToSpeechImpl.cpp +++ b/src/tts/FUixSpeech_TextToSpeechImpl.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ using namespace Tizen::Base; using namespace Tizen::Base::Collection; using namespace Tizen::Locales; +using namespace Tizen::System; #ifdef __cplusplus extern "C" @@ -287,9 +289,13 @@ _TextToSpeechImpl::Construct(ITextToSpeechEventListener& listener) result _TextToSpeechImpl::Initialize(void) { + bool isSupported; SysAssertf(__isInitialized != true, "Already calling Initialize() twice or more on a same instance is not allowed for this class."); + Tizen::System::SystemInfo::GetValue("http://tizen.org/feature/speech.synthesis", isSupported); + SysTryReturnResult(NID_UIX_SPEECH, isSupported == true, E_UNSUPPORTED_OPERATION, "The TTS is Not supported"); + int ttsError = tts_set_error_cb(__ttsHandle, TtsErrorReceiver, (void*)(__pTextToSpeechListener)); SysTryLog(NID_UIX_SPEECH, ttsError == TTS_ERROR_NONE, "[%s] Failed to set the error callback.", GetEngineErrorMessage(ttsError)); SysTryReturnResult(NID_UIX_SPEECH, ttsError == TTS_ERROR_NONE, E_OUT_OF_MEMORY, "The memory is insufficient."); -- 2.7.4