2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
32 class SttException : public std::runtime_error {
35 SttException(int code, const char *reason)
36 : std::runtime_error(reason)
50 virtual ~ISttFeedback() = 0;
52 * Result event which can be overloaded
58 virtual void OnResult(
60 stt_result_event_e event,
61 std::vector<std::string> results,
64 virtual void AutoStart(void) = 0;
66 virtual void SttIdle(void) = 0;
68 virtual void SttRecording(void) = 0;
70 virtual void SttProcessing(void) = 0;
73 * Error event which can be overloaded
77 virtual void OnError(stt_error_e reason) = 0;
79 inline ISttFeedback::~ISttFeedback() { };
88 ISttFeedback& ifeedback;
94 SttManager(ISttFeedback& feedback);
99 * Prepare stt service.
105 * Unprepare stt service
134 bool Validate(int state);
138 * result cb for tizen stt api.
147 static void on_result(
149 stt_result_event_e event,
156 * state changed cb for tizen stt api.
163 static void on_state_changed(
165 stt_state_e previous,
170 * error cb for tizen stt api.
176 static void on_error(stt_h handle, stt_error_e reason, void *user_data);
179 * Setter language property
183 void SetLanguage(std::string language);
186 * Enable cb event or not
190 void EnableFeedback(bool enabled = true);
193 * Enable silence detect
197 void EnableSilenceDetection(bool enabled = false);
203 void SoundFeedback();
206 * Convert erroro code as string
209 * @return human readable string about error code.
211 const char *ErrorString(int ecode);
213 stt_state_e GetCurrent(void) {
216 stt_get_state(handle, &cur);
221 stt_h GetSttHandle() { return handle; }
224 static void PrintErrorState(stt_error_e reason);
225 static void PrintState(stt_state_e previous, stt_state_e current);
226 static void PrintResultState(stt_result_event_e result_type);
229 }} /** end of is::stt */