3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
26 #include "utility/sync_util.h"
28 #include "plugin/data_connector_interface.h"
30 #define BACKUP_PATH "/opt/media/Downloads/Kies/.BnR/CallLog.bk"
33 #define EXPORT_API __attribute__ ((visibility("default")))
36 #ifndef SYNC_AGENT_LOG
38 #define LOG_TAG "PLUGIN_DA_CALL_LOG"
41 #define CALLOG_SYNC_PERIODIC 60*60*24*8 /*8days */
43 /* call log Internal Struct */
57 int extra_data1; /* duration, message_id */
58 const char *extra_data2; /*short message */
59 int related_id; /* contact id */
62 static void _del_all_calllogs(void);
64 static sync_agent_da_return_e _convert_service_error_to_common_error(contacts_error_e err);
66 EXPORT_API sync_agent_da_return_e sync_agent_plugin_open_service(void)
70 sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
71 contacts_error_e err = contacts_connect2();
72 if (err != CONTACTS_ERROR_NONE) {
73 _DEBUG_ERROR("[da_calllog_plugIn] in calllog Fail!\n");
74 ret = _convert_service_error_to_common_error(err);
76 _DEBUG_INFO("[da_calllog_plugIn] in calllog Success!\n");
84 EXPORT_API sync_agent_da_return_e sync_agent_plugin_close_service(void)
88 sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
89 contacts_error_e err = contacts_disconnect2();
90 if (err != CONTACTS_ERROR_NONE) {
91 _DEBUG_ERROR("[da_calllog_plugIn] in calllog Fail!\n");
92 ret = _convert_service_error_to_common_error(err);
94 _DEBUG_INFO("[da_calllog_plugIn] in calllog Success!\n");
102 EXPORT_API int *sync_agent_plugin_get_account_id_list(int *count)
106 _DEBUG_INFO("[da_calllog_plugIn] calllog Start !!");
107 int *account_id_list = (int *)calloc(1, sizeof(int));
108 if (account_id_list == NULL) {
109 _DEBUG_ERROR("CALLOC failed !!!");
112 account_id_list[0] = -1;
115 _DEBUG_INFO("[da_calllog_plugIn] calllog End !!");
119 return account_id_list;
122 EXPORT_API sync_agent_da_return_e sync_agent_plugin_backup_service_items_to_file(int account_ID, char **file_path)
126 // sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
129 // CTSiter *iter = 0;
130 // CTSvalue *plog = 0; /*plog_list */
132 // file = fopen(BACKUP_PATH, "w");
133 // if (file == NULL) {
134 // _DEBUG_INFO("[da_call_log_plugIn] fopen fail\n");
135 // return SYNC_AGENT_DA_ERRORS;
138 // contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
139 // while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
140 // dc_plog_list_s plog_list;
142 // /* get call log */
143 // plog = contacts_svc_iter_get_info(iter);
147 // plog_list.number = contacts_svc_value_get_str(plog, CTS_LIST_PLOG_NUMBER_STR);
148 // plog_list.log_time = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TIME_INT);
149 // plog_list.log_type = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TYPE_INT);
150 // plog_list.extra_data1 = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_DURATION_INT);
151 // plog_list.extra_data2 = contacts_svc_value_get_str(plog, CTS_LIST_PLOG_SHORTMSG_STR);
152 // plog_list.related_id = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_RELATED_ID_INT);
154 // _DEBUG_INFO("plog_list.number : %s\n", plog_list.number);
155 // _DEBUG_INFO("plog_list.related_id : %d\n", plog_list.related_id);
156 // _DEBUG_INFO("plog_list.log_time : %d\n", plog_list.log_time);
157 // _DEBUG_INFO("plog_list.log_type : %d\n", plog_list.log_type);
158 // _DEBUG_INFO("plog_list.extra_data1 : %d\n", plog_list.extra_data1);
159 // _DEBUG_INFO("plog_list.extra_data2 : %s\n", plog_list.extra_data2);
161 // /* save call log : to file text */
162 // cur_size = fprintf(file, "%s %d %d %d %d %s ", plog_list.number, plog_list.related_id, plog_list.log_time, plog_list.log_type, plog_list.extra_data1, plog_list.extra_data2);
164 // if (cur_size == -1) {
165 // _DEBUG_INFO("[da_call_log_plugIn] fprintf fail\n");
166 // ret = SYNC_AGENT_DA_ERRORS;
171 // if (plog != NULL) {
172 // contacts_svc_value_free(plog);
179 // if (file != NULL) {
185 // if (plog != NULL) {
186 // contacts_svc_value_free(plog);
190 // if (iter != NULL) {
191 // contacts_svc_iter_remove(iter);
195 // *file_path = strdup(BACKUP_PATH);
197 sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
201 contacts_error_e err = CONTACTS_ERROR_NONE;
202 contacts_list_h list = NULL;
209 char *short_msg = NULL;
211 file = fopen(BACKUP_PATH, "w");
213 _DEBUG_ERROR("[da_call_log_plugIn] fopen fail\n");
214 return SYNC_AGENT_DA_ERRORS;
217 err = contacts_db_get_all_records(_contacts_phone_log._uri, 0, 0, &list);
218 if (err != CONTACTS_ERROR_NONE) {
219 _DEBUG_ERROR("[da_call_log_plugIn] contacts_db_get_all_records fail\n");
220 ret = _convert_service_error_to_common_error(err);
224 err = contacts_list_first(list);
225 while (err == CONTACTS_ERROR_NONE) {
226 contacts_record_h record = NULL;
229 err = contacts_list_get_current_record_p(list, &record);
230 if (err != CONTACTS_ERROR_NONE) {
231 _DEBUG_ERROR("[da_call_log_plugIn] contacts_list_get_current_record_p fail\n");
235 contacts_record_get_str_p(record, _contacts_phone_log.address, &number);
236 contacts_record_get_int(record, _contacts_phone_log.person_id, &related_id);
237 contacts_record_get_int(record, _contacts_phone_log.log_time, &log_time);
238 contacts_record_get_int(record, _contacts_phone_log.log_type, &log_type);
239 contacts_record_get_int(record, _contacts_phone_log.extra_data1, &duration);
240 contacts_record_get_str_p(record, _contacts_phone_log.extra_data2, &short_msg);
242 _DEBUG_INFO("plog_list.number : %s\n", number);
243 _DEBUG_INFO("plog_list.related_id : %d\n", related_id);
244 _DEBUG_INFO("plog_list.log_time : %d\n", log_time);
245 _DEBUG_INFO("plog_list.log_type : %d\n", log_type);
246 _DEBUG_INFO("plog_list.extra_data1 : %d\n", duration);
247 _DEBUG_INFO("plog_list.extra_data2 : %s\n", short_msg);
249 /* save call log : to file text */
250 cur_size = fprintf(file, "%s %d %d %d %d %s ", number, related_id, log_time, log_type, duration, short_msg);
251 if (cur_size == -1) {
252 _DEBUG_ERROR("[da_call_log_plugIn] fprintf fail\n");
253 ret = SYNC_AGENT_DA_ERRORS;
257 err = contacts_list_next(list);
267 contacts_list_destroy(list, true);
269 *file_path = strdup(BACKUP_PATH);
276 EXPORT_API sync_agent_da_return_e sync_agent_plugin_restore_service_items_from_file(int account_ID, const char *file_path)
280 retvm_if(file_path == NULL, SYNC_AGENT_DA_ERRORS, "file_path is NULL. FAIL !!!");
282 // sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
286 // CTSvalue *plog = 0; /* plog */
288 // /* open call log : from file text */
289 // file = fopen(BACKUP_PATH, "r");
290 // if (file == NULL) {
291 // _DEBUG_INFO("[da_call_log_plugIn] fopen fail\n");
292 // return SYNC_AGENT_DA_ERRORS;
295 // /* delete call log from contact service database */
296 // _del_all_calllogs();
299 // dc_plog_list_s plog_list;
300 // char temp_number[100] = { 0 };
301 // char temp_extra_data2[1024] = { 0 };
303 // /* read call log : from file text */
304 // cur_size = fscanf(file, "%100s %d %d %d %d %1024s ", temp_number, &(plog_list.related_id), &(plog_list.log_time), &(plog_list.log_type), &(plog_list.extra_data1), temp_extra_data2);
306 // if (cur_size == -1) {
307 // _DEBUG_INFO("[da_call_log_plugIn] fscanf fail\n");
308 // ret = SYNC_AGENT_DA_ERRORS;
312 // plog = contacts_svc_value_new(CTS_VALUE_PHONELOG);
313 // if (plog == NULL) {
314 // _DEBUG_INFO("[da_call_log_plugIn] memory allocation fail\n");
315 // ret = SYNC_AGENT_DA_ERRORS;
319 // /* add call log to contact service database */
320 // contacts_svc_value_set_str(plog, CTS_PLOG_VAL_NUMBER_STR, temp_number);
321 // contacts_svc_value_set_int(plog, CTS_PLOG_VAL_RELATED_ID_INT, plog_list.related_id);
322 // contacts_svc_value_set_int(plog, CTS_PLOG_VAL_LOG_TIME_INT, plog_list.log_time);
323 // contacts_svc_value_set_int(plog, CTS_PLOG_VAL_LOG_TYPE_INT, plog_list.log_type);
324 // contacts_svc_value_set_int(plog, CTS_PLOG_VAL_DURATION_INT, plog_list.extra_data1);
325 // contacts_svc_value_set_str(plog, CTS_PLOG_VAL_SHORTMSG_STR, temp_extra_data2);
327 // _DEBUG_INFO("plog_list.number : %s\n", temp_number);
328 // _DEBUG_INFO("plog_list.related_id : %d\n", plog_list.related_id);
329 // _DEBUG_INFO("plog_list.log_time : %d\n", plog_list.log_time);
330 // _DEBUG_INFO("plog_list.log_type : %d\n", plog_list.log_type);
331 // _DEBUG_INFO("plog_list.extra_data1 : %d\n", plog_list.extra_data1);
332 // _DEBUG_INFO("plog_list.extra_data2 : %s\n", temp_extra_data2);
334 // err = contacts_svc_insert_phonelog(plog);
335 // if (err < CTS_SUCCESS) {
336 // _DEBUG_INFO("[da_contact_plugIn] contacts_svc_insert_phonelog() Fail!\n");
337 // ret = SYNC_AGENT_DA_ERRORS;
340 // _DEBUG_INFO("[da_contact_plugIn] contacts_svc_insert_phonelog() Success!\n");
343 // if (plog != NULL) {
344 // contacts_svc_value_free(plog);
352 // if (file != NULL) {
358 // if (plog != NULL) {
359 // contacts_svc_value_free(plog);
363 sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
367 contacts_record_h record = NULL;
370 /* open call log : from file text */
371 file = fopen(BACKUP_PATH, "r");
373 _DEBUG_ERROR("[da_call_log_plugIn] fopen fail\n");
374 return SYNC_AGENT_DA_ERRORS;
377 /* delete call log from contact service database */
381 dc_plog_list_s plog_list;
382 char temp_number[100] = { 0 };
383 char temp_extra_data2[1024] = { 0 };
385 /* read call log : from file text */
386 cur_size = fscanf(file, "%100s %d %d %d %d %1024s ", temp_number, &(plog_list.related_id), &(plog_list.log_time), &(plog_list.log_type), &(plog_list.extra_data1), temp_extra_data2);
388 if (cur_size == -1) {
389 _DEBUG_ERROR("[da_call_log_plugIn] fscanf fail\n");
390 ret = SYNC_AGENT_DA_ERRORS;
394 err = contacts_record_create(_contacts_phone_log._uri, &record);
395 if (err != CONTACTS_ERROR_NONE) {
396 _DEBUG_ERROR("[da_call_log_plugIn] contacts_record_create Fail\n");
397 ret = _convert_service_error_to_common_error(err);
401 /* add call log to contact service database */
402 contacts_record_set_str(record, _contacts_phone_log.address, temp_number);
403 contacts_record_set_int(record, _contacts_phone_log.person_id, plog_list.related_id);
404 contacts_record_set_int(record, _contacts_phone_log.log_time, plog_list.log_time);
405 contacts_record_set_int(record, _contacts_phone_log.log_type, plog_list.log_type);
406 contacts_record_set_int(record, _contacts_phone_log.extra_data1, plog_list.extra_data1);
407 contacts_record_set_str(record, _contacts_phone_log.extra_data2, temp_extra_data2);
409 _DEBUG_INFO("plog_list.number : %s\n", temp_number);
410 _DEBUG_INFO("plog_list.related_id : %d\n", plog_list.related_id);
411 _DEBUG_INFO("plog_list.log_time : %d\n", plog_list.log_time);
412 _DEBUG_INFO("plog_list.log_type : %d\n", plog_list.log_type);
413 _DEBUG_INFO("plog_list.extra_data1 : %d\n", plog_list.extra_data1);
414 _DEBUG_INFO("plog_list.extra_data2 : %s\n", temp_extra_data2);
416 err = contacts_db_insert_record(record, &contact_id);
417 if (err != CONTACTS_ERROR_NONE) {
418 _DEBUG_ERROR("[da_contact_plugIn] contacts_db_insert_record() Fail!\n");
419 ret = _convert_service_error_to_common_error(err);
422 _DEBUG_INFO("[da_contact_plugIn] contacts_db_insert_record() Success!\n");
423 _DEBUG_INFO("[da_contact_plugIn] contact_id = %d", contact_id);
429 contacts_record_destroy(record, true);
441 EXPORT_API sync_agent_da_return_e sync_agent_plugin_get_item(int account_id, char *folder_id, char *item_id, void **data)
445 retvm_if(item_id == NULL, SYNC_AGENT_DA_ERR_INVALID_CONTENT, "item_id is NULL. FAIL !!!");
447 // sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
448 // cts_error err = 0;
449 // CTSvalue *item = 0;
452 // int colllog_id = atoi(item_id);
453 // _DEBUG_INFO("[da_call-log_plugIn] colllog_id : %d\n", colllog_id);
454 // err = contacts_svc_get_phonelog(colllog_id, &item);
455 // if (err < CTS_SUCCESS) {
456 // _DEBUG_INFO("[da_call-log_plugIn] contacts_svc_get_phonelog() Fail!\n");
457 // ret = _convert_service_error_to_common_error(err);
460 // _DEBUG_INFO("[da_call-log_plugIn] contacts_svc_get_phonelog() Success!\n");
461 // *data = (void *)item;
464 sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
466 contacts_record_h record = NULL;
469 int colllog_id = atoi(item_id);
470 _DEBUG_INFO("[da_call-log_plugIn] colllog_id : %d\n", colllog_id);
471 err = contacts_db_get_record(_contacts_phone_log._uri, colllog_id, &record);
472 if (err != CONTACTS_ERROR_NONE) {
473 _DEBUG_ERROR("[da_call-log_plugIn] contacts_db_get_record() Fail!\n");
474 ret = _convert_service_error_to_common_error(err);
477 _DEBUG_INFO("[da_call-log_plugIn] contacts_db_get_record() Success!\n");
478 *data = (void *)record;
486 static void _del_all_calllogs(void)
490 // CTSiter *iter = 0;
491 // CTSvalue *plog = 0; /*plog_list */
493 // contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
494 // while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
496 // /* get call log */
497 // plog = contacts_svc_iter_get_info(iter);
501 // int id = contacts_svc_value_get_int(plog, CTS_LIST_PLOG_ID_INT);
503 // /* delete call log */
504 // contacts_svc_delete_phonelog(CTS_PLOG_DEL_BY_ID, id);
505 // _DEBUG_TRACE("[da_call_log_plugIn] id : %d\n", id);
508 // if (plog != NULL) {
509 // contacts_svc_value_free(plog);
515 // if (iter != NULL) {
516 // contacts_svc_iter_remove(iter);
520 contacts_error_e err = CONTACTS_ERROR_NONE;
521 contacts_list_h list = NULL;
523 err = contacts_db_get_all_records(_contacts_phone_log._uri, 0, 0, &list);
524 if (err != CONTACTS_ERROR_NONE) {
525 _DEBUG_ERROR("[da_call_log_plugIn] contacts_db_get_all_records fail\n");
529 err = contacts_list_first(list);
530 while (err == CONTACTS_ERROR_NONE) {
531 contacts_record_h record = NULL;
534 err = contacts_list_get_current_record_p(list, &record);
535 if (err != CONTACTS_ERROR_NONE) {
536 _DEBUG_ERROR("[da_call_log_plugIn] contacts_db_get_all_records fail\n");
541 err = contacts_record_get_int(record, _contacts_phone_log.id, &id);
542 if (err != CONTACTS_ERROR_NONE) {
543 _DEBUG_ERROR("[da_call_log_plugIn] contacts_db_get_all_records fail\n");
547 _DEBUG_TRACE("[da_call_log_plugIn] id : %d\n", id);
549 /* delete call log */
550 contacts_db_delete_record(_contacts_phone_log._uri, id);
552 err = contacts_list_next(list);
556 contacts_list_destroy(list, true);
561 EXPORT_API sync_agent_plugin_item_node_s *sync_agent_plugin_get_changed_item_for_folder_add(int account_id, const char *folder_id, int changepoint, int *changeCount)
565 // _DEBUG_INFO("[da_call-log_plugIn] account_id : %d\n", account_id);
566 // _DEBUG_INFO("[da_call-log_plugIn] folder_id : %s\n", folder_id);
567 // _DEBUG_INFO("[da_call-log_plugIn] changepoint : %d\n", changepoint);
569 // sync_agent_plugin_item_node_s *root_ptr = 0;
570 // sync_agent_plugin_item_node_s *cursor_ptr = 0;
571 // int chagned_count = 0;
572 // int current_time = time(NULL);
574 // CTSiter *iter = NULL;
575 // CTSvalue *plog = NULL; /*plog_list */
577 // char *calllog_id_str = NULL;
579 // int result = contacts_svc_get_list(CTS_LIST_ALL_PLOG, &iter);
580 // _DEBUG_INFO("result = %d", result);
581 // while (CTS_SUCCESS == contacts_svc_iter_next(iter)) {
583 // /* get call log */
584 // plog = contacts_svc_iter_get_info(iter);
588 // /*check that item is within 7 days before since at the time */
589 // if (current_time - CALLOG_SYNC_PERIODIC <= contacts_svc_value_get_int(plog, CTS_LIST_PLOG_LOG_TIME_INT)) {
590 // calllog_id_str = g_strdup_printf("%d", contacts_svc_value_get_int(plog, CTS_LIST_PLOG_ID_INT));
591 // _DEBUG_INFO("calllog_id_str = %s", calllog_id_str);
593 // if (root_ptr == NULL) {
594 // root_ptr = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
595 // if( root_ptr == NULL ) {
596 // _DEBUG_ERROR("CALLOC failed !!!");
599 // root_ptr->item_id = calllog_id_str;
600 // root_ptr->next = 0;
601 // cursor_ptr = root_ptr;
603 // cursor_ptr->next = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
604 // if( cursor_ptr->next == NULL ) {
605 // _DEBUG_ERROR("CALLOC failed !!!");
608 // cursor_ptr->next->item_id = calllog_id_str;
609 // cursor_ptr->next->next = 0;
610 // cursor_ptr = cursor_ptr->next;
616 // if (plog != NULL) {
617 // contacts_svc_value_free(plog);
623 // if (iter != NULL) {
624 // contacts_svc_iter_remove(iter);
626 // _DEBUG_INFO("[da_contact_plugIn] contacts_svc_iter_remove !! \n");
629 // *changeCount = chagned_count;
631 _DEBUG_INFO("[da_call-log_plugIn] account_id : %d\n", account_id);
632 _DEBUG_INFO("[da_call-log_plugIn] folder_id : %s\n", folder_id);
633 _DEBUG_INFO("[da_call-log_plugIn] changepoint : %d\n", changepoint);
635 sync_agent_plugin_item_node_s *root_ptr = 0;
636 sync_agent_plugin_item_node_s *cursor_ptr = 0;
637 int chagned_count = 0;
638 int current_time = time(NULL);
640 char *calllog_id_str = NULL;
642 contacts_error_e err = CONTACTS_ERROR_NONE;
643 contacts_list_h list = NULL;
645 err = contacts_db_get_all_records(_contacts_phone_log._uri, 0, 0, &list);
646 if (err != CONTACTS_ERROR_NONE) {
647 _DEBUG_ERROR("[da_call_log_plugIn] contacts_db_get_all_records fail\n");
651 err = contacts_list_first(list);
652 while (err == CONTACTS_ERROR_NONE) {
654 contacts_record_h record = NULL;
657 err = contacts_list_get_current_record_p(list, &record);
658 if (err != CONTACTS_ERROR_NONE) {
659 _DEBUG_ERROR("[da_call_log_plugIn] contacts_db_get_all_records fail\n");
663 /*check that item is within 7 days before since at the time */
665 contacts_record_get_int(record, _contacts_phone_log.log_time, &log_time);
667 if (current_time - CALLOG_SYNC_PERIODIC <= log_time) {
669 contacts_record_get_int(record, _contacts_phone_log.id, &calllog_id);
671 calllog_id_str = g_strdup_printf("%d", calllog_id);
672 _DEBUG_INFO("calllog_id_str = %s", calllog_id_str);
674 if (root_ptr == NULL) {
675 root_ptr = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
676 if (root_ptr == NULL) {
677 _DEBUG_ERROR("CALLOC failed !!!");
680 root_ptr->item_id = calllog_id_str;
682 cursor_ptr = root_ptr;
684 cursor_ptr->next = (sync_agent_plugin_item_node_s *) calloc(1, sizeof(sync_agent_plugin_item_node_s));
685 if (cursor_ptr->next == NULL) {
686 _DEBUG_ERROR("CALLOC failed !!!");
689 cursor_ptr->next->item_id = calllog_id_str;
690 cursor_ptr->next->next = 0;
691 cursor_ptr = cursor_ptr->next;
697 err = contacts_list_next(list);
700 contacts_list_destroy(list, true);
702 *changeCount = chagned_count;
709 EXPORT_API sync_agent_plugin_item_node_s *sync_agent_plugin_get_changed_item_for_folder_update(int account_id, const char *folder_id, int change_point, int *change_count)
713 _DEBUG_INFO("[da_call-log_plugIn] account_id : %d\n", account_id);
714 _DEBUG_INFO("[da_call-log_plugIn] folder_id : %s\n", folder_id);
715 _DEBUG_INFO("[da_call-log_plugIn] changepoint : %d\n", change_point);
724 EXPORT_API sync_agent_plugin_item_node_s *sync_agent_plugin_get_changed_item_for_folder_delete(int account_id, const char *folder_id, int change_point, int *change_count)
728 _DEBUG_INFO("\n[da_contact_plugIn] account_id : %d\n", account_id);
729 _DEBUG_INFO("[da_contact_plugIn] folder_id : %s\n", folder_id);
730 _DEBUG_INFO("[da_contact_plugIn] changepoint : %d\n", change_point);
739 static sync_agent_da_return_e _convert_service_error_to_common_error(contacts_error_e err)
743 sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS;
744 _DEBUG_TRACE("[da_contact_plugIn] Error Code : %d\n", err);
747 case CONTACTS_ERROR_NONE:
748 ret = SYNC_AGENT_DA_SUCCESS;
750 case CONTACTS_ERROR_OUT_OF_MEMORY:
751 ret = SYNC_AGENT_DA_ERR_MEMORY_FULL;
753 case CONTACTS_ERROR_INVALID_PARAMETER:
754 ret = SYNC_AGENT_DA_ERR_INVALID_PARAMETER;
756 case CONTACTS_ERROR_NO_DATA:
757 ret = SYNC_AGENT_DA_ERR_NO_DATA;
759 case CONTACTS_ERROR_DB:
760 ret = SYNC_AGENT_DA_ERR_SERVICE_DB;
762 case CONTACTS_ERROR_IPC:
763 ret = SYNC_AGENT_DA_ERR_SERVICE_IPC;
766 ret = SYNC_AGENT_DA_ERRORS;
775 EXPORT_API int sync_agent_plugin_get_last_change_point(void)
779 // contacts_svc_begin_trans();
780 // int contact_version = contacts_svc_end_trans(1);
783 contacts_db_get_current_version(&contact_version);
787 return contact_version;