Add a checker into __send_interrupt_client
[platform/core/uifw/tts.git] / common / tts_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 __TTS_CONFIG_MANAGER_H_
16 #define __TTS_CONFIG_MANAGER_H_
17
18 #include <errno.h>
19 #include <stdbool.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 typedef enum {
26         TTS_CONFIG_ERROR_NONE                   = 0,            /**< Success, No error */
27         TTS_CONFIG_ERROR_OUT_OF_MEMORY          = -ENOMEM,      /**< Out of Memory */
28         TTS_CONFIG_ERROR_IO_ERROR               = -EIO,         /**< I/O error */
29         TTS_CONFIG_ERROR_INVALID_PARAMETER      = -EINVAL,      /**< Invalid parameter */
30         TTS_CONFIG_ERROR_INVALID_STATE          = -0x0100021,   /**< Invalid state */
31         TTS_CONFIG_ERROR_INVALID_VOICE          = -0x0100022,   /**< Invalid voice */
32         TTS_CONFIG_ERROR_ENGINE_NOT_FOUND       = -0x0100023,   /**< No available TTS-engine  */
33         TTS_CONFIG_ERROR_OPERATION_FAILED       = -0x0100024,   /**< Operation failed  */
34         TTS_CONFIG_ERROR_NOT_SUPPORTED_FEATURE  = -0x0100025    /**< Not supported feature of current engine */
35 } tts_config_error_e;
36
37 typedef enum {
38         TTS_CONFIG_SPEED_AUTO           = 0,    /**< Speed from settings */
39         TTS_CONFIG_SPEED_MIN            = 1,    /**< Min value */
40         TTS_CONFIG_SPEED_VERY_SLOW      = 2,    /**< Very slow */
41         TTS_CONFIG_SPEED_SLOW           = 5,    /**< Slow */
42         TTS_CONFIG_SPEED_NORMAL         = 8,    /**< Normal */
43         TTS_CONFIG_SPEED_FAST           = 11,   /**< Fast */
44         TTS_CONFIG_SPEED_VERY_FAST      = 14,   /**< Very fast */
45         TTS_CONFIG_SPEED_MAX            = 15    /**< Max value */
46 } tts_config_speed_e;
47
48
49 typedef bool (*tts_config_supported_engine_cb)(const char* engine_id, const char* engine_name, const char* setting, void* user_data);
50
51 typedef bool (*tts_config_supported_voice_cb)(const char* engine_id, const char* language, int type, void* user_data);
52
53 typedef void (*tts_config_engine_changed_cb)(const char* engine_id, const char* setting, 
54                                              const char* language, int voice_type, bool auto_voice, bool need_credential, void* user_data);
55
56 typedef void (*tts_config_voice_changed_cb)(const char* before_language, int before_voice_type, 
57                                             const char* current_language, int current_voice_type, 
58                                             bool auto_voice, void* user_data);
59
60 typedef void (*tts_config_speech_rate_changed_cb)(int value, void* user_data);
61
62 typedef void (*tts_config_pitch_changed_cb)(int value, void* user_data);
63
64 typedef void (*tts_config_bg_volume_ratio_changed_cb)(double value, void* user_data);
65
66 typedef void (*tts_config_screen_reader_changed_cb)(bool value);
67
68
69 int tts_config_mgr_initialize(int uid);
70
71 int tts_config_mgr_finalize(int uid);
72
73
74 int tts_config_mgr_set_callback(int uid, 
75                                 tts_config_engine_changed_cb engine_cb, 
76                                 tts_config_voice_changed_cb voice_cb, 
77                                 tts_config_speech_rate_changed_cb speech_cb, 
78                                 tts_config_pitch_changed_cb pitch_cb,
79                                 tts_config_bg_volume_ratio_changed_cb bg_volume_ratio_cb,
80                                 void* user_data);
81
82 int tts_config_mgr_unset_callback(int uid);
83
84 /* Only for screen reader option */
85 int tts_config_set_screen_reader_callback(int uid, tts_config_screen_reader_changed_cb callback);
86
87 int tts_config_unset_screen_reader_callback(int uid);
88
89
90 int tts_config_mgr_get_engine_list(tts_config_supported_engine_cb callback, void* user_data);
91
92 int tts_config_mgr_get_engine(char** engine);
93
94 int tts_config_mgr_set_engine(const char* engine);
95
96 int tts_config_mgr_get_voice_list(const char* engine_id, tts_config_supported_voice_cb callback, void* user_data);
97
98 int tts_config_mgr_get_voice(char** language, int* type);
99
100 int tts_config_mgr_set_voice(const char* language, int type);
101
102 int tts_config_mgr_get_auto_voice(bool* value);
103
104 int tts_config_mgr_set_auto_voice(bool value);
105
106 int tts_config_mgr_get_speech_rate(int* value);
107
108 int tts_config_mgr_set_speech_rate(int value);
109
110 int tts_config_mgr_get_pitch(int* value);
111
112 int tts_config_mgr_set_pitch(int value);
113
114 int tts_config_mgr_get_bg_volume_ratio(double *value);
115 int tts_config_mgr_set_bg_volume_ratio(double value);
116
117 bool tts_config_check_default_engine_is_valid(const char* engine);
118
119 bool tts_config_check_default_voice_is_valid(const char* language, int type);
120
121 char* tts_config_get_message_path(int mode, int pid);
122
123 int tts_config_mgr_get_max_text_size(unsigned int* size);
124
125
126 #ifdef __cplusplus
127 }
128 #endif
129
130 #endif /* __TTS_CONFIG_MANAGER_H_ */