[ACR-1449] Add new api to set audio type
[platform/core/uifw/stt.git] / server / sttd_engine_agent.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 __STTD_ENGINE_AGENT_H_
17 #define __STTD_ENGINE_AGENT_H_
18
19 #include "sttd_main.h"
20 #include "stte.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /*
27 * Constants & Structures
28 */
29
30 #define ENGINE_PATH_SIZE 256
31
32 typedef int (*result_callback)(stte_result_event_e event, const char* type, 
33                                 const char** data, int data_count, const char* msg, void *user_data);
34
35 typedef bool (*result_time_callback)(int index, stte_result_time_event_e event, const char* text, 
36                                 long start_time, long end_time, void *user_data);
37
38 typedef int (*speech_status_callback)(stte_speech_status_e status, void *user_data);
39
40 typedef int (*error_callback)(stte_error_e error, const char* msg);
41
42
43 /*
44 * STT Engine Agent Interfaces
45 */
46
47 /** Init / Release engine agent */
48 int sttd_engine_agent_init(result_callback result_cb, result_time_callback time_cb, 
49                            speech_status_callback speech_status_cb, error_callback error_cb);
50
51 int sttd_engine_agent_release();
52
53
54 /** Manage engine */
55 int sttd_engine_agent_initialize_engine_list(stte_request_callback_s *callback);
56
57
58 /** load / unload engine */
59 int sttd_engine_agent_load_current_engine(stte_request_callback_s *callback);
60
61 int sttd_engine_agent_unload_current_engine();
62
63 bool sttd_engine_agent_is_default_engine();
64
65 int sttd_engine_agent_get_engine_list(GSList** engine_list);
66
67 int sttd_engine_agent_get_current_engine(char** engine_uuid);
68
69
70 /** Get/Set app option */
71 bool sttd_engine_agent_need_network();
72
73 int sttd_engine_agent_supported_langs(GSList** lang_list);
74
75 int sttd_engine_agent_get_default_lang(char** lang);
76
77 int sttd_engine_agent_set_private_data(const char* key, const char* data);
78
79 int sttd_engine_agent_get_private_data(const char* key, char** data);
80
81 int sttd_engine_agent_get_option_supported(bool* silence);
82
83 int sttd_engine_agent_is_credential_needed(int uid, bool* credential);
84
85 int sttd_engine_agent_is_recognition_type_supported(const char* type, bool* support);
86
87 int sttd_engine_agent_set_default_engine(const char* engine_uuid);
88
89 int sttd_engine_agent_set_default_language(const char* language);
90
91 int sttd_engine_agent_set_silence_detection(bool value);
92
93 int sttd_engine_agent_check_app_agreed(const char* appid, bool* result);
94
95 /** Control engine */
96 int sttd_engine_agent_recognize_start_engine(int uid, const char* lang, const char* recognition_type, 
97                                 int silence, const char* appid, const char* credential, void* user_param);
98
99 int sttd_engine_agent_recognize_start_recorder(int uid);
100
101 int sttd_engine_agent_recognize_start_file(int uid, const char* filepath);
102
103 int sttd_engine_agent_set_recording_data(const void* data, unsigned int length);
104
105 int sttd_engine_agent_recognize_stop();
106
107 int sttd_engine_agent_recognize_stop_file();
108
109 int sttd_engine_agent_recognize_stop_recorder();
110
111 int sttd_engine_agent_recognize_stop_engine();
112
113 int sttd_engine_agent_recognize_cancel();
114
115 /** Send engine's information */
116 int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, const char** result, int result_count,
117                  const char* msg, void* time_info, void *user_data);
118
119 int sttd_engine_agent_send_error(stte_error_e error, const char* msg);
120
121 int sttd_engine_agent_send_speech_status(stte_speech_status_e status, void* user_data);
122
123 int sttd_engine_agent_set_audio_type(const char* audio_type);
124
125
126 #ifdef __cplusplus
127 }
128 #endif
129
130 #endif /* __STTD_ENGINE_AGENT_H_ */