f8b1a08ae262eb41b9bd0df57f5516e0fc269bf2
[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 "stte.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26
27 typedef int (*stt_engine_result_cb)(stte_result_event_e event, const char* type, const char** data, int data_count,
28                                 const char* msg, void* time_info, void* user_data);
29
30 /*
31 * STT Engine Interfaces
32 */
33
34
35 /* Register engine id */
36 int stt_engine_load(const char* filepath, stte_request_callback_s *callback);
37
38 /* Unregister engine id */
39 int stt_engine_unload();
40
41
42 /* Init / Deinit */
43 int stt_engine_initialize(bool is_from_lib);
44
45 int stt_engine_deinitialize();
46
47 /* Get option */
48 int stt_engine_get_supported_langs(GSList** lang_list);
49
50 int stt_engine_is_valid_language(const char* language, bool *is_valid);
51
52 int stt_engine_set_private_data(const char* key, const char* data);
53
54 int stt_engine_get_private_data(const char* key, char** data);
55
56 int stt_engine_get_first_language(char** language);
57
58 int stt_engine_support_silence(bool* support);
59
60 int stt_engine_need_app_credential(bool* need);
61
62 int stt_engine_support_recognition_type(const char* type, bool* support);
63
64 int stt_engine_get_audio_type(stte_audio_type_e* types, int* rate, int* channels);
65
66 /* Set option */
67 int stt_engine_set_silence_detection(bool value);
68
69 /* Get right */
70 int stt_engine_check_app_agreed(const char* appid, bool* is_agreed);
71
72 /* Recognition */
73 int stt_engine_recognize_start(const char* lang, const char* recognition_type, const char* appid, const char* credential, void* user_param);
74
75 int stt_engine_set_recording_data(const void* data, unsigned int length);
76
77 int stt_engine_recognize_stop();
78
79 int stt_engine_recognize_cancel();
80
81 int stt_engine_foreach_result_time(void* time_info, stte_result_time_cb callback, void* user_data);
82
83
84 /* File recognition */
85 int stt_engine_recognize_start_file(const char* lang, const char* recognition_type, 
86                                 const char* filepath, stte_audio_type_e audio_type, int sample_rate, void* user_param);
87
88 int stt_engine_recognize_cancel_file();
89
90 int stt_engine_set_recognition_result_cb(stt_engine_result_cb result_cb, void* user_data);
91
92 int stt_engine_send_result(stte_result_event_e event, const char* type, const char** result, int result_count,
93                                 const char* msg, void* time_info, void* user_data);
94
95 int stt_engine_send_error(stte_error_e error, const char* msg);
96
97 int stt_engine_send_speech_status(stte_speech_status_e status, void* user_data);
98
99 int stt_engine_set_private_data_set_cb(stte_private_data_set_cb private_data_set_cb, void* user_data);
100
101 int stt_engine_set_private_data_requested_cb(stte_private_data_requested_cb private_data_requested_cb, void* user_data);
102
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif /* __STT_ENGINE_H_ */