Add TTS mode
[platform/core/uifw/tts.git] / server / ttsd_data.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 __TTSD_DATA_H_
16 #define __TTSD_DATA_H_
17
18 //#include <vector>
19 #include "ttsp.h"
20
21 //using namespace std;
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 typedef enum {
28         APP_STATE_CREATED = 0,
29         APP_STATE_READY,
30         APP_STATE_PLAYING,
31         APP_STATE_PAUSED
32 }app_state_e;
33
34 typedef struct 
35 {
36         int                     utt_id; 
37         char*                   text;
38         char*                   lang;
39         ttsp_voice_type_e       vctype;
40         ttsp_speed_e            speed;
41 }speak_data_s;
42
43 typedef struct 
44 {
45         int             utt_id;
46         void*           data;
47         unsigned int    data_size;
48
49         ttsp_result_event_e     event;
50         ttsp_audio_type_e       audio_type;
51         int                     rate;
52         int                     channels;
53 }sound_data_s;
54
55 int ttsd_data_new_client(int pid, int uid);
56
57 int ttsd_data_delete_client(int uid);
58
59 int ttsd_data_is_client(int uid);
60
61 int ttsd_data_get_client_count();
62
63 int ttsd_data_get_pid(int uid);
64
65 int ttsd_data_add_speak_data(int uid, speak_data_s data);
66
67 int ttsd_data_get_speak_data(int uid, speak_data_s* data);
68
69 int ttsd_data_get_speak_data_size(int uid);
70
71 int ttsd_data_add_sound_data(int uid, sound_data_s data);
72
73 int ttsd_data_get_sound_data(int uid, sound_data_s* data);
74
75 int ttsd_data_get_sound_data_size(int uid);
76
77 int ttsd_data_clear_data(int uid);
78
79 int ttsd_data_get_client_state(int pid, app_state_e* state);
80
81 int ttsd_data_set_client_state(int pid, app_state_e state);
82
83 int ttsd_data_get_current_playing();
84
85 typedef bool(*ttsd_data_get_client_cb)(int pid, int uid, app_state_e state, void* user_data);
86
87 int ttsd_data_foreach_clients(ttsd_data_get_client_cb callback, void* user_data);
88
89 bool ttsd_data_is_uttid_valid(int uid, int uttid);
90
91 int ttsd_data_is_current_playing();
92
93
94 int ttsd_setting_data_add(int pid);
95
96 int ttsd_setting_data_delete(int pid);
97
98 int ttsd_setting_data_is_setting(int pid);
99
100 /* for error log */
101 int ttsd_data_save_error_log(int uid, FILE* fp);
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif /* __TTSD_DATA_H_ */