Fix bugs
[platform/core/uifw/stt.git] / common / stt_engine.h
1 /*
2 *  Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3 *  Licensed under the Apache License, Version 2.0 (the "License");
4 *  you may not use this file except in compliance with the License.
5 *  You may obtain a copy of the License at
6 *  http://www.apache.org/licenses/LICENSE-2.0
7 *  Unless required by applicable law or agreed to in writing, software
8 *  distributed under the License is distributed on an "AS IS" BASIS,
9 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 *  See the License for the specific language governing permissions and
11 *  limitations under the License.
12 */
13
14
15
16 #ifndef __STT_ENGINE_H_
17 #define __STT_ENGINE_H_
18
19 #include <glib.h>
20 #include "sttp.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /*
27 * STT Engine Interfaces
28 */
29
30
31 /* Register engine id */
32 int stt_engine_load(int engine_id, const char* filepath);
33
34 /* Unregister engine id */
35 int stt_engine_unload(int engine_id);
36
37
38 /* Init / Deinit */
39 int stt_engine_initialize(int engine_id, sttpe_result_cb result_cb, sttpe_silence_detected_cb silence_cb);
40
41 int stt_engine_deinitialize(int engine_id);
42
43 /* Get option */
44 int stt_engine_get_supported_langs(int engine_id, GSList** lang_list);
45
46 int stt_engine_is_valid_language(int engine_id, const char* language, bool *is_valid);
47
48 int stt_engine_set_private_data(int engine_id, const char* key, const char* data);
49
50 int stt_engine_get_private_data(int engine_id, const char* key, char** data);
51
52 int stt_engine_get_first_language(int engine_id, char** language);
53
54 int stt_engine_support_silence(int engine_id, bool* support);
55
56 int stt_engine_need_app_credential(int engine_id, bool* need);
57
58 int stt_engine_support_recognition_type(int engine_id, const char* type, bool* support);
59
60 int stt_engine_get_audio_type(int engine_id, sttp_audio_type_e* types, int* rate, int* channels);
61
62 /* Set option */
63 int stt_engine_set_silence_detection(int engine_id, bool value);
64
65 /* Get right */
66 int stt_engine_check_app_agreed(int engine_id, const char* appid, bool* value);
67
68 /* Recognition */
69 int stt_engine_recognize_start(int engine_id, const char* lang, const char* recognition_type, const char* credential, void* user_param);
70
71 int stt_engine_set_recording_data(int engine_id, const void* data, unsigned int length);
72
73 int stt_engine_recognize_stop(int engine_id);
74
75 int stt_engine_recognize_cancel(int engine_id);
76
77 int stt_engine_foreach_result_time(int engine_id, void* time_info, sttpe_result_time_cb callback, void* user_data);
78
79
80 /* File recognition */
81 int stt_engine_recognize_start_file(int engine_id, const char* lang, const char* recognition_type, 
82                                 const char* filepath, sttp_audio_type_e audio_type, int sample_rate, void* user_param);
83
84 int stt_engine_recognize_cancel_file(int engine_id);
85
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* __STT_ENGINE_H_ */