init Service Federation
[archive/platform/core/convergence/service-federation.git] / svcbox / svcbox.h
1 /*
2  * Service Box
3  *
4  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __TIZEN_CONVERGENCE_SERVICE_BOX_H__
21 #define __TIZEN_CONVERGENCE_SERVICE_BOX_H__
22
23 #ifndef API
24 #define API __attribute__ ((visibility("default")))
25 #endif
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #include <stdio.h>
33 #include <app_control.h>
34
35 /**
36  * @file svcbox.h
37  */
38
39 /**
40  * @ingroup
41  * @defgroup
42  *
43  * @brief
44  *
45  * @section
46  *  \#include <svcbox.h>
47  *
48  * <BR>
49  * @{
50  */
51
52 /**
53  * @brief Enumerations of error code for Service Box
54  */
55 typedef enum _svcbox_result_e
56 {
57         SVCBOX_RESULT_SUCCEEDED = 0,
58 } svcbox_result_e;
59
60 /**
61  * @brief Enumerations of error code for Service Box
62  */
63 typedef enum _svcbox_service_spec_type_e
64 {
65         OAUTH_1_0 = 0,
66         OAUTH_2_0 = 1,
67         VCARD_2_1 = 2,
68         VCARD_3_0 = 3,
69 } svcbox_service_spec_type_e;
70
71 /**
72 * @brief Describes profile list about Service Box
73 */
74 typedef struct _svcbox_profiles_s
75 {
76         int list_len;
77 } svcbox_profiles_s;
78
79 /**
80 * @brief The handle for profile list of Service Box
81 */
82 typedef svcbox_profiles_s *svcbox_profiles_h;
83
84 /**
85 * @brief Describes profile information about Service Box
86 */
87 typedef struct _svcbox_profile_info_s
88 {
89         char *uri;
90 } svcbox_profile_info_s;
91
92 /**
93 * @brief The handle for profile information of Service Box
94 */
95 typedef svcbox_profile_info_s *svcbox_profile_info_h;
96
97 /**
98 * @brief Describes service list about Service Box
99 */
100 typedef struct _svcbox_services_s
101 {
102         int list_len;
103 } svcbox_services_s;
104
105 /**
106 * @brief The handle for service list of Service Box
107 */
108 typedef svcbox_services_s *svcbox_services_h;
109
110 /**
111 * @brief Describes service information about Service Box
112 */
113 typedef struct _svcbox_service_info_s
114 {
115         char *uri;
116 } svcbox_service_info_s;
117
118 /**
119 * @brief The handle for profile information of Service Box
120 */
121 typedef svcbox_service_info_s *svcbox_service_info_h;
122
123 /**
124 * @brief Callback for svcbox_profiles_list_foreach_profile_info API
125 *
126 * @param[in]    profile_info    specifies profile information handle
127 * @param[in]    user_data       specifies user_data of svcbox_profiles_list_foreach_profile_info()
128 * @return       void.
129 * @pre  svcbox_profiles_list_foreach_profile_info() will invoke this callback.
130 * @see
131 */
132 typedef void (*svcbox_profile_info_cb)(svcbox_profile_info_h profile_info,
133                                                 void *user_data);
134
135 /**
136 * @brief Callback for svcbox_services_list_foreach_service_info API
137 *
138 * @param[in]    profile_info    specifies service information handle
139 * @param[in]    user_data       specifies user_data of svcbox_services_list_foreach_service_info()
140 * @return       void.
141 * @pre  svcbox_services_list_foreach_service_info() will invoke this callback.
142 * @see
143 */
144 typedef void (*svcbox_service_info_cb)(svcbox_service_info_h service_info,
145                                                 void *user_data);
146
147 /*==================================================================================================
148                                          FUNCTION PROTOTYPES
149 ==================================================================================================*/
150
151 /**
152 * @brief Connects Service Box
153 *
154 * @param[in]
155 * @return 0 on success, otherwise a negative error value
156 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
157 */
158 int svcbox_connect();
159
160 /**
161 * @brief Disconnects Service Box
162 *
163 * @param[in]
164 * @return 0 on success, otherwise a negative error value
165 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
166 */
167 int svcbox_disconnect();
168
169 /**
170 * @brief Creates Profile List
171 *
172 * @param[in]
173 * @return 0 on success, otherwise a negative error value
174 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
175 */
176 int svcbox_profiles_list_create(svcbox_profiles_h *profiles);
177
178 /**
179 * @brief Destroies Profile List
180 *
181 * @param[in]
182 * @return 0 on success, otherwise a negative error value
183 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
184 */
185 int svcbox_profiles_list_destroy(svcbox_profiles_h profiles);
186
187 /**
188 * @brief Adds Profile Information in Profile List
189 *
190 * @param[in]
191 * @return 0 on success, otherwise a negative error value
192 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
193 */
194 int svcbox_profiles_list_add(svcbox_profile_info_h profile_info);
195
196 /**
197 * @brief Removes Profile Information in Profile List
198 *
199 * @param[in]
200 * @return 0 on success, otherwise a negative error value
201 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
202 */
203 int svcbox_profiles_list_remove(svcbox_profile_info_h profile_info);
204
205 /**
206 * @brief Retrieves Profile Information of Profile List
207 *
208 * @param[in]
209 * @return 0 on success, otherwise a negative error value
210 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
211 */
212 int svcbox_profiles_list_foreach_profile_info(svcbox_profiles_h profiles,
213                                                 svcbox_profile_info_cb callback,
214                                                 void *user_data);
215
216 /**
217 * @brief Creates Profile Information
218 *
219 * @param[in]
220 * @return 0 on success, otherwise a negative error value
221 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
222 */
223 int svcbox_profile_info_create(svcbox_profile_info_h *profile_info);
224
225 /**
226 * @brief Destroies Profile Information
227 *
228 * @param[in]
229 * @return 0 on success, otherwise a negative error value
230 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
231 */
232 int svcbox_profile_info_destroy(svcbox_profile_info_h profile_info);
233
234 /**
235 * @brief Sets Profile URI
236 *
237 * @param[in]
238 * @return 0 on success, otherwise a negative error value
239 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
240 */
241 int svcbox_profile_info_set_uri(svcbox_profile_info_h profile_info,
242                                                 const char *uri);
243
244 /**
245 * @brief Gets Profile URI
246 *
247 * @param[in]
248 * @return 0 on success, otherwise a negative error value
249 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
250 */
251 int svcbox_profile_info_get_uri(svcbox_profile_info_h profile_info,
252                                                 char **uri);
253
254 /**
255 * @brief Sets Profile Root Path
256 *
257 * @param[in]
258 * @return 0 on success, otherwise a negative error value
259 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
260 */
261 int svcbox_profile_info_set_root_path(svcbox_profile_info_h profile_info,
262                                                 const char *path);
263
264 /**
265 * @brief Gets Profile Root Path
266 *
267 * @param[in]
268 * @return 0 on success, otherwise a negative error value
269 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
270 */
271 int svcbox_profile_info_get_root_path(svcbox_profile_info_h profile_info,
272                                                 char **path);
273
274 /**
275 * @brief Creates Service List
276 *
277 * @param[in]
278 * @return 0 on success, otherwise a negative error value
279 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
280 */
281 int svcbox_services_list_create(svcbox_services_h *services);
282
283 /**
284 * @brief Destroies Service List
285 *
286 * @param[in]
287 * @return 0 on success, otherwise a negative error value
288 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
289 */
290 int svcbox_services_list_destroy(svcbox_services_h services);
291
292 /**
293 * @brief Adds Service Information in Service List
294 *
295 * @param[in]
296 * @return 0 on success, otherwise a negative error value
297 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
298 */
299 int svcbox_services_list_add(svcbox_service_info_h service_info);
300
301 /**
302 * @brief Removes Service Information in Service List
303 *
304 * @param[in]
305 * @return 0 on success, otherwise a negative error value
306 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
307 */
308 int svcbox_services_list_remove(svcbox_service_info_h service_info);
309
310 /**
311 * @brief Retrieves Service Information of Service List
312 *
313 * @param[in]
314 * @return 0 on success, otherwise a negative error value
315 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
316 */
317 int svcbox_services_list_foreach_service_info(svcbox_services_h services,
318                                                 svcbox_service_info_cb callback,
319                                                 void *user_data);
320
321 /**
322 * @brief Creates Service Information
323 *
324 * @param[in]
325 * @return 0 on success, otherwise a negative error value
326 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
327 */
328 int svcbox_service_info_create(svcbox_service_info_h *service_info);
329
330 /**
331 * @brief Destroies Service Information
332 *
333 * @param[in]
334 * @return 0 on success, otherwise a negative error value
335 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
336 */
337 int svcbox_service_info_destroy(svcbox_service_info_h service_info);
338
339 /**
340 * @brief Sets Service URI
341 *
342 * @param[in]
343 * @return 0 on success, otherwise a negative error value
344 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
345 */
346 int svcbox_service_info_set_uri(svcbox_service_info_h service_info,
347                                                 const char *uri);
348
349 /**
350 * @brief Gets Service URI
351 *
352 * @param[in]
353 * @return 0 on success, otherwise a negative error value
354 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
355 */
356 int svcbox_service_info_get_uri(svcbox_service_info_h service_info,
357                                                 char **uri);
358
359 /**
360 * @brief Sets Service Root Path
361 *
362 * @param[in]
363 * @return 0 on success, otherwise a negative error value
364 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
365 */
366 int svcbox_service_info_set_root_path(svcbox_service_info_h service_info,
367                                                 const char *path);
368
369 /**
370 * @brief Gets Service Root Path
371 *
372 * @param[in]
373 * @return 0 on success, otherwise a negative error value
374 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
375 */
376 int svcbox_service_info_get_root_path(svcbox_service_info_h service_info,
377                                                 char **path);
378
379 /**
380 * @brief Sets Service Name
381 *
382 * @param[in]
383 * @return 0 on success, otherwise a negative error value
384 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
385 */
386 int svcbox_service_info_set_name(svcbox_service_info_h service_info,
387                                                 const char *name);
388
389 /**
390 * @brief Gets Service Name
391 *
392 * @param[in]
393 * @return 0 on success, otherwise a negative error value
394 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
395 */
396 int svcbox_service_info_get_name(svcbox_service_info_h service_info,
397                                                 char **name);
398
399 /**
400 * @brief Sets Service Spec
401 *
402 * @param[in]
403 * @return 0 on success, otherwise a negative error value
404 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
405 */
406 int svcbox_service_info_set_spec(svcbox_service_info_h service_info,
407                                                 svcbox_service_spec_type_e type);
408
409 /**
410 * @brief Gets Service Spec
411 *
412 * @param[in]
413 * @return 0 on success, otherwise a negative error value
414 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
415 */
416 int svcbox_service_info_get_spec(svcbox_service_info_h service_info,
417                                                 svcbox_service_spec_type_e *type);
418
419 /**
420 * @brief Sets Service Spec Value
421 *
422 * @param[in]
423 * @return 0 on success, otherwise a negative error value
424 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
425 */
426 int svcbox_service_info_set_spec_value(svcbox_service_info_h service_info,
427                                                 const char *key,
428                                                 const char *value);
429
430 /**
431 * @brief Gets Service Spec Value
432 *
433 * @param[in]
434 * @return 0 on success, otherwise a negative error value
435 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
436 */
437 int svcbox_service_info_get_spec_value(svcbox_service_info_h service_info,
438                                                 const char *key,
439                                                 char **value);
440
441 /**
442 * @brief Sets Service App Control
443 *
444 * @param[in]
445 * @return 0 on success, otherwise a negative error value
446 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
447 */
448 int svcbox_service_info_set_app_control(svcbox_service_info_h service_info,
449                                                 app_control_h app_control);
450
451 /**
452 * @brief Gets Service App Control
453 *
454 * @param[in]
455 * @return 0 on success, otherwise a negative error value
456 * @retval error code defined in svcbox_result_e - SVCBOX_RESULT_SUCCEEDED if Successful
457 */
458 int svcbox_service_info_get_app_control(svcbox_service_info_h service_info,
459                                                 app_control_h *app_control);
460
461 /**
462  * @}
463  */
464
465 #ifdef __cplusplus
466 }
467 #endif
468
469 #endif /* __TIZEN_CONVERGENCE_SERVICE_BOX_H__ */