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.
16 #ifndef __STTD_ENGINE_AGENT_H_
17 #define __STTD_ENGINE_AGENT_H_
19 #include "sttd_main.h"
27 * Constants & Structures
30 #define ENGINE_PATH_SIZE 256
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);
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);
38 typedef int (*speech_status_callback)(stte_speech_status_e status, void *user_data);
40 typedef int (*error_callback)(stte_error_e error, const char* msg);
44 * STT Engine Agent Interfaces
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);
51 int sttd_engine_agent_release();
55 int sttd_engine_agent_initialize_engine_list(stte_request_callback_s *callback);
58 /** load / unload engine */
59 int sttd_engine_agent_load_current_engine(stte_request_callback_s *callback);
61 int sttd_engine_agent_unload_current_engine();
63 bool sttd_engine_agent_is_default_engine();
65 int sttd_engine_agent_get_engine_list(GSList** engine_list);
67 int sttd_engine_agent_get_current_engine(char** engine_uuid);
70 /** Get/Set app option */
71 bool sttd_engine_agent_need_network();
73 int sttd_engine_agent_supported_langs(GSList** lang_list);
75 int sttd_engine_agent_get_default_lang(char** lang);
77 int sttd_engine_agent_set_private_data(const char* key, const char* data);
79 int sttd_engine_agent_get_private_data(const char* key, char** data);
81 int sttd_engine_agent_get_option_supported(bool* silence);
83 int sttd_engine_agent_is_credential_needed(unsigned int uid, bool* credential);
85 int sttd_engine_agent_is_recognition_type_supported(const char* type, bool* support);
87 int sttd_engine_agent_get_audio_format(stte_audio_type_e* type, int* rate, int* num_of_channels);
89 int sttd_engine_agent_set_default_engine(const char* engine_uuid);
91 int sttd_engine_agent_set_default_language(const char* language);
93 int sttd_engine_agent_set_silence_detection(bool value);
95 int sttd_engine_agent_check_app_agreed(const char* appid, bool* result);
98 int sttd_engine_agent_recognize_start_engine(unsigned int uid, const char* lang, const char* recognition_type,
99 int silence, const char* appid, const char* credential, void* user_param);
101 int sttd_engine_agent_recognize_start_recorder(unsigned int uid, const char* appid);
103 int sttd_engine_agent_recognize_start_file(unsigned int uid, const char* filepath);
105 int sttd_engine_agent_set_recording_data(const void* data, unsigned int length);
107 int sttd_engine_agent_recognize_stop();
109 int sttd_engine_agent_recognize_stop_file();
111 int sttd_engine_agent_recognize_stop_recorder();
113 int sttd_engine_agent_recognize_stop_engine();
115 int sttd_engine_agent_recognize_cancel();
117 /** Send engine's information */
118 int sttd_engine_agent_send_result(stte_result_event_e event, const char* type, const char** result, int result_count,
119 const char* msg, void* time_info, void *user_data);
121 int sttd_engine_agent_send_error(stte_error_e error, const char* msg);
123 int sttd_engine_agent_send_speech_status(stte_speech_status_e status, void* user_data);
125 int sttd_engine_agent_get_audio_type(char** audio_type);
127 int sttd_engine_agent_set_audio_type(const char* audio_type);
134 #endif /* __STTD_ENGINE_AGENT_H_ */