Merge "Prevent to add rule when stt service is reset" into tizen
[platform/core/uifw/stt.git] / common / stt_config_mgr.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 #ifndef __STT_CONFIG_MANAGER_H_
16 #define __STT_CONFIG_MANAGER_H_
17
18 #include <tizen.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 typedef enum {
25         STT_CONFIG_ERROR_NONE                   = TIZEN_ERROR_NONE,             /**< Successful */
26         STT_CONFIG_ERROR_OUT_OF_MEMORY          = TIZEN_ERROR_OUT_OF_MEMORY,    /**< Out of Memory */
27         STT_CONFIG_ERROR_IO_ERROR               = TIZEN_ERROR_IO_ERROR,         /**< I/O error */
28         STT_CONFIG_ERROR_INVALID_PARAMETER      = TIZEN_ERROR_INVALID_PARAMETER,/**< Invalid parameter */
29         STT_CONFIG_ERROR_PERMISSION_DENIED      = TIZEN_ERROR_PERMISSION_DENIED,/**< Permission denied */
30         STT_CONFIG_ERROR_NOT_SUPPORTED          = TIZEN_ERROR_NOT_SUPPORTED,    /**< STT NOT supported */
31         STT_CONFIG_ERROR_INVALID_STATE          = TIZEN_ERROR_STT | 0x01,       /**< Invalid state */
32         STT_CONFIG_ERROR_INVALID_LANGUAGE       = TIZEN_ERROR_STT | 0x02,       /**< Invalid language */
33         STT_CONFIG_ERROR_ENGINE_NOT_FOUND       = TIZEN_ERROR_STT | 0x03,       /**< No available engine  */
34         STT_CONFIG_ERROR_OPERATION_FAILED       = TIZEN_ERROR_STT | 0x04,       /**< Operation failed  */
35 } stt_config_error_e;
36
37 typedef enum {
38         STT_CONFIG_TYPE_OPTION_SILENCE_DETECTION
39 } stt_config_type_e;
40
41 typedef bool (*stt_config_supported_engine_cb)(const char* engine_id, const char* engine_name, const char* setting, bool support_silence, void* user_data);
42
43 typedef bool (*stt_config_supported_langauge_cb)(const char* engine_id, const char* language, void* user_data);
44
45 typedef void (*stt_config_engine_changed_cb)(const char* engine_id, const char* setting, const char* language, bool support_silence, bool need_credential, void* user_data);
46
47 typedef void (*stt_config_lang_changed_cb)(const char* before_language, const char* current_language, void* user_data);
48
49 typedef void (*stt_config_bool_changed_cb)(stt_config_type_e type, bool bool_value, void* user_data);
50
51 typedef bool (*stt_config_result_time_cb)(int index, int event, const char* text, long start_time, long end_time, void* user_data);
52
53
54 int stt_config_mgr_initialize(int uid);
55
56 int stt_config_mgr_finalize(int uid);
57
58
59 int stt_config_mgr_set_callback(int uid, stt_config_engine_changed_cb engine_cb, stt_config_lang_changed_cb lang_cb, stt_config_bool_changed_cb bool_cb, void* user_data);
60
61 int stt_config_mgr_unset_callback(int uid);
62
63
64 int stt_config_mgr_get_engine_list(stt_config_supported_engine_cb callback, void* user_data);
65
66 int stt_config_mgr_get_engine(char** engine);
67
68 int stt_config_mgr_set_engine(const char* engine);
69
70 int stt_config_mgr_get_engine_agreement(const char* engine, char** agreement);
71
72 int stt_config_mgr_get_language_list(const char* engine_id, stt_config_supported_langauge_cb callback, void* user_data);
73
74 int stt_config_mgr_get_default_language(char** language);
75
76 int stt_config_mgr_set_default_language(const char* language);
77
78 int stt_config_mgr_get_auto_language(bool* value);
79
80 int stt_config_mgr_set_auto_language(bool value);
81
82 int stt_config_mgr_get_silence_detection(bool* value);
83
84 int stt_config_mgr_set_silence_detection(bool value);
85
86 bool stt_config_check_default_engine_is_valid(const char* engine);
87
88 bool stt_config_check_default_language_is_valid(const char* language);
89
90
91 int stt_config_mgr_reset_time_info();
92
93 int stt_config_mgr_add_time_info(int index, int event, const char* text, long start_time, long end_time);
94
95 int stt_config_mgr_foreach_time_info(stt_config_result_time_cb callback, void* user_data);
96
97
98 int stt_config_mgr_save_time_info_file();
99
100 int stt_config_mgr_remove_time_info_file();
101
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif /* __STT_CONFIG_MANAGER_H_ */