Make atomic variable to avoid race condition
[platform/core/uifw/stt.git] / server / sttd_client_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 __STTD_CLIENT_DATA_H_
16 #define __STTD_CLIENT_DATA_H_
17
18 #include <glib.h>
19 #include <Ecore.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 typedef enum {
26         APP_STATE_CREATED       = 0,
27         APP_STATE_READY         = 1,
28         APP_STATE_RECORDING     = 2,
29         APP_STATE_PROCESSING    = 3
30 } app_state_e;
31
32 typedef struct {
33         int     pid;
34         unsigned int    uid;
35         char*   start_beep;
36         char*   stop_beep;
37         char*   audio_id;
38
39         app_state_e     state;
40 /*      Ecore_Timer*    timer;  */
41
42         bool    app_agreed;
43 } client_info_s;
44
45 typedef struct {
46         int     index;
47         int     event;
48         char*   text;
49         long    start_time;
50         long    end_time;
51 } result_time_info_s;
52
53 typedef bool (*time_callback)(int index, int event, const char* text, long start_time, long end_time, void *user_data);
54
55
56 int sttd_client_add(int pid, unsigned int uid);
57
58 int sttd_client_delete(unsigned int uid);
59
60 int sttd_client_get_start_sound(unsigned int uid, char** filename);
61
62 int sttd_client_set_start_sound(unsigned int uid, const char* filename);
63
64 int sttd_client_get_stop_sound(unsigned int uid, char** filename);
65
66 int sttd_client_set_stop_sound(unsigned int uid, const char* filename);
67
68 int sttd_client_get_state(unsigned int uid, app_state_e* state);
69
70 int sttd_client_set_state(unsigned int uid, app_state_e state);
71
72 int sttd_client_get_ref_count();
73
74 int sttd_client_get_pid(unsigned int uid);
75
76 #if 0
77 int sttd_client_get_current_recording();
78
79 int sttd_client_get_current_thinking();
80
81 int sttd_cliet_set_timer(unsigned int uid, Ecore_Timer* timer);
82
83 int sttd_cliet_get_timer(unsigned int uid, Ecore_Timer** timer);
84 #endif
85
86 int sttd_client_get_list(unsigned int** uids, int* uid_count);
87
88 int stt_client_set_current_recognition(unsigned int uid);
89
90 unsigned int stt_client_get_current_recognition();
91
92 int stt_client_unset_current_recognition();
93
94
95 int stt_client_set_app_agreed(unsigned int uid);
96
97 bool stt_client_get_app_agreed(unsigned int uid);
98
99 int sttd_client_get_audio_id(unsigned int uid, char** audio_id);
100
101 int sttd_client_set_audio_id(unsigned int uid, const char* audio_id);
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif  /* __STTD_CLIENT_DATA_H_ */
108