Tizen 2.1 base
[platform/core/system/sync-agent.git] / include / event / oma_dm_alert_api.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef OMA_DM_ALERT_API_H_
19 #define OMA_DM_ALERT_API_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif                          /* __cplusplus */
24
25 #include <glib.h>
26 #include "oma_dm_api_common.h"
27
28 /**
29  * @file        oma_dm_alert_api.h
30  * @brief       Support to use framework event module for agent
31  */
32
33 /** @addtogroup event
34  *      @{
35  */
36
37 /**
38  * @brief       Structure of sync_agent_dm_alert_option_s
39  */
40         typedef struct _ui_alert_option {
41                 char *min_t;            /**< minimum time */
42                 char *max_t;            /**< maximum time */
43                 char *default_data;
44                                 /**< default data value */
45                 char *maxlen;           /**< maximum length */
46                 char *input_type;       /**< input type */
47                 char *echo_type;        /**< echo type */
48         } sync_agent_dm_alert_option_s;
49
50 /**
51  * API to Init alert ui config event API.
52  * @remarks This function is use to init alert ui config.
53  *
54  * @par Usage:
55  * @code
56  *
57  *
58         sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
59
60         err_code = sync_agent_dm_alert_init();
61         if(err != SYNC_AGENT_DM_MO_SUCCESS) {
62                 //error handling
63         }
64         ...
65  *
66  * @endcode
67  *
68  *
69  *
70  * @return SYNC_AGENT_DM_MO_SUCCESS on success, SYNC_AGENT_DM_MO_FAIL on error
71  *
72  * @pre  This function should be called if need to init alert ui config.
73  * @post
74  *
75  * @par Since:
76  *
77  *
78  * @see
79  *
80  */
81         sync_agent_dm_error_e sync_agent_dm_alert_init();
82
83 /**
84  * API to Deinit alert ui config event API.
85  * @remarks This function is use to deinit alert ui config.
86  *
87  * @par Usage:
88  * @code
89  *
90  *
91         sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
92
93         err_code = sync_agent_dm_alert_init();
94         if(err != SYNC_AGENT_DM_MO_SUCCESS) {
95                 //error handling
96         }
97         ...
98  *
99  * @endcode
100  *
101  *
102  *
103  * @return SYNC_AGENT_DM_MO_SUCCESS on success, SYNC_AGENT_DM_MO_FAIL on error
104  *
105  * @pre  This function should be called if need to deinit alert ui config.
106  * @post
107  *
108  * @par Since:
109  *
110  *
111  * @see
112  *
113  */
114         sync_agent_dm_error_e sync_agent_dm_alert_deinit();
115
116 /*sync_agent_dm_error_e sync_agent_dm_alert_display(int response_type);*/
117
118 /**
119  * API to Confirmation alert event API.
120  * @remarks This function is use confirmation user interaction alert ui.
121  *
122  * @par Usage:
123  * @code
124  *
125  *
126         sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
127         int response_type = 1; //success
128
129         err_code = sync_agent_dm_alert_confirmation(response_type);
130         if(err != SYNC_AGENT_DM_MO_SUCCESS) {
131                 //error handling
132         }
133         ...
134  *
135  * @endcode
136  *
137  * @param[in] response_type response value
138  *
139  * @return SYNC_AGENT_DM_MO_SUCCESS on success, SYNC_AGENT_DM_MO_FAIL on error
140  *
141  * @pre  This function should be called if need to confirmation user interaction alert ui.
142  * @post
143  *
144  * @par Since:
145  *
146  *
147  * @see
148  *
149  */
150         sync_agent_dm_error_e sync_agent_dm_alert_confirmation(int response_type);
151
152 /**
153  * API to Inputtext alert event API.
154  * @remarks This function is use inputtext user interaction alert ui.
155  *
156  * @par Usage:
157  * @code
158  *
159  *
160         sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
161         int response_type = 1; //success
162         char *text = strdup("xxxx"); //input data by ui
163
164         err_code = sync_agent_dm_alert_inputtext(response_type, text);
165         if(err != SYNC_AGENT_DM_MO_SUCCESS) {
166                 //error handling
167         }
168         ...
169  *
170  * @endcode
171  *
172  * @param[in] response_type response value
173  *  @param[in] text     input text by user
174  *
175  * @return SYNC_AGENT_DM_MO_SUCCESS on success, SYNC_AGENT_DM_MO_FAIL on error
176  *
177  * @pre  This function should be called if need to confirmation user interaction alert ui.
178  * @post
179  *
180  * @par Since:
181  *
182  *
183  * @see
184  *
185  */
186         sync_agent_dm_error_e sync_agent_dm_alert_inputtext(int response_type, char *text);
187
188 /**
189  * API to Single choice alert event API
190  * @remarks This function is use single choice user interaction alert ui
191  *
192  * @par Usage:
193  * @code
194  *
195  *
196         sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
197         int response_type = 1; //success
198         int selected_count = 1; // 1
199         char *selected_number = strdup("1");
200
201         err_code = sync_agent_dm_alert_single_choice(response_type, text);
202         if(err != SYNC_AGENT_DM_MO_SUCCESS) {
203                 //error handling
204         }
205         ...
206  *
207  * @endcode
208  *
209  * @param[in] response_type response value
210  * @param[in] selected_count absolute "1"
211  * @param[in] selected_number clicked number by user
212  *
213  * @return SYNC_AGENT_DM_MO_SUCCESS on success, SYNC_AGENT_DM_MO_FAIL on error
214  *
215  * @pre  This function should be called if need to single choice user interaction alert ui
216  * @post
217  *
218  * @par Since:
219  *
220  *
221  * @see
222  *
223  */
224         sync_agent_dm_error_e sync_agent_dm_alert_single_choice(int response_type, int selected_count, char *selected_number);
225
226 /**
227  * API to Multiple choice alert event API
228  * @remarks This function is use multiple choice user interaction alert ui
229  *
230  * @par Usage:
231  * @code
232  *
233  *
234         sync_agent_dm_mo_error_e err = SYNC_AGENT_DM_MO_SUCCESS;
235         int response_type = 1; //success
236         char *selected_number1 = strdup("1"); //input data by ui
237         char *selected_number2 = strdup("1");   //input data by ui
238 //      int selected_count = 0;
239
240         GList * out_data_list = NULL;
241         out_data_list = g_list_append(out_data_list, selected_number1);
242         out_data_list = g_list_append(out_data_list, selected_number2);
243
244 //      selected_count = g_list_length(out_data_list);
245
246 //      err_code = sync_agent_dm_alert_multiple_choice(response_type, selected_count, out_data_list);
247   err_code = sync_agent_dm_alert_multiple_choice(response_type, out_data_list);
248         if(err != SYNC_AGENT_DM_MO_SUCCESS) {
249                 //error handling
250         }
251         ...
252  *
253  * @endcode
254  *
255  * @param[in] response_type response value
256  * @param[in] out_data_list clicked numbers by user
257  *
258  * @return SYNC_AGENT_DM_MO_SUCCESS on success, SYNC_AGENT_DM_MO_FAIL on error
259  *
260  * @pre  This function should be called if need to multiple choice user interaction alert ui
261  * @post
262  *
263  * @par Since:
264  *
265  *
266  * @see
267  *
268  */
269         sync_agent_dm_error_e sync_agent_dm_alert_multiple_choice(int response_type, GList * out_data_list);
270
271 /**
272  *      @}
273  */
274
275 #ifdef __cplusplus
276 }
277 #endif                          /* __cplusplus */
278 #endif                          /* OMA_DM_ALERT_API_H_ */