Fix connection timer bug
[platform/core/uifw/tts.git] / client / tts_client.h
1 /*
2 *  Copyright (c) 2011-2014 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_CLIENT_H_
16 #define __TTS_CLIENT_H_
17
18 #include <Ecore.h>
19
20 #include "tts.h"
21 #include "tts_config_mgr.h"
22 #include "tts_main.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 typedef struct {
29         /* base info */
30         tts_h   tts;
31         int     pid; 
32         int     uid;                    /*<< unique id = pid + handle */
33         int     current_utt_id;
34
35         /* callback info */
36         tts_state_changed_cb            state_changed_cb;
37         void*                           state_changed_user_data;
38         tts_utterance_started_cb        utt_started_cb;
39         void*                           utt_started_user_data;
40         tts_utterance_completed_cb      utt_completeted_cb;
41         void*                           utt_completed_user_data;
42         tts_error_cb                    error_cb;
43         void*                           error_user_data;
44         tts_default_voice_changed_cb    default_voice_changed_cb;
45         void*                           default_voice_changed_user_data;
46         tts_supported_voice_cb          supported_voice_cb;
47         void*                           supported_voice_user_data;
48
49         /* mode / state */
50         tts_mode_e      mode;
51         tts_state_e     before_state;
52         tts_state_e     current_state;
53
54         /* semaphore */
55         int             cb_ref_count;
56
57         /* callback data */
58         int             utt_id;
59         int             reason;
60
61         /* connection */
62         Ecore_Timer*    conn_timer;
63 } tts_client_s;
64
65 int tts_client_new(tts_h* tts);
66
67 int tts_client_destroy(tts_h tts);
68
69 tts_client_s* tts_client_get(tts_h tts);
70
71 tts_client_s* tts_client_get_by_uid(const int uid);
72
73 int tts_client_get_size();
74
75 int tts_client_use_callback(tts_client_s* client);
76
77 int tts_client_not_use_callback(tts_client_s* client);
78
79 int tts_client_get_use_callback(tts_client_s* client);
80
81 int tts_client_get_connected_client_count();
82
83 int tts_client_get_mode_client_count(tts_mode_e mode);
84
85 GList* tts_client_get_client_list();
86
87 #ifdef __cplusplus
88 }
89 #endif
90
91 #endif /* __TTS_CLIENT_H_ */