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 FUixSpeech_SpeechToTextImpl.h
20 * @brief This is the header file for the %_SpeechToTextImpl class.
22 * This header file contains the declarations of the %_SpeechToTextImpl class.
25 #ifndef _FUIX_SPEECH_INTERNAL_SPEECH_TO_TEXT_IMPL_H_
26 #define _FUIX_SPEECH_INTERNAL_SPEECH_TO_TEXT_IMPL_H_
29 #include <FBaseDataType.h>
30 #include <FBaseObject.h>
31 #include <FOspConfig.h>
32 #include <FUixSpeechSpeechToTextTypes.h>
33 #include <FUixSpeechISpeechToTextEventListener.h>
35 namespace Tizen { namespace Base
39 namespace Tizen { namespace Base { namespace Collection
43 namespace Tizen { namespace Locales
48 namespace Tizen { namespace Uix { namespace Speech
53 class _SpeechToTextImpl
56 _SpeechToTextImpl(void);
57 virtual ~_SpeechToTextImpl(void);
59 result Construct(ISpeechToTextEventListener& listener);
60 result Initialize(void);
66 result SetLocale(const Tizen::Locales::Locale& locale);
67 Tizen::Locales::Locale GetLocale(void) const;
68 bool IsLocaleSupported(const Tizen::Locales::Locale& locale) const;
69 const Tizen::Base::Collection::IList* GetSupportedLocales(void) const;
71 result SetGrammar(SpeechToTextGrammar grammar);
72 SpeechToTextGrammar GetGrammar(void) const;
74 result SetSilenceDetectionEnabled(bool enable);
75 bool IsSilenceDetectionEnabled(void) const;
77 SpeechToTextStatus GetCurrentStatus(void) const;
79 static _SpeechToTextImpl* GetInstance(SpeechToText& speechToText);
80 static const _SpeechToTextImpl* GetInstance(const SpeechToText& speechToText);
83 _SpeechToTextImpl(const _SpeechToTextImpl& rhs);
84 _SpeechToTextImpl& operator =(const _SpeechToTextImpl& rhs);
86 static void SttResultReceiver(stt_h sttHandle, const char* type, const char* data[], int dataCount, const char* msg, void* pListener);
87 static void SttPartialResultReceiver(stt_h sttHandle, const char* data, void* pListener);
88 static void SttStateChangedReceiver(stt_h sttHandle, stt_state_e previousState, stt_state_e currentState, void* pSttInstance);
89 static void SttErrorReceiver(stt_h sttHandle, stt_error_e error, void* pListener);
90 static bool SttSupportedLocaleListGetter(stt_h sttHandle, const char* language, void* pLocaleList);
92 static const char* GetEngineErrorMessage(const int type);
93 static const char* GetEngineStateMessage(const stt_state_e state);
95 static const Tizen::Locales::Locale* ConvertEngineLocaleToOspN(const Tizen::Base::String& strSource);
96 static const char* ConvertOspLocaleToEngineN(const Tizen::Locales::Locale& locale);
98 static const char* ConvertOspRecognitionTypeToEngine(SpeechToTextGrammar grammar);
100 stt_option_silence_detection_e ConvertOspSilenceDetectionTypeToEngine(bool silenceDetectionType);
104 ISpeechToTextEventListener* __pSpeechToTextListener;
106 Tizen::Locales::Locale* __pCurrentLocale;
107 SpeechToTextGrammar __grammar;
108 Tizen::Base::Collection::IList* __pSupportedLocaleList;
110 bool __isInitialized;
111 bool __isSilenceDetection;
112 SpeechToTextStatus __currentStatus;
114 }; // _SpeechToTextImpl
116 } } } // Tizen::Uix::Speech