Update version to 1.70.7
[platform/core/uifw/voice-control.git] / client / vc_widget_client.h
1 /*
2 * Copyright (c) 2011-2015 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
18 #ifndef __VC_WIDGET_CLIENT_H_
19 #define __VC_WIDGET_CLIENT_H_
20
21 #include "voice_control_common.h"
22 #include "voice_control_internal.h"
23 #include "voice_control_widget.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 typedef struct {
30         /* base info */
31         vc_h    vc;
32         int     pid;
33         unsigned int uid;               /*<< unique id = pid + handle */
34         int     xid;            /*<< main Wayland window id */
35
36         vc_result_cb                    result_cb;
37         void*                           result_user_data;
38         vc_asr_result_cb                asr_result_cb;
39         void*                           asr_result_user_data;
40         bool                            asr_result_enabled;
41         vc_error_cb                     error_cb;
42         void*                           error_user_data;
43         vc_service_state_changed_cb     service_state_changed_cb;
44         void*                           service_state_changed_user_data;
45         vc_state_changed_cb             state_changed_cb;
46         void*                           state_changed_user_data;
47         vc_widget_show_tooltip_cb       show_tooltip_cb;
48         void*                           show_tooltip_user_data;
49         vc_current_language_changed_cb  current_lang_changed_cb;
50         void*                           current_lang_changed_user_data;
51
52         vc_widget_send_current_command_list_cb  send_command_list_cb;
53         void*                                   send_command_list_user_data;
54
55         /* tooltip */
56         bool                    show_tooltip;
57
58         /* service state */
59         vc_service_state_e      service_state;
60
61         /* state */
62         vc_state_e      previous_state;
63         vc_state_e      current_state;
64
65         Ecore_Timer*    conn_timer;
66
67         /* mutex */
68         int     cb_ref_count;
69
70         /* error data */
71         int     reason;
72 } vc_widget_s;
73
74 /*
75 * Common function
76 */
77 int vc_widget_client_create(vc_h* vc);
78
79 int vc_widget_client_destroy(vc_h vc);
80
81 bool vc_widget_client_is_valid(vc_h vc);
82
83 bool vc_widget_client_is_valid_by_uid(unsigned int uid);
84
85 int vc_widget_client_get_handle(unsigned int uid, vc_h* vc);
86
87 vc_widget_s* widget_get(vc_h vc);
88
89 GSList* vc_widget_client_get_client_list();
90
91 /*
92 * set/get callback function
93 */
94 int vc_widget_client_set_result_cb(vc_h vc, vc_result_cb callback, void* user_data);
95
96 int vc_widget_client_get_result_cb(vc_h vc, vc_result_cb* callback, void** user_data);
97
98 int vc_widget_client_set_asr_result_cb(vc_h vc, vc_asr_result_cb callback, void* user_data);
99
100 int vc_widget_client_get_asr_result_cb(vc_h vc, vc_asr_result_cb* callback, void** user_data);
101
102 int vc_widget_client_set_service_state_changed_cb(vc_h vc, vc_service_state_changed_cb callback, void* user_data);
103
104 int vc_widget_client_get_service_state_changed_cb(vc_h vc, vc_service_state_changed_cb* callback, void** user_data);
105
106 int vc_widget_client_set_state_changed_cb(vc_h vc, vc_state_changed_cb callback, void* user_data);
107
108 int vc_widget_client_get_state_changed_cb(vc_h vc, vc_state_changed_cb* callback, void** user_data);
109
110 int vc_widget_client_set_show_tooltip_cb(vc_h vc, vc_widget_show_tooltip_cb callback, void* user_data);
111
112 int vc_widget_client_get_show_tooltip_cb(vc_h vc, vc_widget_show_tooltip_cb* callback, void** user_data);
113
114 int vc_widget_client_set_current_lang_changed_cb(vc_h vc, vc_current_language_changed_cb callback, void* user_data);
115
116 int vc_widget_client_get_current_lang_changed_cb(vc_h vc, vc_current_language_changed_cb* callback, void** user_data);
117
118 int vc_widget_client_set_error_cb(vc_h vc, vc_error_cb callback, void* user_data);
119
120 int vc_widget_client_get_error_cb(vc_h vc, vc_error_cb* callback, void** user_data);
121
122 int vc_widget_client_set_send_command_list_cb(vc_h vc, vc_widget_send_current_command_list_cb callback, void* user_data);
123
124 int vc_widget_client_get_send_command_list_cb(vc_h vc, vc_widget_send_current_command_list_cb* callback, void** user_data);
125
126
127
128 /*
129 * set/get option
130 */
131 int vc_widget_client_set_service_state(vc_h vc, vc_service_state_e state);
132
133 int vc_widget_client_get_service_state(vc_h vc, vc_service_state_e* state);
134
135 int vc_widget_client_set_state(vc_h vc, vc_state_e state);
136
137 int vc_widget_client_get_state(vc_h vc, vc_state_e* state);
138
139 int vc_widget_client_get_state_by_uid(unsigned int uid, vc_state_e* state);
140
141 int vc_widget_client_get_previous_state(vc_h vc, vc_state_e* state, vc_state_e* previous_state);
142
143 int vc_widget_client_set_xid(vc_h vc, int xid);
144
145 int vc_widget_cilent_get_xid(vc_h vc, int* xid);
146
147 int vc_widget_client_set_error(vc_h vc, int reason);
148
149 int vc_widget_client_get_error(vc_h vc, int* reason);
150
151 int vc_widget_client_set_show_tooltip(vc_h vc, bool show);
152
153 int vc_widget_client_get_show_tooltip(vc_h vc, bool* show);
154
155 int vc_widget_client_set_asr_result_enabled(vc_h vc, bool enabled);
156
157 int vc_widget_client_get_asr_result_enabled(vc_h vc, bool* enabled);
158
159
160 /* utils */
161 int vc_widget_client_get_count();
162
163 int vc_widget_client_use_callback(vc_h vc);
164
165 int vc_widget_client_not_use_callback(vc_h vc);
166
167
168 #ifdef __cplusplus
169 }
170 #endif
171
172 #endif /* __VC_WIDGET_CLIENT_H_ */