2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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.
18 #ifndef __STT_TEST_UTIL_H__
19 #define __STT_TEST_UTIL_H__
25 #include <stt_internal.h>
28 class SttTestUtility {
30 static void StateChangedCallback(stt_h stt, stt_state_e previous, stt_state_e current, void *user_data);
31 static void ErrorCallback(stt_h stt, stt_error_e reason, void *user_data);
32 static void RecognitionResultCallback(stt_h stt, stt_result_event_e event, const char** data, int data_count, const char* msg, void *user_data);
34 static void TerminateCurrentEngine();
35 static void WaitUntilEngineTerminated(int duration);
36 static bool IsFeatureSupported();
42 void GetTestPCMData();
52 bool Start(const char* language, const char* type);
54 bool StartAudioStreaming(const char* language, const char* type);
55 bool StopAudioStreaming();
58 bool IsStateChanged(stt_state_e targetState, int duration);
59 bool IsErrorOccurring(int duration);
60 bool IsResultReceived(int duration);
64 stt_state_e mCurrentState;
74 static bool WaitCondition(std::function<bool(void)> checker, int duration);
78 #endif /* __STT_TEST_UTIL_H__ */