d9f7d86286e5a4c857fa14049fd9e2dc5909e080
[platform/core/system/sync-agent.git] / include / data-adapter / interface_service_item.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 INTERFACE_SERVICE_ITEM_H_
19 #define INTERFACE_SERVICE_ITEM_H_
20
21 #include "common.h"
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif                          /* __cplusplus */
26
27 /**
28  * @file                interface_service_item.h
29  * @brief       Support to use service storage
30  */
31
32 /** @addtogroup data_adapter
33  *      @{
34  */
35
36 /**
37  * @brief       Structure of framework service item instance
38  */
39         typedef struct {
40                 char *item_id;                  /** service item id */
41                 int content_type;               /** content type of service item */
42                 int account_id;                 /** service account id */
43                 char *folder_id;                /** service folder id to which service item mapped to */
44                 char *parent_id;                /** parent service id to which service item mapped to */
45                 char *access_name;              /** name of accessor */
46                 const void *data;               /** void pointer type of service data */
47         } sync_agent_da_service_item_s;
48
49 /**
50  * @brief       Structure of framework service folder instance
51  */
52         typedef struct {
53                 char *folder_id;                /** service folder id */
54                 char *folder_name;      /** name of service folder */
55                 int folder_type;                /** type of service folder */
56         } sync_agent_da_service_folder_s;
57
58 /**
59  * @brief       Structure of query used to delete framework service item
60  */
61         typedef struct {
62                 int content_type;       /**< type of content to delete */
63                 int account_id; /**< id of the account desired to delete */
64         } sync_agent_da_delete_service_item_query_s;
65
66 /**
67  * @brief                               Open service database
68  * @par Usage:
69  * @code
70  
71  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
72  
73  ret = sync_agent_open_service(FW_CONTACT);
74  if (ret != SYNC_AGENT_DA_SUCCESS) {
75         ...
76  }
77  
78  * @endcode
79  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
80  * @return                      operation result
81  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
82  * @retval                      error_value                                             fail
83  */
84         sync_agent_da_return_e sync_agent_open_service(int content_type);
85
86 /**
87  * @brief                               Close service database
88  * @par Usage:
89  * @code
90  
91  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
92  
93  ret = sync_agent_close_service(FW_CONTACT);
94  if (ret != SYNC_AGENT_DA_SUCCESS) {
95         ...
96  }
97  
98  * @endcode
99  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
100  * @return                      operation result
101  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
102  * @retval                      error_value                                             fail
103  */
104         sync_agent_da_return_e sync_agent_close_service(int content_type);
105
106 /**
107  * @brief                               Start transaction for service database
108  * @par Usage:
109  * @code
110  
111  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
112  
113  ret = sync_agent_begin_service(FW_CONTACT);
114  if (ret != SYNC_AGENT_DA_SUCCESS) {
115         ...
116  }
117  
118  * @endcode
119  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
120  * @return                      operation result
121  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
122  * @retval                      error_value                                             fail
123  */
124         sync_agent_da_return_e sync_agent_begin_service(int content_type);
125
126 /**
127  * @brief                               End transaction for service database
128  * @par Usage:
129  * @code
130  
131  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
132  
133  ret = sync_agent_end_service(FW_CONTACT, false);       //transaction rollback by 'false'
134  if (ret != SYNC_AGENT_DA_SUCCESS) {
135         ...
136  }
137  
138  * @endcode
139  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
140  * @param[in]                   is_success                                              1 : commit, 0 : rollback
141  * @return                      operation result
142  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
143  * @retval                      error_value                                             fail
144  */
145         sync_agent_da_return_e sync_agent_end_service(int content_type, int is_success);
146
147 /**
148 * @brief                                Create initialized framework service item instance
149 * @par Usage:
150 * @code
151
152 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
153 sync_agent_da_service_item_s *service_item = NULL;
154
155 ret = sync_agent_create_service_item(&service_item);
156 if (ret != SYNC_AGENT_DA_SUCCESS) {
157    ...
158 }
159
160 * @endcode
161 * @param[out]           service_item                                            sync_agent_da_service_item_s type of framework service item instance newly initialied
162 * @return                       operation result
163 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
164 * @retval                               error_value                                             fail
165 */
166         sync_agent_da_return_e sync_agent_create_service_item(sync_agent_da_service_item_s ** service_item);
167
168 /**
169 * @brief                                Create initialized framework service folder instance
170 * @par Usage:
171 * @code
172
173 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
174 sync_agent_da_service_folder_s *service_folder = NULL;
175
176 ret = sync_agent_create_service_folder(&service_folder);
177 if (ret != SYNC_AGENT_DA_SUCCESS) {
178    ...
179 }
180
181 * @endcode
182 * @param[out]           service_folder                                          sync_agent_da_service_folder_s type of framework service folder instance newly initialied
183 * @return                       operation result
184 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
185 * @retval                               error_value                                             fail
186 */
187         sync_agent_da_return_e sync_agent_create_service_folder(sync_agent_da_service_folder_s ** service_folder);
188
189 /**
190 * @brief                                Free framework service item instance provided
191 * @par Usage:
192 * @code
193
194 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
195 sync_agent_da_service_item_s *service_item = NULL;
196
197 ret = sync_agent_create_service_item(&service_item);
198 if (ret != SYNC_AGENT_DA_SUCCESS) {
199    ...
200 }
201
202 ...
203
204 ret = sync_agent_free_service_item(service_item);
205 if (ret != SYNC_AGENT_DA_SUCCESS) {
206    ...
207 }
208
209 * @endcode
210 * @param[in]                    service_item                                            sync_agent_da_service_item_s type of framework service item instance to free
211 * @return                       operation result
212 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
213 * @retval                               error_value                                             fail
214 */
215         sync_agent_da_return_e sync_agent_free_service_item(sync_agent_da_service_item_s * service_item);
216
217 /**
218 * @brief                                Free framework service folder instance provided
219 * @par Usage:
220 * @code
221
222 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
223 sync_agent_da_service_folder_s *service_folder = NULL;
224
225 ret = sync_agent_create_service_folder(&service_folder);
226 if (ret != SYNC_AGENT_DA_SUCCESS) {
227    ...
228 }
229
230 ...
231
232 ret = sync_agent_free_service_folder(&service_folder);
233 if (ret != SYNC_AGENT_DA_SUCCESS) {
234    ...
235 }
236
237 * @endcode
238 * @param[in]                    service_folder                                          sync_agent_da_service_folder_s type of framework service folder instance to free
239 * @return                       operation result
240 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
241 * @retval                               error_value                                             fail
242 */
243         sync_agent_da_return_e sync_agent_free_service_folder(sync_agent_da_service_folder_s * service_folder);
244
245 /**
246 * @brief                                Add framework service item instance into frameowrk db
247 * @par Usage:
248 * @code
249
250 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
251 sync_agent_da_service_item_s *service_item = NULL;
252 char *item_id = NULL;
253
254 ret = sync_agent_create_service_item(&service_item);
255 if (ret != SYNC_AGENT_DA_SUCCESS) {
256    ...
257 }
258
259 ...
260
261 ret = sync_agent_add_service_item(service_item, &item_id, true);
262 if (ret != SYNC_AGENT_DA_SUCCESS) {
263    ...
264 }
265
266 * @endcode
267 * @param[in]                    service_item                                            sync_agent_da_service_item_s type of framework service item instance to add into framework db
268 * @param[out]           item_id                                                 id of framework service item instance added new
269 * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
270 * @return                       operation result
271 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
272 * @retval                               error_value                                             fail
273 */
274         sync_agent_da_return_e sync_agent_add_service_item(sync_agent_da_service_item_s * service_item, char **item_id, bool update_changelog);
275
276
277 /**
278 * @brief                                Add framework service item instance into frameowrk db
279 * @par Usage:
280 * @code
281
282 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
283 sync_agent_da_service_item_s *service_item = NULL;
284 char *item_id = NULL;
285
286 ret = sync_agent_create_service_item(&service_item);
287 if (ret != SYNC_AGENT_DA_SUCCESS) {
288    ...
289 }
290
291 ...
292
293 ret = sync_agent_add_service_bulk_item(service_item, &item_id, true);
294 if (ret != SYNC_AGENT_DA_SUCCESS) {
295    ...
296 }
297
298 * @endcode
299 * @param[in]                    service_item                                            sync_agent_da_service_item_s type of framework service item instance to add into framework db
300 * @param[out]           item_id                                                 id of framework service item instance added new
301 * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
302 * @return                       operation result
303 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
304 * @retval                               error_value                                             fail
305 */
306         sync_agent_da_return_e sync_agent_add_service_bulk_item(sync_agent_da_service_item_s *service_item, char **item_id, bool update_changelog);
307
308 /**
309 * @brief                                Update framework service item on framework db
310 * @par Usage:
311 * @code
312
313 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
314 sync_agent_da_service_item_s *service_item = NULL;
315
316 ret = sync_agent_get_service_item(item_id, &service_item);
317 if (ret != SYNC_AGENT_DA_SUCCESS) {
318    ...
319 }
320
321 ...
322
323 ret = sync_agent_update_service_item(service_item, item_id, true);
324 if (ret != SYNC_AGENT_DA_SUCCESS) {
325    ...
326 }
327
328 * @endcode
329 * @param[in]                    service_item                                            sync_agent_da_service_item_s type of framework service item instance to update into framework db
330 * @param[in]                    item_id                                                 id of framework service item instance desired to update
331 * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
332 * @return                       operation result
333 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
334 * @retval                               error_value                                             fail
335 */
336         sync_agent_da_return_e sync_agent_update_service_item(sync_agent_da_service_item_s * service_item, char *item_id, bool update_changelog);
337
338 /**
339 * @brief                                Update framework service item on framework db
340 * @par Usage:
341 * @code
342
343 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
344 sync_agent_da_service_item_s *service_item = NULL;
345
346 ret = sync_agent_get_service_item(item_id, &service_item);
347 if (ret != SYNC_AGENT_DA_SUCCESS) {
348    ...
349 }
350
351 ...
352
353 ret = sync_agent_update_service_bulk_item(service_item, &item_id, true);
354 if (ret != SYNC_AGENT_DA_SUCCESS) {
355    ...
356 }
357
358 * @endcode
359 * @param[in]                    service_item                                            sync_agent_da_service_item_s type of framework service item instance to update into framework db
360 * @param[in]                    item_id                                                 id of framework service item instance desired to update
361 * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
362 * @return                       operation result
363 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
364 * @retval                               error_value                                             fail
365 */
366         sync_agent_da_return_e sync_agent_update_service_bulk_item(sync_agent_da_service_item_s *service_item, char **item_id, bool update_changelog);
367
368         /**
369         * @brief                                Update calendar exdate:updated item on framework db
370         * @par Usage:
371         * @code
372
373         sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
374         sync_agent_da_service_item_s *service_item = NULL;
375
376         ret = sync_agent_get_service_item(item_id, &service_item);
377         if (ret != SYNC_AGENT_DA_SUCCESS) {
378            ...
379         }
380
381         ...
382
383         ret = sync_agent_add_updated_exdate_item(service_item, &item_id, true);
384         if (ret != SYNC_AGENT_DA_SUCCESS) {
385            ...
386         }
387
388         * @endcode
389         * @param[in]                    service_item                                            sync_agent_da_service_item_s type of framework service item instance to update into framework db
390         * @param[in]                    parent_id                                               id of framework parent service item instance desired to update
391         * @param[in]                    child_id                                                        id of framework child service item instance desired to update
392         * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
393         * @return                       operation result
394         * @retval                               SYNC_AGENT_DA_SUCCESS                   success
395         * @retval                               error_value                                             fail
396         */
397         sync_agent_da_return_e sync_agent_add_updated_exdate_item(sync_agent_da_service_item_s * service_item, char *parent_id, char *child_id, bool update_changelog);
398         /**
399         * @brief                                Update calendar exdate:updated parent item
400         * @par Usage:
401         * @code
402
403         sync_agent_construct_exdate_parent_item(service_item);
404
405         * @endcode
406         * @param[in]                    service_item                                            parent servic item id
407         * @return                       void
408         */
409         void sync_agent_construct_exdate_parent_item(int content_type, char *parent_service_id);
410
411
412 /**
413 * @brief                                Delete framework service item instance from frameowrk db
414 * @par Usage:
415 * @code
416
417 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
418
419 ret = sync_agent_delete_service_item(item_id, true);
420 if (ret != SYNC_AGENT_DA_SUCCESS) {
421    ...
422 }
423
424 * @endcode
425 * @param[in]                    item_id                                                 id of framework service item instance desired to delete
426 * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
427 * @return                       operation result
428 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
429 * @retval                               error_value                                             fail
430 */
431         sync_agent_da_return_e sync_agent_delete_service_item(char *item_id, bool update_changelog);
432
433 /**
434 * @brief                                Delete framework service item instance from frameowrk db
435 * @par Usage:
436 * @code
437
438 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
439 int count
440
441 ret = sync_agent_delete_service_bulk_item(item_id, count, true);
442 if (ret != SYNC_AGENT_DA_SUCCESS) {
443    ...
444 }
445
446 * @endcode
447 * @param[in]                    item_id                                                 id of framework service item instance desired to delete
448 * @param[in]                    count                                           count of id
449 * @param[in]                    update_changelog                                        option specifying whether use of changelog for sync history
450 * @return                       operation result
451 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
452 * @retval                               error_value                                     fail
453 */
454         sync_agent_da_return_e sync_agent_delete_service_bulk_item(char **item_id, int count, bool update_changelog);
455
456
457 /**
458 * @brief                                Delete framework service item instance from frameowrk db using query option
459 * @par Usage:
460 * @code
461
462 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
463 sync_agent_da_delete_service_item_query_s query;
464
465 query.content_type = FW_CONTACT;
466 query.account_id = account_id;
467
468 ret = sync_agent_query_delete_service_items(&query);
469 if (ret != SYNC_AGENT_DA_SUCCESS) {
470    ...
471 }
472
473 * @endcode
474 * @param[in]                    query                                                   sync_agent_da_delete_service_item_query_s type of query for delete operation
475 * @return                       operation result
476 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
477 * @retval                               error_value                                             fail
478 */
479         sync_agent_da_return_e sync_agent_query_delete_service_items(sync_agent_da_delete_service_item_query_s * query);
480
481 /**
482 * @brief                                Fetch framework service item from framework db
483 * @par Usage:
484 * @code
485
486 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
487 sync_agent_da_service_item_s *service_item = NULL;
488
489 ret = sync_agent_get_service_item(item_id, &service_item);
490 if (ret != SYNC_AGENT_DA_SUCCESS) {
491    ...
492 }
493
494 * @endcode
495 * @param[in]                    item_id                                                 id of framework service item instance desired to get
496 * @param[out]           service_item                                            framework service item instance fetched
497 * @return                       operation result
498 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
499 * @retval                               error_value                                             fail
500 */
501         sync_agent_da_return_e sync_agent_get_service_item(char *item_id, sync_agent_da_service_item_s ** service_item);
502
503 /**
504 * @brief                                Fetch framework service folder from framework db
505 * @par Usage:
506 * @code
507
508 sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
509 sync_agent_da_service_folder_s *service_folder = NULL;
510
511 ret = sync_agent_get_service_folder(folder_id, &service_folder);
512 if (ret != SYNC_AGENT_DA_SUCCESS) {
513    ...
514 }
515
516 * @endcode
517 * @param[in]                    folder_id                                                       id of framework service folder instance desired to get
518 * @param[out]           service_folder                                          framework service folder instance fetched
519 * @return                       operation result
520 * @retval                               SYNC_AGENT_DA_SUCCESS                   success
521 * @retval                               error_value                                             fail
522 */
523         sync_agent_da_return_e sync_agent_get_service_folder(char *folder_id, sync_agent_da_service_folder_s ** service_folder);
524
525 /**
526  * @brief                               Execute predefined operation through plug-in
527  * @par Usage:
528  * @code
529  
530  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
531  char *msg = get_msg_body();
532  bool *result = NULL;
533  
534  ret = sync_agent_execute_service(FW_SMS, account_id, "send_msg", msg, &result);
535  if (ret != SYNC_AGENT_DA_SUCCESS) {
536         ...
537  }
538  
539  * @endcode
540  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
541  * @param[in]                   account_id                                              F/W account id
542  * @param[in]                   execute_key                                             execute key
543  * @param[in]                   execute_values                                  execute values
544  * @param[out]          result                                                  extension result info
545  * @return                      operation result
546  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
547  * @retval                      error_value                                             fail
548  */
549         sync_agent_da_return_e sync_agent_execute_service(int content_type, int account_id, const char *execute_key, void *execute_values, void **result);
550
551 /**
552  * @brief                               Get item used count
553  * @par Usage:
554  * @code
555  
556  int count = 0;
557
558  count = sync_agent_get_used_service_item_count(FW_CONTACT);
559  if (count == 0) {
560         ...
561  } else {
562         ...
563  }
564  
565  * @endcode
566  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
567  * @return                      operation result
568  * @retval                      current item count                                      success
569  * @retval                      error value                                             fail
570  */
571         int sync_agent_get_used_service_item_count(int content_type);
572
573 /**
574  * @brief                               Get calendar exdate item count
575  * @par Usage:
576  * @code
577  int count = 0;
578
579  count = sync_agent_get_deleted_exdate_item_count(FW_CALENDAR);
580  if (count == 0) {
581         ...
582  } else {
583         ...
584  }
585
586  * @endcode
587  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
588  * @return                      operation result
589  * @retval                      current item count                                      success
590  * @retval                      error value                                             fail
591  */
592         int sync_agent_get_deleted_exdate_item_count(int content_type);
593
594 /**
595  * @brief                               Get calendar exdate item count
596  * @par Usage:
597  * @code
598
599 sync_agent_is_exist_exdate_item(FW_CALENDAR, fw_parent_id, child_vcalendar)
600
601  * @endcode
602  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
603  * @return                      operation result
604  * @retval                      current item count                                      success
605  * @retval                      error value                                             fail
606  */
607         sync_agent_da_return_e sync_agent_is_exist_exdate_item(int content_type, const char *fw_parent_id, const char *child_vcalendar);
608
609 /**
610  * @brief                               Get item used count for folder
611  * @par Usage:
612  * @code
613  
614  int count = 0;
615
616  count = sync_agent_get_used_service_item_count_for_folder(FW_CONTACT, account_id, folder_id);
617  if (count == 0) {
618         ...
619  } else {
620         ...
621  }
622  
623  * @endcode
624  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
625  * @param[in]                   account_id                                              F/W account id
626  * @param[in]                   folder_id       F/W                                             folder id
627  * @return                      operation result
628  * @retval                      current item count                                      success
629  * @retval                      error value                                             fail
630  */
631         int sync_agent_get_used_service_item_count_for_folder(int content_type, int account_id, char *folder_id);
632
633 /**
634  * @brief                               Write data store items to file
635  * @par Usage:
636  * @code
637  
638  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
639  
640  ret = sync_agent_backup_service_items_to_file(FW_CONTACT, account_id, "/tmp/contact_backup");
641  if (ret != SYNC_AGENT_DA_SUCCESS) {
642         ...
643  }
644  
645  * @endcode
646  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
647  * @param[in]                   account_id                                              F/W account id
648  * @param[out]          file_path                                                       written file path
649  * @return                      operation result
650  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
651  * @retval                      error value                                             fail
652  */
653         sync_agent_da_return_e sync_agent_backup_service_items_to_file(int content_type, int account_id, char **file_path);
654
655 /**
656  * @brief                               Add file-written item to data store
657  * @par Usage:
658  * @code
659  
660  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
661  
662  ret = sync_agent_restore_service_items_from_file(FW_CONTACT, account_id, "/tmp/contact_backup");
663  if (ret != SYNC_AGENT_DA_SUCCESS) {
664         ...
665  }
666  
667  * @endcode
668  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
669  * @param[in]                   account_id                                              F/W account id
670  * @param[in]                   file_path                                                       file path
671  * @return                      operation result
672  * @retval                      SYNC_AGENT_DA_SUCCESS                   success
673  * @retval                      error_value                                             fail
674  */
675         sync_agent_da_return_e sync_agent_restore_service_items_from_file(int content_type, int account_id, const char *file_path);
676
677 /**
678  * @brief                               Get service item id from framework service item id
679  * @par Usage:
680  * @code
681  
682  char *item_id = NULL;
683
684  item_id = sync_agent_get_service_item_id(framework_item_id);
685  if (item_id != NULL) {
686         ...
687  }
688  
689  * @endcode
690  * @param[in]                   item_id                                                 item id
691  * @return                      operation result
692  * @retval                      service_item_id                                 success
693  * @retval                      0                                                               fail
694  */
695         char *sync_agent_get_service_item_id(char *item_id);
696
697 /**
698  * @brief                               Get service folder id from framework service folder id
699  * @par Usage:
700  * @code
701  
702  char *folder_id = NULL;
703
704  folder_id = sync_agent_get_service_folder_id(framework_folder_id);
705  if (folder_id != NULL) {
706         ...
707  }
708  
709  * @endcode
710  * @param[in]                   folder_id                                                       folder id
711  * @return                      operation result
712  * @retval                      service_folder_id                                       success
713  * @retval                      0                                                               fail
714  */
715         char *sync_agent_get_service_folder_id(char *folder_id);
716
717 /**
718  * @brief                               Get max name length of sim contact
719  * @par Usage:
720  * @code
721
722  int length = 0;
723
724  length = sync_agent_get_sim_contact_info_max_name_length(FW_CONTACT_SIM);
725  if (length == 0) {
726         ...
727  } else {
728         ...
729  }
730
731  * @endcode
732  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
733  * @return                      operation result
734  * @retval                      current item count                                      success
735  * @retval                      error value                                             fail
736  */
737         int sync_agent_get_sim_contact_info_max_name_length(int content_type);
738
739 /**
740  * @brief                               Get max number length of sim contact
741  * @par Usage:
742  * @code
743
744  int length = 0;
745
746  length = sync_agent_get_sim_contact_info_max_number_length(FW_CONTACT_SIM);
747  if (length == 0) {
748         ...
749  } else {
750         ...
751  }
752
753  * @endcode
754  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
755  * @return                      operation result
756  * @retval                      current item count                                      success
757  * @retval                      error value                                             fail
758  */
759         int sync_agent_get_sim_contact_info_max_number_length(int content_type);
760
761 /**
762  * @brief                               Get max email length of sim contact
763  * @par Usage:
764  * @code
765
766  int length = 0;
767
768  length = sync_agent_get_sim_contact_info_max_email_length(FW_CONTACT_SIM);
769  if (length == 0) {
770         ...
771  } else {
772         ...
773  }
774
775  * @endcode
776  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
777  * @return                      operation result
778  * @retval                      current item count                                      success
779  * @retval                      error value                                             fail
780  */
781         int sync_agent_get_sim_contact_info_max_email_length(int content_type);
782
783 /**
784  * @brief                               Get empty count of sim contact
785  * @par Usage:
786  * @code
787
788  int count = 0;
789
790  count = sync_agent_get_sim_contact_empty_count(FW_CONTACT_SIM);
791  if (count == 0) {
792         ...
793  } else {
794         ...
795  }
796
797  * @endcode
798  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
799  * @return                      operation result
800  * @retval                      current item count                                      success
801  * @retval                      error value                                             fail
802  */
803         int sync_agent_get_sim_contact_empty_count(int content_type);
804
805 /**
806  * @brief                               Get empty number count of sim contact
807  * @par Usage:
808  * @code
809
810  int count = 0;
811
812  count = sync_agent_get_sim_contact_number_empty_count(FW_CONTACT_SIM);
813  if (count == 0) {
814         ...
815  } else {
816         ...
817  }
818
819  * @endcode
820  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
821  * @return                      operation result
822  * @retval                      current item count                                      success
823  * @retval                      error value                                             fail
824  */
825         int sync_agent_get_sim_contact_empty_number_count(int content_type);
826
827 /**
828  * @brief                               Get empty email count of sim contact
829  * @par Usage:
830  * @code
831
832  int count = 0;
833
834  count = sync_agent_get_sim_contact_email_empty_count(FW_CONTACT_SIM);
835  if (count == 0) {
836         ...
837  } else {
838         ...
839  }
840
841  * @endcode
842  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
843  * @return                      operation result
844  * @retval                      current item count                                      success
845  * @retval                      error value                                             fail
846  */
847         int sync_agent_get_sim_contact_empty_email_count(int content_type);
848
849 /**
850  * @brief                               Get addressbook ID of sim contact
851  * @par Usage:
852  * @code
853
854  int addressbook_id = 0;
855
856  addressbook_id = sync_agent_get_sim_contact_adressbook_id(FW_CONTACT_SIM);
857  if (addressbook_id == 0) {
858         ...
859  } else {
860         ...
861  }
862
863  * @endcode
864  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
865  * @return                      operation result
866  * @retval                      current item count                                      success
867  * @retval                      error value                                             fail
868  */
869         int sync_agent_get_sim_contact_addressbook_id(int content_type);
870
871 /**
872  * @brief                               Get item ID of sim contact
873  * @par Usage:
874  * @code
875
876  GList *item_id = NULL;
877  ...
878
879  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
880  int sim_addressbook_id = 0;
881
882  ret = sync_agent_get_sim_contact_item_id(FW_CONTACT_SIM, sim_addressbook_id, &item_id);
883  if (ret == SYNC_AGENT_DA_ERRORS) {
884         ...
885  } else {
886         ...
887  }
888
889  * @endcode
890  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
891  * @param[in]                   addressbook_id                                  addressbook id of sim contact
892  * @param[out]          item_id                                                 item id list of sim contacts
893  * @return                      operation result
894  * @retval                      current item count                                      success
895  * @retval                      error value                                             fail
896  */
897         sync_agent_da_return_e sync_agent_get_sim_contact_item_id(int content_type, int sim_addressbook_id, GList **item_id);
898
899 /**
900  * @brief                               Get item ID of sim contact
901  * @par Usage:
902  * @code
903
904  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
905  char *data = NULL;
906  int item_id;
907
908  ret = sync_agent_get_sim_contact_item(FW_CONTACT_SIM, item_id, &data);
909  if (ret == SYNC_AGENT_DA_ERRORS) {
910         ...
911  } else {
912         ...
913  }
914
915  * @endcode
916  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
917  * @param[in]                   item_id                                                 item id of sim contact
918  * @param[out]          content_type                                            data of sim contact
919  * @return                      operation result
920  * @retval                      current item count                                      success
921  * @retval                      error value                                             fail
922  */
923         sync_agent_da_return_e sync_agent_get_sim_contact_item(int content_type, int item_id, char **data);
924
925 /**
926  * @brief                               Add sim contact
927  * @par Usage:
928  * @code
929
930  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
931  char *data;
932  int sim_addressbook_id;
933  int *item_id = NULL;
934
935  ret = sync_agent_delete_sim_contact_item(FW_CONTACT_SIM, sim_addressbook_id, &item_id, data);
936  if (ret == SYNC_AGENT_DA_ERRORS) {
937         ...
938  } else {
939         ...
940  }
941
942  * @endcode
943  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
944  * @param[in]                   addressbook_id                                  addressbook id of sim contact
945  * @param[out]          item_id                                                 item id of sim contact
946  * @param[in]                   content_type                                            data of sim contact
947  * @return                      operation result
948  * @retval                      current item count                                      success
949  * @retval                      error value                                             fail
950  */
951         sync_agent_da_return_e sync_agent_add_sim_contact_item(int content_type, int sim_addressbook_id, int **item_id, char *data);
952
953 /**
954  * @brief                               Delete sim contact
955  * @par Usage:
956  * @code
957
958  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
959  char *data;
960  int item_id;
961
962  ret = sync_agent_delete_sim_contact_item(FW_CONTACT_SIM, item_id, data);
963  if (ret == SYNC_AGENT_DA_ERRORS) {
964         ...
965  } else {
966         ...
967  }
968
969  * @endcode
970  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
971  * @param[in]                   item_id                                                 item id of sim contact
972  * @param[in]                   content_type                                            data of sim contact
973  * @return                      operation result
974  * @retval                      current item count                                      success
975  * @retval                      error value                                             fail
976  */
977         sync_agent_da_return_e sync_agent_write_sim_contact_item(int content_type, int item_id, char *data);
978
979
980 /**
981  * @brief                               Delete sim contact
982  * @par Usage:
983  * @code
984
985  sync_agent_da_return_e ret = SYNC_AGENT_DA_ERRORS;
986  int item_id;
987
988  ret = sync_agent_delete_sim_contact_item(FW_CONTACT_SIM, item_id);
989  if (ret == SYNC_AGENT_DA_ERRORS) {
990         ...
991  } else {
992         ...
993  }
994
995  * @endcode
996  * @param[in]                   content_type                                            service type - service data connector plug-in's ID described in F/W config file
997  * @param[in]                   item_id                                                 item id of sim contact
998  * @return                      operation result
999  * @retval                      current item count                                      success
1000  * @retval                      error value                                             fail
1001  */
1002         sync_agent_da_return_e sync_agent_delete_sim_contact_item(int content_type, int item_id);
1003
1004 /**
1005  *      @}
1006  */
1007
1008 #ifdef __cplusplus
1009 }
1010 #endif
1011 #endif                          /* INTERFACE_SERVICE_ITEM_H_ */