Update hello protocol
[platform/core/uifw/tts.git] / server / ttsd_data.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 __TTSD_DATA_H_
16 #define __TTSD_DATA_H_
17
18 #include "ttse.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24
25 typedef enum {
26         APP_STATE_CREATED = 0,
27         APP_STATE_READY,
28         APP_STATE_PLAYING,
29         APP_STATE_PAUSED
30 } app_tts_state_e;
31
32 typedef enum {
33         TTSD_SYNTHESIS_CONTROL_DOING    = 0,
34         TTSD_SYNTHESIS_CONTROL_DONE     = 1,
35         TTSD_SYNTHESIS_CONTROL_EXPIRED  = 2
36 } ttsd_synthesis_control_e;
37
38 typedef struct {
39         int     utt_id; 
40         char*   text;
41         char*   lang;
42         int     vctype;
43         int     speed;
44 } speak_data_s;
45
46 typedef struct {
47         int             utt_id;
48         void*           data;
49         unsigned int    data_size;
50
51         ttse_result_event_e     event;
52         ttse_audio_type_e       audio_type;
53         int                     rate;
54         int                     channels;
55 } sound_data_s;
56
57 int ttsd_set_synth_control(ttsd_synthesis_control_e control);
58
59 ttsd_synthesis_control_e ttsd_get_synth_control();
60
61 typedef void (* ttsd_used_voice_cb)(const char* lang, int type);
62
63 int ttsd_data_new_client(int pid, int uid);
64
65 int ttsd_data_delete_client(int uid);
66
67 int ttsd_data_is_client(int uid);
68
69 int ttsd_data_get_client_count();
70
71 int ttsd_data_get_pid(int uid);
72
73 /* speak data */
74 int ttsd_data_add_speak_data(int uid, speak_data_s* data);
75
76 int ttsd_data_get_speak_data(int uid, speak_data_s** data);
77
78 int ttsd_data_get_speak_data_size(int uid);
79
80 int ttsd_data_clear_speak_data(int uid, speak_data_s** speak_data);
81
82 /* sound data */
83 int ttsd_data_add_sound_data(int uid, sound_data_s* data);
84
85 int ttsd_data_get_sound_data(int uid, sound_data_s** data);
86
87 int ttsd_data_get_sound_data_size(int uid);
88
89 int ttsd_data_clear_sound_data(sound_data_s** sound_data);
90
91 int ttsd_data_clear_data(int uid);
92
93
94 int ttsd_data_set_used_voice(int uid, const char* lang, int type);
95
96 int ttsd_data_reset_used_voice(int uid, ttsd_used_voice_cb callback);
97
98 int ttsd_data_get_client_state(int pid, app_tts_state_e* state);
99
100 int ttsd_data_set_client_state(int pid, app_tts_state_e state);
101
102
103 int ttsd_data_get_current_playing();
104
105 typedef bool(*ttsd_data_get_client_cb)(int pid, int uid, app_tts_state_e state, void* user_data);
106
107 int ttsd_data_foreach_clients(ttsd_data_get_client_cb callback, void* user_data);
108
109 bool ttsd_data_is_uttid_valid(int uid, int uttid);
110
111 int ttsd_data_get_same_pid_client_count(int pid);
112
113 /* For error handing */
114 int ttsd_data_save_error_log(int uid, FILE* fp);
115
116
117 #ifdef __cplusplus
118 }
119 #endif
120
121 #endif /* __TTSD_DATA_H_ */