2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUixSpeechSpeechToText.cpp
20 * @brief This is the implementation file for the SpeechToText class.
22 * This files contains implementation of the SpeechToText class.
25 #include <FLclLocale.h>
26 #include <FUixSpeechSpeechToText.h>
27 #include <FBaseSysLog.h>
28 #include <FUixSpeech_SpeechToTextImpl.h>
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Collection;
32 using namespace Tizen::Locales;
34 namespace Tizen { namespace Uix { namespace Speech
37 SpeechToText::SpeechToText(void)
38 : __pSpeechToTextImpl(null)
42 SpeechToText::~SpeechToText(void)
44 delete __pSpeechToTextImpl;
48 SpeechToText::Construct(ISpeechToTextEventListener& listener)
50 SysAssertf(__pSpeechToTextImpl == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class.");
52 __pSpeechToTextImpl = new (std::nothrow) _SpeechToTextImpl();
53 SysTryReturn(NID_UIX_SPEECH, __pSpeechToTextImpl != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
55 return __pSpeechToTextImpl->Construct(listener);
59 SpeechToText::Initialize(void)
61 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
63 return __pSpeechToTextImpl->Initialize();
67 SpeechToText::Start(void)
69 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
71 return __pSpeechToTextImpl->Start();
75 SpeechToText::Stop(void)
77 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
79 return __pSpeechToTextImpl->Stop();
83 SpeechToText::Cancel(void)
85 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
87 return __pSpeechToTextImpl->Cancel();
91 SpeechToText::SetLocale(const Locale& locale)
93 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
95 return __pSpeechToTextImpl->SetLocale(locale);
99 SpeechToText::GetLocale(void) const
101 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
103 return __pSpeechToTextImpl->GetLocale();
106 const Tizen::Base::Collection::IList*
107 SpeechToText::GetSupportedLocales(void) const
109 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
111 return __pSpeechToTextImpl->GetSupportedLocales();
115 SpeechToText::IsLocaleSupported(const Locale& locale) const
117 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
119 return __pSpeechToTextImpl->IsLocaleSupported(locale);
123 SpeechToText::SetGrammar(SpeechToTextGrammar grammar)
125 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
127 return __pSpeechToTextImpl->SetGrammar(grammar);
131 SpeechToText::GetGrammar(void) const
133 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
135 return __pSpeechToTextImpl->GetGrammar();
139 SpeechToText::SetSilenceDetectionEnabled(bool enable)
141 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
143 return __pSpeechToTextImpl->SetSilenceDetectionEnabled(enable);
147 SpeechToText::IsSilenceDetectionEnabled(void) const
149 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
151 return __pSpeechToTextImpl->IsSilenceDetectionEnabled();
155 SpeechToText::GetCurrentStatus(void) const
157 SysAssertf(__pSpeechToTextImpl != null, "Not yet constructed! Construct() should be called before use.");
159 return __pSpeechToTextImpl->GetCurrentStatus();
162 } } } // Tizen::Uix::Speech