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 {
34 SttException(int code, const char *reason)
35 : std::runtime_error(reason)
48 virtual ~ISttFeedback() = 0;
50 * Result event which can be overloaded
56 virtual void OnResult(
58 stt_result_event_e event,
59 std::vector<std::string> results,
62 virtual void AutoStart(void) = 0;
64 virtual void SttIdle(void) = 0;
66 virtual void SttRecording(void) = 0;
68 virtual void SttProcessing(void) = 0;
71 * Error event which can be overloaded
75 virtual void OnError(stt_error_e reason) = 0;
77 inline ISttFeedback::~ISttFeedback() { };
86 ISttFeedback& ifeedback;
92 SttManager(ISttFeedback& feedback);
97 * Prepare stt service.
103 * Unprepare stt service
132 bool Validate(int state);
136 * result cb for tizen stt api.
145 static void on_result(
147 stt_result_event_e event,
154 * state changed cb for tizen stt api.
161 static void on_state_changed(
163 stt_state_e previous,
168 * error cb for tizen stt api.
174 static void on_error(stt_h handle, stt_error_e reason, void *user_data);
177 * Setter language property
181 void SetLanguage(std::string language);
184 * Enable cb event or not
188 void EnableFeedback(bool enabled = true);
191 * Enable silence detect
195 void EnableSilenceDetection(bool enabled = false);
201 void SoundFeedback();
204 * Convert erroro code as string
207 * @return human readable string about error code.
209 const char *ErrorString(int ecode);
211 stt_state_e GetCurrent(void) {
213 stt_get_state(handle, &cur);
218 stt_h GetSttHandle() { return handle; }
221 static void PrintErrorState(stt_error_e reason);
222 static void PrintState(stt_state_e previous, stt_state_e current);
223 static void PrintResultState(stt_result_event_e result_type);
224 static void ReleaseSoundFocus();
227 }} /** end of is::stt */