Merge with Tizen 2.3
[platform/core/uifw/stt.git] / common / stt_engine.h
1 /*
2 *  Copyright (c) 2011-2014 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_get_first_language(int engine_id, char** language);
49
50 int stt_engine_support_silence(int engine_id, bool* support);
51
52 int stt_engine_support_recognition_type(int engine_id, const char* type, bool* support);
53
54 int stt_engine_get_audio_type(int engine_id, sttp_audio_type_e* types, int* rate, int* channels);
55
56 /* Set option */
57 int stt_engine_set_silence_detection(int engine_id, bool value);
58
59 /* Get right */
60 int stt_engine_check_app_agreed(int engine_id, const char* appid, bool* value);
61
62 /* Recognition */
63 int stt_engine_recognize_start(int engine_id, const char* lang, const char* recognition_type, void* user_param);
64
65 int stt_engine_set_recording_data(int engine_id, const void* data, unsigned int length);
66
67 int stt_engine_recognize_stop(int engine_id);
68
69 int stt_engine_recognize_cancel(int engine_id);
70
71 int stt_engine_foreach_result_time(int engine_id, void* time_info, sttpe_result_time_cb callback, void* user_data);
72
73
74 /* File recognition */
75 int stt_engine_recognize_start_file(int engine_id, const char* lang, const char* recognition_type, 
76                                 const char* filepath, sttp_audio_type_e audio_type, int sample_rate, void* user_param);
77
78 int stt_engine_recognize_cancel_file(int engine_id);
79
80
81 #ifdef __cplusplus
82 }
83 #endif
84
85 #endif /* __STT_ENGINE_H_ */