Merge "Update header and doc files written in English" into tizen
[platform/core/uifw/stt.git] / include / stt_internal.h
1 /*
2  * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __STT_INTERNAL_H__
18 #define __STT_INTERNAL_H__
19
20 #include <tizen.h>
21 #include <stt.h>
22
23 /**
24  * @file stt_internal.h
25  */
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #define STT_SPEECH_STATUS_BEGINNING_POINT_DETECTED      0
33
34 /**
35  * @brief Called when user speaking is detected.
36  *
37  * @param[in] stt The STT handle
38  * @param[in] status The speech status
39  * @param[in] user_data The user data passed from the callback registration function
40  *
41  * @pre An application registers callback function using stt_set_speech_status_cb().
42  *
43  * @see stt_set_speech_status_cb()
44  * @see stt_unset_speech_status_cb()
45  */
46 typedef void (*stt_speech_status_cb)(stt_h stt, int status, void *user_data);
47
48
49 /**
50  * @brief Registers a callback function to detect the speech status is changed.
51  * @since_tizen 3.0
52  * @privilege %http://tizen.org/privilege/recorder
53  *
54  * @param[in] stt The STT handle
55  * @param[in] callback The callback function to register
56  * @param[in] user_data The user data to be passed to the callback function
57  *
58  * @return 0 on success, otherwise a negative error value
59  * @retval #STT_ERROR_NONE Successful
60  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
61  * @retval #STT_ERROR_INVALID_STATE Invalid state
62  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
63  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
64  *
65  * @pre The state should be #STT_STATE_CREATED.
66  *
67  * @see stt_speech_status_cb()
68  * @see stt_unset_speech_status_cb()
69 */
70 int stt_set_speech_status_cb(stt_h stt, stt_speech_status_cb callback, void* user_data);
71
72 /**
73  * @brief Unregisters the callback function.
74  * @since_tizen 3.0
75  * @privilege %http://tizen.org/privilege/recorder
76  *
77  * @param[in] stt The STT handle
78  *
79  * @return 0 on success, otherwise a negative error value
80  * @retval #STT_ERROR_NONE Successful
81  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
82  * @retval #STT_ERROR_INVALID_STATE Invalid state
83  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
84  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
85  *
86  * @pre The state should be #STT_STATE_CREATED.
87  *
88  * @see stt_set_speech_status_cb()
89 */
90 int stt_unset_speech_status_cb(stt_h stt);
91
92 /**
93  * @brief Sets server STT.
94  * @details Using this API, the application can set server STT with a @a key as a @a user_data
95  *      The key is a private data to set STT server.
96  *      There are 3 types of keys; "server", "rampcode" and "epd".
97  *              "server": STT server address
98  *              "rampcode": ASR ramp code
99  *              "epd": A threshold for end-point detection
100  *
101  *      The application can input the @a user_data corresponding to the @a key.
102  *              "server": "qa", "sbx"
103  *              "rampcode": "dash_dict", "dash_da"
104  *              "epd": "100", "750", etc
105  *
106  *  If the application sets those keys, it will be able to use corresponding STT engines and options.
107  *
108  * @since_tizen 3.0
109  * @privilege %http://tizen.org/privilege/recorder
110  *
111  * @param[in] stt The STT handle
112  * @param[in] key The key
113  * @param[in] user_data The user data corresponding to the key
114  *
115  * @return 0 on success, otherwise a negative error value
116  * @retval #STT_ERROR_NONE Successful
117  * @retval #STT_ERROR_INVALID_PARAMETER Invalid parameter
118  * @retval #STT_ERROR_INVALID_STATE Invalid state
119  * @retval #STT_ERROR_NOT_SUPPORTED STT NOT supported
120  * @retval #STT_ERROR_OUT_OF_MEMORY STT Out of memory
121  * @retval #STT_ERROR_PERMISSION_DENIED Permission denied
122  *
123  * @pre The state should be #STT_STATE_READY.
124  */
125 int stt_set_server_stt(stt_h stt, const char* key, char* user_data);
126
127 #ifdef __cplusplus
128 }
129 #endif
130
131 /**
132  * @}@}
133  */
134
135 #endif /* __STT_INTERNAL_H__ */
136