Release version 0.1.41
[platform/core/uifw/stt.git] / client / stt_client.h
1 /*
2 *  Copyright (c) 2012, 2013 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_CLIENT_H_
16 #define __STT_CLIENT_H_
17
18 #include <pthread.h>
19 #include "stt.h"
20 #include "stt_main.h"
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26
27 typedef struct {
28         /* base info */
29         stt_h   stt;
30         int     pid; 
31         int     uid;    /*<< unique id = pid + handle */
32
33         stt_result_cb           result_cb;
34         void*                   result_user_data;
35         stt_partial_result_cb   partial_result_cb;
36         void*                   partial_result_user_data;
37         stt_state_changed_cb    state_changed_cb;
38         void*                   state_changed_user_data;
39         stt_error_cb            error_cb;
40         void*                   error_user_data;
41
42         /* option */
43         bool    silence_supported;
44         bool    profanity_supported;
45         bool    punctuation_supported;
46
47         stt_option_profanity_e          profanity;      
48         stt_option_punctuation_e        punctuation;
49         stt_option_silence_detection_e  silence;
50
51         /* state */
52         stt_state_e     before_state;
53         stt_state_e     current_state;
54
55         /* mutex */
56         int             cb_ref_count;
57
58         /* result data */
59         char*   partial_result;
60         char*   type;
61         char**  data_list;
62         int     data_count;
63         char*   msg;
64
65         /* error data */
66         int     reason;
67 }stt_client_s;
68
69 int stt_client_new(stt_h* stt);
70
71 int stt_client_destroy(stt_h stt);
72
73 stt_client_s* stt_client_get(stt_h stt);
74
75 stt_client_s* stt_client_get_by_uid(const int uid);
76
77 int stt_client_get_size();
78
79 int stt_client_use_callback(stt_client_s* client);
80
81 int stt_client_not_use_callback(stt_client_s* client);
82
83 int stt_client_get_use_callback(stt_client_s* client);
84
85 int stt_client_set_option_supported(stt_h stt, bool silence, bool profanity, bool punctuation);
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* __STT_CLIENT_H_ */