From: Jinkun Jang Date: Fri, 15 Mar 2013 16:18:13 +0000 (+0900) Subject: merge with master X-Git-Tag: 2.1b_release~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2928ee51d097094087c5a6445bea90840f6f1db6;p=framework%2Fsystem%2Foma-ds-agent.git merge with master --- diff --git a/AUTHORS b/AUTHORS old mode 100755 new mode 100644 diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 old mode 100755 new mode 100644 diff --git a/NOTICE b/NOTICE old mode 100755 new mode 100644 diff --git a/debian/changelog b/debian/changelog old mode 100644 new mode 100755 index d9f499e..de903e0 --- a/debian/changelog +++ b/debian/changelog @@ -1,47 +1,533 @@ -oma-ds-agent (0.1.6) unstable; urgency=low +oma-ds-agent (0.1.62) unstable; urgency=low - * 1. license file update. + * 1. when profile info gets, return value changed. * Git: framework/system/oma-ds-agent - * Tag: oma-ds-agent_0.1.6 + * Tag: oma-ds-agent_0.1.62 - -- Juhaki Park Mon, 21 Jan 2013 22:09:10 +0900 + -- sanghyuk.ko Fri, 08 Mar 2013 09:43:14 +0900 -oma-ds-agent (0.1.5) unstable; urgency=low +oma-ds-agent (0.1.61) unstable; urgency=low - * 1. Revised for version release + * 1. sync_interval enum type added + * 2. Fixed for prevent. (5EA) * Git: framework/system/oma-ds-agent - * Tag: oma-ds-agent_0.1.5 + * Tag: oma-ds-agent_0.1.61 - -- Juhaki Park Thu, 10 Jan 2013 10:06:10 +0900 + -- sanghyukko Thu, 28 Feb 2013 17:21:15 +0900 -oma-ds-agent (0.1.4) unstable; urgency=low +oma-ds-agent (0.1.60) unstable; urgency=low - * 1. Revised for version release + * 1. profile_dir_name create automatically. + * 2. stop sync process type added * Git: framework/system/oma-ds-agent - * Tag: oma-ds-agent_0.1.4 + * Tag: oma-ds-agent_0.1.60 - -- WooJin Yun Wed, 09 Jan 2013 19:42:10 +0900 + -- sanghyukko Tue, 26 Feb 2013 17:25:19 +0900 -oma-ds-agent (0.1.3) unstable; urgency=low +oma-ds-agent (0.1.59) unstable; urgency=low - * 1. Fixes for Prevent defects + * 1. tizen_2.0 code merge + * 2. Private code merge * Git: framework/system/oma-ds-agent - * Tag: oma-ds-agent_0.1.3 + * Tag: oma-ds-agent_0.1.59 - -- sanghyuk.ko Wed, 09 Jan 2013 17:31:34 +0900 + -- sanghyukko Thu, 21 Feb 2013 14:20:47 +0900 -oma-ds-agent (0.1.2) unstable; urgency=low +oma-ds-agent (0.1.58) unstable; urgency=low - * 1. Internal: build error & dependency patch - * Git: framework/system/oma-ds-agent - * Tag: oma-ds-agent_0.1.2 + * 1. FMM callog feature added. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.58 - -- WooJin Yun Fri, 28 Dec 2012 22:47:52 +0900 + -- sanghyukko Thu, 07 Feb 2013 18:22:25 +0900 -oma-ds-agent (0.1.1) unstable; urgency=low +oma-ds-agent (0.1.57) unstable; urgency=low - * Initial Update - * Git: framework/system/oma-ds-agent - * Tag: oma-ds-agent_0.1.1 + * 1. Smack rule added. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.57 + + -- sanghyukko Tue, 05 Feb 2013 19:59:27 +0900 + +oma-ds-agent (0.1.56) unstable; urgency=low + + * 1. Fixes for Prevent defects + * 2. Applied smack rule about db + * 3. DB file creation is moved from %post to %install + * 4. Apply smack label to booting script + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.56 + + -- sanghyukko Thu, 31 Jan 2013 18:55:03 +0900 + +oma-ds-agent (0.1.55) unstable; urgency=low + + * 1. Fixes for Prevent defects + * 2. sync_agent_get_event_data_param_int/str applied. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.55 + + -- sanghyukko Fri, 25 Jan 2013 15:09:58 +0900 + +oma-ds-agent (0.1.54) unstable; urgency=low + + * 1. xcalllog patch (contacts_db_get_record -> contacts_db_get_records_with_query) + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.54 + + -- jimo.park Fri, 18 Jan 2013 18:35:13 +0900 + +oma-ds-agent (0.1.53) unstable; urgency=low + + * 1. Indent applied. + * 2. Copyright modified. + * 3. Apply sync-agent-framework changes. + * 4. log format unified. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.53 + + -- sanghyuk.ko Thu, 27 Dec 2012 19:54:13 +0900 + +oma-ds-agent (0.1.52) unstable; urgency=low + + * 1. Apply tizen managed API + * 2. License category changed + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.52 + + -- sanghyuk.ko Thu, 20 Dec 2012 22:14:57 +0900 + +oma-ds-agent (0.1.51) unstable; urgency=low + + * 1. Fixed for prevent defects. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.51 + + -- sanghyuk.ko Thu, 13 Dec 2012 16:10:05 +0900 + +oma-ds-agent (0.1.50) unstable; urgency=low + + * 1. Apply tizen managed API + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.50 + + -- juhaki.park Fri, 07 Dec 2012 22:23:25 +0900 + +oma-ds-agent (0.1.49) unstable; urgency=low + + * 1. Fixed for prevent defect. + * 2. Applied ipc refactoring. + * 3. API name changed. (sync_agent_query_delete_service_item -> sync_agent_query_delete_service_items) + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.49 + + -- sanghyuk.ko Thu, 06 Dec 2012 16:04:25 +0900 + +oma-ds-agent (0.1.48) unstable; urgency=low + + * 1. Fixed for prevent defect + * 2. Modify contact record merge function + * 3. change debug_msg file path + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.48 + + -- sanghyuk.ko Thu, 29 Nov 2012 21:14:00 +0900 + +oma-ds-agent (0.1.47) unstable; urgency=low + + * 1. Fixed for prevent defect. + * 2. Smack option added. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.47 + + -- sanghyuk.ko Thu, 22 Nov 2012 19:52:04 +0900 + +oma-ds-agent (0.1.46) unstable; urgency=low + + * Apply contacts-service2 api + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.46 + + -- sanghyuk.ko Fri, 16 Nov 2012 14:39:57 +0900 + +oma-ds-agent (0.1.45) unstable; urgency=low + + * 1. calendar-service2 api + * 2. calendar managed api + * 3. oma-ds-agent-enabled path update. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.45 + + -- Juhaki Park Thu, 08 Nov 2012 20:24:32 +0900 + +oma-ds-agent (0.1.44) unstable; urgency=low + + * 1. Write wrong sync result patch. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.44 + + -- Juhaki Park Thu, 01 Nov 2012 17:54:32 +0900 + +oma-ds-agent (0.1.43) unstable; urgency=low + + * 1. log patch for build. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.43 + + -- Juhaki Park Thu, 25 Oct 2012 19:38:32 +0900 + +oma-ds-agent (0.1.42) unstable; urgency=low + + * 1. dbus auto activation + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.42 + + -- Juhaki Park Tue, 23 Oct 2012 18:30:32 +0900 + +oma-ds-agent (0.1.41) unstable; urgency=low + + * 1. dbus auto activation + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.41 + + -- Juhaki Park Tue, 23 Oct 2012 17:50:32 +0900 + +oma-ds-agent (0.1.40) unstable; urgency=low + + * 1. noti send fail fixed. + * 2. Implements Reset API. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.40 + + -- Juhaki Park Thu, 18 Oct 2012 18:09:32 +0900 + +oma-ds-agent (0.1.39) unstable; urgency=low + + * 1. Remove warning + * 2. Logging macro + * 3. Unifying item-manpulating APIs + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.39 + + -- Juhaki Park Fri, 12 Oct 2012 16:09:32 +0900 + +oma-ds-agent (0.1.38) unstable; urgency=low + + * 1. Fix Build error + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.38 + + -- Sunbong Ha Thu, 27 Sep 2012 18:19:32 +0900 + +oma-ds-agent (0.1.37) unstable; urgency=low + + * 1. API refactory. + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.37 + + -- Juhaki Park Thu, 27 Sep 2012 16:50:39 +0900 + +oma-ds-agent (0.1.36) unstable; urgency=low + + * 1. Bug fix in manifest file + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.36 + + -- WooJin Yun Tue, 25 Sep 2012 13:37:39 +0900 + +oma-ds-agent (0.1.35) unstable; urgency=low + + * 1. SMACK applied + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.35 + + -- WooJin Yun Mon, 24 Sep 2012 11:23:26 +0900 + +oma-ds-agent (0.1.34) unstable; urgency=low + + * 1. SMACK applied + * 2. preun , postun patch about spec file + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.34 + + -- Juhaki Park Fri, 21 Sep 2012 10:55:20 +0900 + +oma-ds-agent (0.1.33) unstable; urgency=low + + * 1. Apply changes due to packa name change : sync-agent-framework -> sync-agent + * 2. Memory leak redemption + * 3. g_main_loop_run( ) placed in main thread + * 4. Plugins moved to agent daemon + * 5. Add pkg build requires in spec file + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.33 + + -- WooJin Yun Thu, 06 Sep 2012 21:17:20 +0900 + +oma-ds-agent (0.1.32) unstable; urgency=low + + * 1. Apply Tizen Managed API changes + * 2. Change header file include style + * 3. Add null check before access session struct + * 4. Apply Tizen Managed API changes : Missing changes in external + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.32 + + -- WooJin Yun Fri, 31 Aug 2012 12:38:34 +0900 + +oma-ds-agent (0.1.31) unstable; urgency=low + + * 1. Remove module name from external header file name + * 2. package name is changed (oma-ds-service -> oma-ds-agent) + * 3. Modify config xml file for plugin + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.31 + + -- WooJin Yun Thu, 23 Aug 2012 14:37:44 +0900 + +oma-ds-agent (0.1.30) unstable; urgency=low + + * 1. External header renaming + * 2. plugin separation : framework module generic + * 3. remove include/agent-framework + * 4. Fix libxml2 API multi-thread issue + * Git: magnolia/framework/system/oma-ds-agent + * Tag: oma-ds-agent_0.1.30 + + -- WooJin Yun Fri, 17 Aug 2012 12:25:00 +0900 + +oma-ds-service (0.1.29) unstable; urgency=low + + * pkg upload. Everdroid sever issue applied. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.29 + + -- sanghyuk ko Thu, 09 Aug 2012 20:31:49 +0900 + +oma-ds-service (0.1.28) unstable; urgency=low + + * Directory restructuring applied + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.28 + + -- WooJin Yun Tue, 07 Aug 2012 20:51:07 +0900 + +oma-ds-service (0.1.27) unstable; urgency=low + + * local test done. Synctype changed by server. JIRA issue fix - S1-4022. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.27 + + -- Juhaki Park Tue, 24 Jul 2012 15:35:51 +0900 + +oma-ds-service (0.1.26) unstable; urgency=low + + * local test done. pkg-upload. Id provider up , adding maintainer , null check + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.26 + + -- Juhaki Park Wed, 18 Jul 2012 17:05:51 +0900 + +oma-ds-service (0.1.25) unstable; urgency=low + + * pkg upload. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.25 + + -- Juhaki Park Tue, 10 Jul 2012 10:27:51 +0900 + +oma-ds-service (0.1.24) unstable; urgency=low + + * filename update. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.24 + + -- Juhaki Park Wed, 04 Jul 2012 15:27:51 +0900 + +oma-ds-service (0.1.23) unstable; urgency=low + + * fota directory changing. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.23 + + -- Juhaki Park Fri, 15 Jun 2012 14:47:51 +0900 + +oma-ds-service (0.1.22) unstable; urgency=low + + * pkg upload. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.22 + + -- Sunbong Ha Tue, 12 Jun 2012 11:47:51 +0900 + +oma-ds-service (0.1.21) unstable; urgency=low + + * vconf key update - pkg upload. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.21 + + -- Juhaki Park Thu, 24 May 2012 18:31:14 +0900 + +oma-ds-service (0.1.20) unstable; urgency=low + + * pkg upload. + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.20 + + -- Juhaki Park Mon, 21 May 2012 18:31:14 +0900 + +oma-ds-service (0.1.19) unstable; urgency=low + + * 1. bug fixed double free + * 2. modified boiler plate + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.19 + + -- Junhyuk Lee Wed, 09 May 2012 13:41:14 +0900 + +oma-ds-service (0.1.18) unstable; urgency=low + + * 1. implement resume logic ( two way sync ) + * 2. add cancel logic current sync in call log sync + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.18 + + -- Junhyuk Lee Thu, 26 Apr 2012 16:08:03 +0900 + +oma-ds-service (0.1.17) unstable; urgency=low + + * 1. Integrate calllog sync flow + * 2. Change interface for static function in ServiceAdapter + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.17 + + -- Junhyuk Lee Tue, 17 Apr 2012 21:01:55 +0900 + +oma-ds-service (0.1.16) unstable; urgency=low + + * package upload for sync-agent framework upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.16 + + -- Junhyuk Lee Mon, 09 Apr 2012 15:36:07 +0900 + +oma-ds-service (0.1.15) unstable; urgency=low + + * package upload for sync-agent framework upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.15 + + -- Junhyuk Lee Mon, 09 Apr 2012 15:00:04 +0900 + +oma-ds-service (0.1.14) unstable; urgency=low + + * package upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.14 + + -- Joohark Park Tue, 03 Apr 2012 14:27:40 +0900 + +oma-ds-service (0.1.13) unstable; urgency=low + + * package upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.13 + + -- Juhak Park Tue, 03 Apr 2012 12:27:40 +0900 + +oma-ds-service (0.1.12) unstable; urgency=low + + * oma-ds-service engine bug fixed & package upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.12 + + -- Junhyuk Lee Thu, 29 Mar 2012 16:27:40 +0900 + +oma-ds-service (0.1.11) unstable; urgency=low + + * bug fixed & pkg upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.11 + + + -- Junhyuk Lee Thu, 22 Mar 2012 20:51:11 +0900 + +oma-ds-service (0.1.10) unstable; urgency=low + + * bug fixed & pkg upload + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.10 + + -- Junhyuk Lee Wed, 21 Mar 2012 16:35:21 +0900 + +oma-ds-service (0.1.9) unstable; urgency=low + + * pkg upload for sync-agent-fw pkg + * Git: slp/pkgs/o/oma-ds-service + * Tag: oma-ds-service_0.1.9 + + -- Junhyuk Lee Thu, 15 Mar 2012 17:06:33 +0900 + +oma-ds-service (0.1.8) unstable; urgency=low + + * pkg upload for sync-agent-fw pkg + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.8 + + -- Junhyuk Lee Thu, 08 Mar 2012 11:31:30 +0900 + +oma-ds-service (0.1.7) unstable; urgency=low + + * pkg upload for sync-agent-fw pkg + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.7 + + -- Junhyuk Lee Wed, 29 Feb 2012 14:08:51 +0900 + +oma-ds-service (0.1.6) unstable; urgency=low + + * pkg upload & err msg string fixed + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.6 + + -- leejunhyuk Mon, 27 Feb 2012 18:15:29 +0900 + +oma-ds-service (0.1.5) unstable; urgency=low + + * pkg update for version up + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.5 + + -- leejunhyuk Tue, 21 Feb 2012 16:27:17 +0900 + +oma-ds-service (0.1.4) unstable; urgency=low + + * pkg update for version up + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.4 + + -- leejunhyuk Thu, 09 Feb 2012 16:38:41 +0900 + +oma-ds-service (0.1.3) unstable; urgency=low + + * pkg update for sync-agent fw update + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.3 + + -- leejunhyuk Thu, 09 Feb 2012 16:15:49 +0900 + +oma-ds-service (0.1.2) unstable; urgency=low + + * pkg version up + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.2 + + -- leejunhyuk Thu, 02 Feb 2012 10:46:21 +0900 + +oma-ds-service (0.1.1) unstable; urgency=low + + * Initial release + * Git: slp/apps/o/oma-ds-service + * Tag: oma-ds-service_0.1.1 - -- WooJin Yun Wed, 01 Feb 2012 10:30:16 +0900 + -- leejunhyuk Wed, 01 Feb 2012 10:30:16 +0900 diff --git a/include/common/common_define_internal.h b/include/common/common_define_internal.h index c3078de..4c1ed97 100755 --- a/include/common/common_define_internal.h +++ b/include/common/common_define_internal.h @@ -114,6 +114,15 @@ #define DEFINE_DIVE_SERVER_ID "syn.samsungdive.com" #define DEFINE_DIVE_DEFAULT_NEXT_NONCE "pcwds" +#define DEFINE_SYNC_INTERVAL_5_MINUTES_STR "5 minutes" +#define DEFINE_SYNC_INTERVAL_15_MINUTES_STR "15 minutes" +#define DEFINE_SYNC_INTERVAL_1_HOUR_STR "1 hour" +#define DEFINE_SYNC_INTERVAL_4_HOURS_STR "4 hours" +#define DEFINE_SYNC_INTERVAL_12_HOURS_STR "12 hours" +#define DEFINE_SYNC_INTERVAL_1_DAY_STR "1 day" +#define DEFINE_SYNC_INTERVAL_1_WEEK_STR "1 week" +#define DEFINE_SYNC_INTERVAL_1_MONTH_STR "1 month" + typedef enum { SYNC_SESSION_NOT_SYNCED_YET = -1, SYNC_SESSION_FAILED = 0, @@ -160,6 +169,40 @@ typedef enum { } service_type_e; typedef enum { + MODE_MANUAL = 0, /*Manual*/ + MODE_PERIODIC = 1, /*Periodic*/ + MODE_PUSH = 2, /*Push (SAN)*/ + MODE_AUTOCONFIG = 3 /*Autoconfig*/ +} sync_mode_e; + +typedef enum { + SYNC_TYPE_FULL_SYNC = 0, /**< Full (Slow sync) */ + SYNC_TYPE_UPDATE_BOTH = 1, /**< Update both */ + SYNC_TYPE_UPDATE_TO_SERVER = 2, /**< Update to server */ + SYNC_TYPE_UPDATE_TO_PHONE = 3, /**< Update to phone */ + SYNC_TYPE_REFRESH_FROM_SERVER = 4, /**< Refresh from server */ + SYNC_TYPE_REFRESH_FROM_PHONE = 5 /**< Refresh from phone */ +}sync_type_e; + +typedef enum { + SYNC_INTERVAL_5_MINUTES = 0, /**< 5 minutes */ + SYNC_INTERVAL_15_MINUTES = 1, /**< 15 minutes */ + SYNC_INTERVAL_1_HOUR = 2, /**< 1 hour */ + SYNC_INTERVAL_4_HOURS = 3, /**< 4 hours */ + SYNC_INTERVAL_12_HOURS = 4, /**< 12 hours */ + SYNC_INTERVAL_1_DAY = 5, /**< 1 day */ + SYNC_INTERVAL_1_WEEK = 6, /**< 1 week */ + SYNC_INTERVAL_1_MONTH = 7 /**< 1 month */ +} sync_interval_e; + +typedef enum { + SRC_URI_CONTACT = 0, /**< Contacts */ + SRC_URI_CALENDAR = 1, /**< Calendar */ + SRC_URI_MEMO = 2, /**< Memo */ + SRC_URI_CALLLOG = 3 /**< Calllog */ +} src_uri_e; + +typedef enum { COMMON_INIT = 0, COMMON_OK = 100, COMMON_MISCONFIGURATION = 200, @@ -287,7 +330,7 @@ typedef struct { typedef struct { service_type_e service_type; int enabled; - char *src_uri; + src_uri_e src_uri; char *tgt_uri; char *id; char *password; diff --git a/include/service-engine/se_account.h b/include/service-engine/se_account.h index fc6563e..bae30a2 100755 --- a/include/service-engine/se_account.h +++ b/include/service-engine/se_account.h @@ -42,9 +42,9 @@ * @param[in] string type, server ip * @param[in] string type, id * @param[in] string type, password - * @param[in] string type, sync mode - * @param[in] string type, sync type - * @param[in] string type, interval(for periodic) + * @param[in] int type, sync mode + * @param[in] int type, sync type + * @param[in] int type, interval(for periodic) * @param[in] GList type, list of sync_service_s structure * @param[out] int type, account id * @@ -62,7 +62,7 @@ * @code * @endcode */ -bool add_profile(char *profile_dir_name, char *profile_name, char *addr, char *id, char *password, char *sync_mode, char *sync_type, char *interval, GList * categories, int *account_id); +bool add_profile(char *profile_name, char *addr, char *id, char *password, int sync_mode, int sync_type, int interval, GList * categories, int *account_id); /** * @par Description: API to add profile from csc @@ -163,9 +163,9 @@ bool add_profile_dive(int *account_id); * @param[in] string type, server ip * @param[in] string type, id * @param[in] string type, password - * @param[in] string type, sync mode - * @param[in] string type, sync type - * @param[in] string type, interval(for periodic) + * @param[in] int type, sync mode + * @param[in] int type, sync type + * @param[in] int type, interval(for periodic) * @param[in] GList type, list of sync_service_s structure * * @return true on success @@ -182,7 +182,7 @@ bool add_profile_dive(int *account_id); * @code * @endcode */ -bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char *password, char *sync_mode, char *sync_type, char *interval, GList * categories); +bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char *password, int sync_mode, int sync_type, int interval, GList * categories); /** * @par Description: API to delete profile API diff --git a/include/service-engine/se_common.h b/include/service-engine/se_common.h index 108acef..7631ff8 100755 --- a/include/service-engine/se_common.h +++ b/include/service-engine/se_common.h @@ -29,6 +29,7 @@ #define DEFINE_SYNC_CONNECTING "CONNECTING" #define DEFINE_SYNC_AUTHENTICATED "AUTHENTICATED" #define DEFINE_SYNC_DONE "DONE" +#define DEFINE_SYNC_CANCEL "CANCEL" #define DEFINE_SYNC_ERROR "ERROR" #define DEFINE_ERROR_NONE "ERROR_NONE" @@ -70,7 +71,8 @@ typedef enum { PROGRESS_CONNECTING = 2, PROGRESS_AUTHENTICATED = 3, PROGRESS_DONE = 4, - PROGRESS_ERROR = 5 + PROGRESS_CANCEL = 5, + PROGRESS_ERROR = 6 } sync_progress_e; typedef enum { diff --git a/include/service-engine/se_notification.h b/include/service-engine/se_notification.h index 4789ba5..c0e6a14 100755 --- a/include/service-engine/se_notification.h +++ b/include/service-engine/se_notification.h @@ -36,6 +36,7 @@ * @par Method of function operation: * @par Important notes: * @param[in] string type, profile dir name(identify profile in UI) + * @param[in] int type, server sync type * @param[in] string type, progress(DEFINE_SYNC_PROGRESS_NONE, * DEFINE_SYNC_INIT, DEFINE_SYNC_CONNECTING, DEFINE_SYNC_AUTHENTICATED, * DEFINE_SYNC_DONE, DEFINE_SYNC_ERROR) @@ -58,7 +59,7 @@ * @code * @endcode */ -se_error_type_e send_noti_session_process(char *profile, char *progress, char *error, char *sync_type); +se_error_type_e send_noti_session_process(char *profile, int sync_type, char *progress, char *error); /** * @par Description: API to notify process update to UI @@ -69,7 +70,7 @@ se_error_type_e send_noti_session_process(char *profile, char *progress, char *e * @par Method of function operation: * @par Important notes: * @param[in] string type, profile dir name(identify profile in UI) - * @param[in] string type, server sync type + * @param[in] int type, server sync type * @param[in] string type, datastore name * @param[in] string type, progressStatus(DEFINE_PROGRESS_NONE, DEFINE_PROGRESS_SUCCESS, DEFINE_FAILED_DB, * DEFINE_FAILED_DB_FORBIDDEN, DEFINE_FAILED_DB_ITEM, DEFINE_FAILED_DB_CONFIG, DEFINE_FAILED_DB_DEVICEFULL) @@ -94,6 +95,6 @@ se_error_type_e send_noti_session_process(char *profile, char *progress, char *e * @code * @endcode */ -se_error_type_e send_noti_process_update(char *profile_dir_name, char *sync_type, char *uri, char *progress_status, char *operation_type, int is_from_server, int total_per_operation, int synced_per_operation, int total_per_db, int synced_per_db); +se_error_type_e send_noti_process_update(char *profile_dir_name, int sync_type, int uri, char *progress_status, char *operation_type, int is_from_server, int total_per_operation, int synced_per_operation, int total_per_db, int synced_per_db); #endif /* SE_NOTIFICATION_H_ */ diff --git a/include/service-engine/se_storage.h b/include/service-engine/se_storage.h index ecf45d6..5b29611 100755 --- a/include/service-engine/se_storage.h +++ b/include/service-engine/se_storage.h @@ -131,9 +131,9 @@ se_error_type_e write_sync_resource_info(int account_id, int content_type, int l * @param[out] string type, server ip * @param[out] string type, id * @param[out] string type, password - * @param[out] string type, sync mode - * @param[out] string type, sync type - * @param[out] string type, interval + * @param[out] int type, sync mode + * @param[out] int type, sync type + * @param[out] int type, interval * @param[out] int type, last_session_status * @param[out] int type, last_session_time * @@ -152,7 +152,7 @@ se_error_type_e write_sync_resource_info(int account_id, int content_type, int l * @code * @endcode */ -bool get_profile_data(int account_id, char **profile_name, char **addr, char **id, char **password, char **sync_mode, char **sync_type, char **interval, int *last_session_status, int *last_session_time); +bool get_profile_data(int account_id, char **profile_name, char **addr, char **id, char **password, int *sync_mode, int *sync_type, int *interval, int *last_session_status, int *last_session_time); /** * @par Description: API to get profile datastore information(enable, source uri, target uri, id, password) from config_tbl @@ -166,7 +166,7 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i * @param[in] int type, account id * @param[in] int type, content type(TYPE_CONTACT, TYPE_CALENDAR, TYPE_MEMO) * @param[out] string type, enabled - * @param[out] string type, source uri + * @param[out] int type, source uri * @param[out] string type, target uri * @param[out] string type, id * @param[out] string type, password @@ -185,7 +185,7 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i * @code * @endcode */ -bool get_profile_sync_category(int account_id, int content_type, int *enabled, char **src_uri, char **tgt_uri, char **id, char **password); +bool get_profile_sync_category(int account_id, int content_type, int *enabled, int *src_uri, char **tgt_uri, char **id, char **password); /** * @par Description: API to get profile sync statistics for each content type from config_tbl diff --git a/packaging/oma-ds-agent.spec b/packaging/oma-ds-agent.spec index 1782263..f477726 100755 --- a/packaging/oma-ds-agent.spec +++ b/packaging/oma-ds-agent.spec @@ -1,6 +1,6 @@ Name: oma-ds-agent Summary: oma-ds-agent daemon for data sync -Version: 0.1.6 +Version: 0.1.62 Release: 1 Group: TO_BE/FILLED_IN License: Apache License, Version 2.0 @@ -12,7 +12,6 @@ BuildRequires: pkgconfig(libsoup-2.4) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(sync-agent) BuildRequires: pkgconfig(vconf) -BuildRequires: pkgconfig(libwbxml2) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(check) BuildRequires: pkgconfig(memo) @@ -21,6 +20,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(aul) BuildRequires: expat-devel BuildRequires: cmake +Requires: sys-assert %description @@ -45,6 +45,14 @@ make %{?jobs:-j%jobs} %install rm -rf %{buildroot} + +if [ ! -d %{buildroot}/opt/dbspace ] +then + mkdir -p %{buildroot}/opt/dbspace +fi + +sqlite3 %{buildroot}/opt/dbspace/.omasyncagent.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null + %make_install @@ -66,18 +74,14 @@ then mkdir /etc/rc.d/rc5.d fi +if [ ! -f /etc/rc.d/rc3.d/S91oma-ds-agent ] +then ln -s /etc/init.d/oma-ds /etc/rc.d/rc3.d/S91oma-ds-agent -ln -s /etc/init.d/oma-ds /etc/rc.d/rc5.d/S91oma-ds-agent - -sqlite3 /opt/dbspace/.omasyncagent.db "PRAGMA journal_mode = PERSIST; create table a(a); drop table a;" > /dev/null - -chmod 600 /opt/dbspace/.omasyncagent.db -chmod 600 /opt/dbspace/.omasyncagent.db-journal +fi -if [ -f /usr/lib/rpm-plugins/msm.so ] +if [ ! -f /etc/rc.d/rc5.d/S91oma-ds-agent ] then - chsmack -a oma-ds-agent::db /opt/dbspace/.omasyncagent.db - chsmack -a oma-ds-agent::db /opt/dbspace/.omasyncagent.db-journal + ln -s /etc/init.d/oma-ds /etc/rc.d/rc5.d/S91oma-ds-agent fi #/etc/init.d/oma-ds start @@ -101,6 +105,9 @@ rm -rf /usr/share/oma-ds-cfg %files +%attr(600,root,root) /opt/dbspace/.omasyncagent.db +%attr(600,root,root) /opt/dbspace/.omasyncagent.db-journal + %manifest oma-ds-agent.manifest %defattr(-,root,root,-) /usr/share/dbus-1/services/* diff --git a/src/agent/CMakeLists.txt b/src/agent/CMakeLists.txt index 64fb834..77638be 100755 --- a/src/agent/CMakeLists.txt +++ b/src/agent/CMakeLists.txt @@ -21,7 +21,6 @@ pkg_check_modules(LPKGS REQUIRED sqlite3 sync-agent vconf - libwbxml2 dlog aul dbus-glib-1 diff --git a/src/agent/common/common_define.c b/src/agent/common/common_define.c index 3954bb4..8453245 100755 --- a/src/agent/common/common_define.c +++ b/src/agent/common/common_define.c @@ -734,9 +734,6 @@ void free_sync_service(sync_service_s * category) retm_if(category == NULL, "category is NULL"); - if (category->src_uri != NULL) - free(category->src_uri); - if (category->tgt_uri != NULL) free(category->tgt_uri); diff --git a/src/agent/common/common_util.c b/src/agent/common/common_util.c index 7c1bb70..48231af 100755 --- a/src/agent/common/common_util.c +++ b/src/agent/common/common_util.c @@ -122,10 +122,13 @@ bool get_config(int account_id, char *key, char **value) sync_agent_da_config_s *config = NULL; *value = NULL; + _DEBUG_INFO("get_config - account_id[%d], key[%s]",account_id,key); result = sync_agent_create_config(&config); - if (result != SYNC_AGENT_DA_SUCCESS) + if (result != SYNC_AGENT_DA_SUCCESS) { + _DEBUG_INFO("sync_agent_create_config() failed!!"); return false; + } result = sync_agent_get_config(account_id, key, &config); if (result == SYNC_AGENT_DA_SUCCESS) { @@ -152,6 +155,8 @@ bool get_config(int account_id, char *key, char **value) break; } } + } else { + _DEBUG_INFO("sync_agent_get_config() failed!!"); } } if (success == false) { diff --git a/src/agent/framework/event/oma_ds_event_handler.c b/src/agent/framework/event/oma_ds_event_handler.c index 01d5102..94eeb97 100755 --- a/src/agent/framework/event/oma_ds_event_handler.c +++ b/src/agent/framework/event/oma_ds_event_handler.c @@ -57,30 +57,28 @@ int event_callback_add_profile_sync(sync_agent_event_data_s * request, sync_agen { _EXTERN_FUNC_ENTER; - char *profile_dir_name = NULL; char *profile_name = NULL; char *addr = NULL; char *id = NULL; char *password = NULL; - char *sync_mode = NULL; - char *sync_type = NULL; - char *interval = NULL; - int category_count; + int sync_mode = 0; + int sync_type = 0; + int interval = 0; + int category_count = 0; int result = 0; - int account_id; + int account_id = 0; GList *categorys = NULL; GList *iter = NULL; - sync_agent_get_event_data_param(request, &profile_dir_name); - sync_agent_get_event_data_param(request, &profile_name); - sync_agent_get_event_data_param(request, &addr); - sync_agent_get_event_data_param(request, &id); - sync_agent_get_event_data_param(request, &password); - sync_agent_get_event_data_param(request, &sync_mode); - sync_agent_get_event_data_param(request, &sync_type); - sync_agent_get_event_data_param(request, &interval); - sync_agent_get_event_data_param(request, &category_count); + sync_agent_get_event_data_param_str(request, &profile_name); + sync_agent_get_event_data_param_str(request, &addr); + sync_agent_get_event_data_param_str(request, &id); + sync_agent_get_event_data_param_str(request, &password); + sync_agent_get_event_data_param_int(request, (int*)&sync_mode); + sync_agent_get_event_data_param_int(request, (int*)&sync_type); + sync_agent_get_event_data_param_int(request, (int*)&interval); + sync_agent_get_event_data_param_int(request, &category_count); /* _DEBUG_INFO("request param : %s", profile_dir_name); @@ -100,39 +98,35 @@ int event_callback_add_profile_sync(sync_agent_event_data_s * request, sync_agen if (category == NULL) { _DEBUG_ERROR("category is NULL !"); - if (profile_dir_name != NULL) - free(profile_dir_name); - - if (profile_name != NULL) + if (profile_name != NULL) { free(profile_name); + profile_name = NULL; + } - if (addr != NULL) + if (addr != NULL) { free(addr); + addr = NULL; + } - if (id != NULL) + if (id != NULL) { free(id); + id = NULL; + } - if (password != NULL) + if (password != NULL) { free(password); - - if (sync_mode != NULL) - free(sync_mode); - - if (sync_type != NULL) - free(sync_type); - - if (interval != NULL) - free(interval); + password = NULL; + } return 0; } - sync_agent_get_event_data_param(request, &(category->service_type)); - sync_agent_get_event_data_param(request, &(category->enabled)); - sync_agent_get_event_data_param(request, &(category->src_uri)); - sync_agent_get_event_data_param(request, &(category->tgt_uri)); - sync_agent_get_event_data_param(request, &(category->id)); - sync_agent_get_event_data_param(request, &(category->password)); + sync_agent_get_event_data_param_int(request, (int*)&((category->service_type))); + sync_agent_get_event_data_param_int(request, &(category->enabled)); + sync_agent_get_event_data_param_int(request, (int*)&(category->src_uri)); + sync_agent_get_event_data_param_str(request, &(category->tgt_uri)); + sync_agent_get_event_data_param_str(request, &(category->id)); + sync_agent_get_event_data_param_str(request, &(category->password)); categorys = g_list_append(categorys, category); @@ -147,11 +141,11 @@ int event_callback_add_profile_sync(sync_agent_event_data_s * request, sync_agen } /* send to engine controller */ - void *in_param_value_array[9] = { &profile_dir_name, &profile_name, &addr, &id, &password, &sync_mode, &sync_type, &interval, &categorys }; - int in_param_index_array[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - sync_agent_ec_value_type_e in_param_value_type_array[9] = { SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, - SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, - SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT + void *in_param_value_array[8] = {&profile_name, &addr, &id, &password, &sync_mode, &sync_type, &interval, &categorys }; + int in_param_index_array[8] = { 0, 1, 2, 3, 4, 5, 6, 7}; + sync_agent_ec_value_type_e in_param_value_type_array[8] = {SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, + SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_INT, + SYNC_AGENT_EC_VALUE_TYPE_INT, SYNC_AGENT_EC_VALUE_TYPE_INT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT }; unsigned int request_msg_id = 0; @@ -159,7 +153,7 @@ int event_callback_add_profile_sync(sync_agent_event_data_s * request, sync_agen sync_agent_ec_task_error_e task_error = SYNC_AGENT_EC_TASK_ERROR_NOT_YET_RUN; sync_agent_ec_param_param_s **param_array = NULL; - sync_agent_request_sync_task(EC_MSG_TYPE_SYNC_TASK_ADD_PROFILE, 0, 9, in_param_index_array, in_param_value_type_array, in_param_value_array, (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array); + sync_agent_request_sync_task(EC_MSG_TYPE_SYNC_TASK_ADD_PROFILE, 0, 8, in_param_index_array, in_param_value_type_array, in_param_value_array, (int *)&request_msg_id, &task_error, &out_param_count, ¶m_array); sync_agent_get_param_value(&(param_array[0]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &result); sync_agent_get_param_value(&(param_array[1]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &account_id); @@ -170,8 +164,10 @@ int event_callback_add_profile_sync(sync_agent_event_data_s * request, sync_agen for (iter = categorys; iter != NULL; iter = g_list_next(iter)) { sync_service_s *category = (sync_service_s *) iter->data; - if (category != NULL) + if (category != NULL) { free_sync_service(category); + category = NULL; + } } _EXTERN_FUNC_EXIT; @@ -187,16 +183,16 @@ int event_callback_edit_profile_sync(sync_agent_event_data_s * request, sync_age char *addr = NULL; char *id = NULL; char *password = NULL; - char *sync_mode = NULL; - char *sync_type = NULL; - char *interval = NULL; - int category_count; + int sync_mode = 0; + int sync_type = 0; + int interval = 0; + int category_count = 0; int result = 0; GList *categorys = NULL; GList *iter = NULL; - sync_agent_get_event_data_param(request, &profile_dir_name); + sync_agent_get_event_data_param_str(request, &profile_dir_name); if (profile_dir_name == NULL) { _DEBUG_ERROR("profile_dir_name is not defined"); result = 0; @@ -206,22 +202,22 @@ int event_callback_edit_profile_sync(sync_agent_event_data_s * request, sync_age int account_id = get_account_id(profile_dir_name, false); - sync_agent_get_event_data_param(request, &profile_name); - sync_agent_get_event_data_param(request, &addr); - sync_agent_get_event_data_param(request, &id); - sync_agent_get_event_data_param(request, &password); - sync_agent_get_event_data_param(request, &sync_mode); - sync_agent_get_event_data_param(request, &sync_type); - sync_agent_get_event_data_param(request, &interval); - sync_agent_get_event_data_param(request, &category_count); + sync_agent_get_event_data_param_str(request, &profile_name); + sync_agent_get_event_data_param_str(request, &addr); + sync_agent_get_event_data_param_str(request, &id); + sync_agent_get_event_data_param_str(request, &password); + sync_agent_get_event_data_param_int(request, (int*)&sync_mode); + sync_agent_get_event_data_param_int(request, (int*)&sync_type); + sync_agent_get_event_data_param_int(request, (int*)&interval); + sync_agent_get_event_data_param_int(request, &category_count); _DEBUG_INFO("request param : %s", profile_name); _DEBUG_INFO("request param : %s", addr); _DEBUG_INFO("request param : %s", id); _DEBUG_INFO("request param : %s", password); - _DEBUG_INFO("request param : %s", sync_mode); - _DEBUG_INFO("request param : %s", sync_type); - _DEBUG_INFO("request param : %s", interval); + _DEBUG_INFO("request param : %d", sync_mode); + _DEBUG_INFO("request param : %d", sync_type); + _DEBUG_INFO("request param : %d", interval); _DEBUG_INFO("request param : %d", category_count); int i = 0; @@ -245,30 +241,21 @@ int event_callback_edit_profile_sync(sync_agent_event_data_s * request, sync_age if (password != NULL) free(password); - if (sync_mode != NULL) - free(sync_mode); - - if (sync_type != NULL) - free(sync_type); - - if (interval != NULL) - free(interval); - return 0; } - sync_agent_get_event_data_param(request, &(category->service_type)); - sync_agent_get_event_data_param(request, &(category->enabled)); - sync_agent_get_event_data_param(request, &(category->src_uri)); - sync_agent_get_event_data_param(request, &(category->tgt_uri)); - sync_agent_get_event_data_param(request, &(category->id)); - sync_agent_get_event_data_param(request, &(category->password)); + sync_agent_get_event_data_param_int(request, (int*)&(category->service_type)); + sync_agent_get_event_data_param_int(request, &(category->enabled)); + sync_agent_get_event_data_param_int(request, (int*)&(category->src_uri)); + sync_agent_get_event_data_param_str(request, &(category->tgt_uri)); + sync_agent_get_event_data_param_str(request, &(category->id)); + sync_agent_get_event_data_param_str(request, &(category->password)); categorys = g_list_append(categorys, category); _DEBUG_INFO("category[i]->content_type : %d", category->service_type); _DEBUG_INFO("category[i]->enabled : %d", category->enabled); - _DEBUG_INFO("category[i]->srcURI : %s", category->src_uri); + _DEBUG_INFO("category[i]->srcURI : %d", category->src_uri); _DEBUG_INFO("category[i]->tgtURI : %s", category->tgt_uri); _DEBUG_INFO("category[i]->id : %s", category->id); _DEBUG_INFO("category[i]->password : %s", category->password); @@ -278,8 +265,8 @@ int event_callback_edit_profile_sync(sync_agent_event_data_s * request, sync_age void *in_param_value_array[9] = { &account_id, &profile_name, &addr, &id, &password, &sync_mode, &sync_type, &interval, &categorys }; int in_param_index_array[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; sync_agent_ec_value_type_e in_param_value_type_array[9] = { SYNC_AGENT_EC_VALUE_TYPE_INT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, - SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, - SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT + SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT, SYNC_AGENT_EC_VALUE_TYPE_INT, + SYNC_AGENT_EC_VALUE_TYPE_INT, SYNC_AGENT_EC_VALUE_TYPE_INT, SYNC_AGENT_EC_VALUE_TYPE_STRUCT }; unsigned int request_msg_id = 0; @@ -315,7 +302,7 @@ int event_callback_delete_profile_sync(sync_agent_event_data_s * request, sync_a int result = 0; int count; - sync_agent_get_event_data_param(request, &count); + sync_agent_get_event_data_param_int(request, &count); GList *profiles = NULL; int *account_id = 0; @@ -327,7 +314,7 @@ int event_callback_delete_profile_sync(sync_agent_event_data_s * request, sync_a profile = NULL; } - sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param_str(request, &profile); if (profile == NULL) { _DEBUG_ERROR("profile is not defined"); result = 0; @@ -378,7 +365,7 @@ int event_callback_request_sync_sync(sync_agent_event_data_s * request, sync_age char *profile = NULL; int result = 0; - sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param_str(request, &profile); if (profile == NULL) { _DEBUG_ERROR("profile is not defined"); result = 0; @@ -415,7 +402,7 @@ int event_callback_cancel_sync_sync(sync_agent_event_data_s * request, sync_agen int result = 0; bool res; - sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param_str(request, &profile); if (profile == NULL) { _DEBUG_ERROR("profile is not defined"); result = 0; @@ -451,13 +438,13 @@ int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync char *addr = NULL; char *id = NULL; char *password = NULL; - char *sync_mode = NULL; - char *sync_type = NULL; - char *interval = NULL; + int sync_mode = 0; + int sync_type = 0; + int interval = 0; int last_session_status = 0; int last_session_time = 0; - sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param_str(request, &profile); if (profile == NULL) { _DEBUG_ERROR("profile is not defined"); result = 0; @@ -484,9 +471,9 @@ int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); sync_agent_get_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); sync_agent_get_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); - sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &sync_mode); - sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &sync_type); - sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &interval); + sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &sync_mode); + sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &sync_type); + sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &interval); sync_agent_get_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &last_session_status); sync_agent_get_param_value(&(param_array[9]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &last_session_time); @@ -497,14 +484,16 @@ int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)addr); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)id); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)password); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_mode); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)interval); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_mode); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_type); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &interval); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_session_status); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &last_session_time); - if (profile != NULL) + if (profile != NULL) { free(profile); + profile = NULL; + } _EXTERN_FUNC_EXIT; return 0; @@ -522,14 +511,14 @@ int event_callback_get_profile_sync_category_sync(sync_agent_event_data_s * requ char *password = NULL; int result = 0; - sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param_str(request, &profile); if (profile == NULL) { _DEBUG_ERROR("profile is not defined"); result = 0; goto error; } - sync_agent_get_event_data_param(request, &content_type); + sync_agent_get_event_data_param_int(request, &content_type); _DEBUG_INFO("request param : %s", profile); _DEBUG_INFO("request param : %d", content_type); @@ -550,7 +539,7 @@ int event_callback_get_profile_sync_category_sync(sync_agent_event_data_s * requ sync_agent_get_param_value(&(param_array[0]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &result); sync_agent_get_param_value(&(param_array[1]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &enabled); - sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &srcURI); + sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &srcURI); sync_agent_get_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &tgtURI); sync_agent_get_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); @@ -566,7 +555,7 @@ int event_callback_get_profile_sync_category_sync(sync_agent_event_data_s * requ sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &result); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &enabled); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)srcURI); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &srcURI); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)tgtURI); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)id); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)password); @@ -598,14 +587,14 @@ int event_callback_get_profile_last_statistics_sync(sync_agent_event_data_s * re int client2Server_NrOfReplace = 0; int result = 0; - sync_agent_get_event_data_param(request, &profile); + sync_agent_get_event_data_param_str(request, &profile); if (profile == NULL) { _DEBUG_ERROR("profile is not defined"); result = 0; goto error; } - sync_agent_get_event_data_param(request, &content_type); + sync_agent_get_event_data_param_int(request, &content_type); _DEBUG_INFO("request param : %s", profile); _DEBUG_INFO("request param : %d", content_type); @@ -678,15 +667,15 @@ int event_callback_add_profile_cp_sync(sync_agent_event_data_s * request, sync_a char *addr = NULL; char *id = NULL; char *password = NULL; - int category_count; + int category_count = 0; int result = 0; - int account_id; + int account_id = 0; - sync_agent_get_event_data_param(request, &profile_name); - sync_agent_get_event_data_param(request, &addr); - sync_agent_get_event_data_param(request, &id); - sync_agent_get_event_data_param(request, &password); - sync_agent_get_event_data_param(request, &category_count); + sync_agent_get_event_data_param_str(request, &profile_name); + sync_agent_get_event_data_param_str(request, &addr); + sync_agent_get_event_data_param_str(request, &id); + sync_agent_get_event_data_param_str(request, &password); + sync_agent_get_event_data_param_int(request, &category_count); /* _DEBUG_INFO("request param : %s", profile_name); @@ -705,25 +694,29 @@ int event_callback_add_profile_cp_sync(sync_agent_event_data_s * request, sync_a if (profile_name != NULL) free(profile_name); + profile_name = NULL; if (addr != NULL) free(addr); + addr = NULL; if (id != NULL) free(id); + id = NULL; if (password != NULL) free(password); + password = NULL; return 0; } - sync_agent_get_event_data_param(request, &(category->name)); - sync_agent_get_event_data_param(request, &(category->accept)); - sync_agent_get_event_data_param(request, &(category->id)); - sync_agent_get_event_data_param(request, &(category->password)); - sync_agent_get_event_data_param(request, &(category->auth_type)); - sync_agent_get_event_data_param(request, &(category->auth_data)); + sync_agent_get_event_data_param_str(request, &(category->name)); + sync_agent_get_event_data_param_str(request, &(category->accept)); + sync_agent_get_event_data_param_str(request, &(category->id)); + sync_agent_get_event_data_param_str(request, &(category->password)); + sync_agent_get_event_data_param_str(request, &(category->auth_type)); + sync_agent_get_event_data_param_str(request, &(category->auth_data)); categorys = g_list_append(categorys, category); @@ -767,17 +760,16 @@ int event_callback_request_calllog_sync_async(sync_agent_event_data_s * request, char *data = NULL; int result = 0; - sync_agent_get_event_data_param(request, &data); + sync_agent_get_event_data_param_str(request, &data); if (data == NULL) { _DEBUG_ERROR("data is NULL"); result = 0; - goto error; + } else { + _DEBUG_INFO("data = %s", data); + result = send_ip_push_sync_msg(data); + free(data); + data = NULL; } - _DEBUG_INFO("data = %s", data); - - result = send_ip_push_sync_msg(data); - - error: sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &result); @@ -857,9 +849,9 @@ int event_callback_request_get_all_profiles_data(sync_agent_event_data_s * reque sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)server_info->id); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)server_info->password); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->sync_mode); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->sync_type); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_info->interval); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_info->sync_mode); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_info->sync_type); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_info->interval); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &profile_info->last_sync_status); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &profile_info->last_sync_time); @@ -871,9 +863,9 @@ int event_callback_request_get_all_profiles_data(sync_agent_event_data_s * reque _DEBUG_INFO("server_info->id = %s", server_info->id); _DEBUG_INFO("server_info->password = %s", server_info->password); - _DEBUG_INFO("sync_info->sync_mode = %s", sync_info->sync_mode); - _DEBUG_INFO("sync_info->sync_type = %s", sync_info->sync_type); - _DEBUG_INFO("sync_info->interval = %s", sync_info->interval); + _DEBUG_INFO("sync_info->sync_mode = %d", sync_info->sync_mode); + _DEBUG_INFO("sync_info->sync_type = %d", sync_info->sync_type); + _DEBUG_INFO("sync_info->interval = %d", sync_info->interval); _DEBUG_INFO("profile_info->last_sync_status = %d", profile_info->last_sync_status); _DEBUG_INFO("profile_info->last_sync_time = %d", profile_info->last_sync_time); @@ -888,14 +880,14 @@ int event_callback_request_get_all_profiles_data(sync_agent_event_data_s * reque sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &category_info->service_type); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &category_info->enabled); - sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->src_uri); + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &category_info->src_uri); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->tgt_uri); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->id); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)category_info->password); _DEBUG_INFO("category_info->service_type = %d", category_info->service_type); _DEBUG_INFO("category_info->enabled = %d", category_info->enabled); - _DEBUG_INFO("category_info->src_uri = %s", category_info->src_uri); + _DEBUG_INFO("category_info->src_uri = %d", category_info->src_uri); _DEBUG_INFO("category_info->tgt_uri = %s", category_info->tgt_uri); _DEBUG_INFO("category_info->id = %s", category_info->id); _DEBUG_INFO("category_info->password = %s", category_info->password); diff --git a/src/agent/framework/event/oma_ds_platform_event_handler.c b/src/agent/framework/event/oma_ds_platform_event_handler.c index ddc3547..31053ca 100755 --- a/src/agent/framework/event/oma_ds_platform_event_handler.c +++ b/src/agent/framework/event/oma_ds_platform_event_handler.c @@ -330,8 +330,8 @@ int send_ip_push_sync_msg(char *data) if (server_id != NULL) free(server_id); - if (pSanPackage != NULL) - sanPackageParserFree((void *)pSanPackage); +// if (pSanPackage != NULL) +// sanPackageParserFree((void *)pSanPackage); sync_agent_close_agent(); diff --git a/src/agent/framework/task/oma_ds_engine_controller_task.c b/src/agent/framework/task/oma_ds_engine_controller_task.c index ba7012d..6638e65 100755 --- a/src/agent/framework/task/oma_ds_engine_controller_task.c +++ b/src/agent/framework/task/oma_ds_engine_controller_task.c @@ -177,35 +177,30 @@ sync_agent_ec_task_spec_s *make_add_profile_task() { _EXTERN_FUNC_ENTER; - sync_agent_ec_param_spec_s *pParam_spec1 = sync_agent_alloc_param_spec_structure("profileDirName", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec2 = sync_agent_alloc_param_spec_structure("profileName", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec3 = sync_agent_alloc_param_spec_structure("addr", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec4 = sync_agent_alloc_param_spec_structure("id", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec5 = sync_agent_alloc_param_spec_structure("password", _string_copy_struct, free, + sync_agent_ec_param_spec_s *pParam_spec1 = sync_agent_alloc_param_spec_structure("profileName", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_structure("syncMode", _string_copy_struct, free, + sync_agent_ec_param_spec_s *pParam_spec2 = sync_agent_alloc_param_spec_structure("addr", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_structure("syncType", _string_copy_struct, free, + sync_agent_ec_param_spec_s *pParam_spec3 = sync_agent_alloc_param_spec_structure("id", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec8 = sync_agent_alloc_param_spec_structure("interval", _string_copy_struct, free, + sync_agent_ec_param_spec_s *pParam_spec4 = sync_agent_alloc_param_spec_structure("password", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec9 = sync_agent_alloc_param_spec_structure("categories", NULL, _free_sync_categorie_list, + sync_agent_ec_param_spec_s *pParam_spec5 = sync_agent_alloc_param_spec_int("syncMode", true, false, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_int("syncType", true, false, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_int("interval", true, false, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec8 = sync_agent_alloc_param_spec_structure("categories", NULL, _free_sync_categorie_list, true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec10 = sync_agent_alloc_param_spec_int("result", false, true, false, 0, 0, false, 0, false, 0, 0); - sync_agent_ec_param_spec_s *pParam_spec11 = sync_agent_alloc_param_spec_int("accountId", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec9 = sync_agent_alloc_param_spec_int("result", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec10 = sync_agent_alloc_param_spec_int("accountId", false, true, false, 0, 0, false, 0, false, 0, 0); - sync_agent_ec_param_spec_s *param_spec_array[11] = { pParam_spec1, pParam_spec2, pParam_spec3, pParam_spec4, pParam_spec5, - pParam_spec6, pParam_spec7, pParam_spec8, pParam_spec9, pParam_spec10, pParam_spec11 + sync_agent_ec_param_spec_s *param_spec_array[10] = { pParam_spec1, pParam_spec2, pParam_spec3, pParam_spec4, pParam_spec5, + pParam_spec6, pParam_spec7, pParam_spec8, pParam_spec9, pParam_spec10 }; sync_agent_ec_task_spec_s *pTask_spec = sync_agent_alloc_simple_task_spec("add_profile", add_profile_task_process, NULL, NULL, - 11, param_spec_array); + 10, param_spec_array); sync_agent_unref_param_spec(pParam_spec1); sync_agent_unref_param_spec(pParam_spec2); @@ -217,7 +212,6 @@ sync_agent_ec_task_spec_s *make_add_profile_task() sync_agent_unref_param_spec(pParam_spec8); sync_agent_unref_param_spec(pParam_spec9); sync_agent_unref_param_spec(pParam_spec10); - sync_agent_unref_param_spec(pParam_spec11); _EXTERN_FUNC_EXIT; return pTask_spec; @@ -236,12 +230,9 @@ sync_agent_ec_task_spec_s *make_edit_profile_task() true, false, false, NULL, false, NULL, false, NULL); sync_agent_ec_param_spec_s *pParam_spec5 = sync_agent_alloc_param_spec_structure("password", _string_copy_struct, free, true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_structure("syncMode", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_structure("syncType", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec8 = sync_agent_alloc_param_spec_structure("interval", _string_copy_struct, free, - true, false, false, NULL, false, NULL, false, NULL); + sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_int("syncMode", true, false, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_int("syncType", true, false, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec8 = sync_agent_alloc_param_spec_int("interval", true, false, false, 0, 0, false, 0, false, 0, 0); sync_agent_ec_param_spec_s *pParam_spec9 = sync_agent_alloc_param_spec_structure("categories", NULL, _free_sync_categorie_list, true, false, false, NULL, false, NULL, false, NULL); @@ -297,6 +288,7 @@ sync_agent_ec_task_spec_s *make_get_profile_data_task() _EXTERN_FUNC_ENTER; sync_agent_ec_param_spec_s *pParam_spec1 = sync_agent_alloc_param_spec_int("accountId", true, false, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec2 = sync_agent_alloc_param_spec_int("result", false, true, false, 0, 0, false, 0, false, 0, 0); sync_agent_ec_param_spec_s *pParam_spec3 = sync_agent_alloc_param_spec_structure("profileName", _string_copy_struct, free, false, true, false, NULL, false, NULL, false, NULL); @@ -306,12 +298,9 @@ sync_agent_ec_task_spec_s *make_get_profile_data_task() false, true, false, NULL, false, NULL, false, NULL); sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_structure("password", _string_copy_struct, free, false, true, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_structure("syncMode", _string_copy_struct, free, - false, true, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec8 = sync_agent_alloc_param_spec_structure("syncType", _string_copy_struct, free, - false, true, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec9 = sync_agent_alloc_param_spec_structure("interval", _string_copy_struct, free, - false, true, false, NULL, false, NULL, false, NULL); + sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_int("syncMode", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec8 = sync_agent_alloc_param_spec_int("syncType", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec9 = sync_agent_alloc_param_spec_int("interval", false, true, false, 0, 0, false, 0, false, 0, 0); sync_agent_ec_param_spec_s *pParam_spec10 = sync_agent_alloc_param_spec_int("lastSessionStatus", false, true, false, 0, 0, false, 0, false, 0, 0); sync_agent_ec_param_spec_s *pParam_spec11 = sync_agent_alloc_param_spec_int("lastSessionTime", false, true, false, 0, 0, false, 0, false, 0, 0); @@ -349,8 +338,7 @@ sync_agent_ec_task_spec_s *make_get_profile_sync_category_task() sync_agent_ec_param_spec_s *pParam_spec3 = sync_agent_alloc_param_spec_int("result", false, true, false, 0, 0, false, 0, false, 0, 0); sync_agent_ec_param_spec_s *pParam_spec4 = sync_agent_alloc_param_spec_int("enabled", false, true, false, 0, 0, false, 0, false, 0, 0); - sync_agent_ec_param_spec_s *pParam_spec5 = sync_agent_alloc_param_spec_structure("srcURI", _string_copy_struct, free, - false, true, false, NULL, false, NULL, false, NULL); + sync_agent_ec_param_spec_s *pParam_spec5 = sync_agent_alloc_param_spec_int("srcURI", false, true, false, 0, 0, false, 0, false, 0, 0); sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_structure("tgtURI", _string_copy_struct, free, false, true, false, NULL, false, NULL, false, NULL); sync_agent_ec_param_spec_s *pParam_spec7 = sync_agent_alloc_param_spec_structure("id", _string_copy_struct, free, @@ -574,39 +562,37 @@ sync_agent_ec_task_error_e add_profile_task_process(unsigned int param_cnt, sync sync_agent_ec_task_error_e err = SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS; - char *profileDirName = NULL; char *profileName = NULL; char *addr = NULL; char *id = NULL; char *password = NULL; - char *syncMode = NULL; - char *syncType = NULL; - char *interval = NULL; + int syncMode = 0; + int syncType = 0; + int interval = 0; GList *categories = NULL; int accountId; bool res; int result; - sync_agent_get_param_value(&(param_array[0]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profileDirName); - sync_agent_get_param_value(&(param_array[1]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profileName); - sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); - sync_agent_get_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); - sync_agent_get_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); - sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &syncMode); - sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &syncType); - sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &interval); - sync_agent_get_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &categories); + sync_agent_get_param_value(&(param_array[0]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profileName); + sync_agent_get_param_value(&(param_array[1]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); + sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); + sync_agent_get_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); + sync_agent_get_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &syncMode); + sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &syncType); + sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &interval); + sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &categories); - res = add_profile(profileDirName, profileName, addr, id, password, syncMode, syncType, interval, categories, &accountId); + res = add_profile(profileName, addr, id, password, syncMode, syncType, interval, categories, &accountId); if (res == false) { err = SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED; result = 0; } else result = 1; - sync_agent_set_param_value(&(param_array[9]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &result); - sync_agent_set_param_value(&(param_array[10]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &accountId); + sync_agent_set_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &result); + sync_agent_set_param_value(&(param_array[9]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &accountId); /*step 2 : start refresh_from_service for added account */ void *in_param_value_array[1] = { &accountId }; @@ -630,9 +616,9 @@ sync_agent_ec_task_error_e edit_profile_task_process(unsigned int param_cnt, syn char *addr = NULL; char *id = NULL; char *password = NULL; - char *syncMode = NULL; - char *syncType = NULL; - char *interval = NULL; + int syncMode = 0; + int syncType = 0; + int interval = 0; GList *categories = NULL; bool res; @@ -643,9 +629,9 @@ sync_agent_ec_task_error_e edit_profile_task_process(unsigned int param_cnt, syn sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); sync_agent_get_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); sync_agent_get_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); - sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &syncMode); - sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &syncType); - sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &interval); + sync_agent_get_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &syncMode); + sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &syncType); + sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &interval); sync_agent_get_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &categories); res = edit_profile(accountId, profileName, addr, id, password, syncMode, syncType, interval, categories); @@ -697,9 +683,9 @@ sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, char *addr = NULL; char *id = NULL; char *password = NULL; - char *syncMode = NULL; - char *syncType = NULL; - char *interval = NULL; + int sync_mode = 0; + int syncType = 0; + int interval = 0; int lastSessionStatus; int lastSessionTime; int result; @@ -708,7 +694,7 @@ sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, sync_agent_get_param_value(&(param_array[0]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &accountId); retvm_if(accountId < 0, SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED, "account id = %d", accountId); - res = get_profile_data(accountId, &profileName, &addr, &id, &password, &syncMode, &syncType, &interval, &lastSessionStatus, &lastSessionTime); + res = get_profile_data(accountId, &profileName, &addr, &id, &password, &sync_mode, &syncType, &interval, &lastSessionStatus, &lastSessionTime); if (res == false) { err = SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED; result = 0; @@ -720,9 +706,9 @@ sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, sync_agent_set_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); sync_agent_set_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); sync_agent_set_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); - sync_agent_set_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &syncMode); - sync_agent_set_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &syncType); - sync_agent_set_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &interval); + sync_agent_set_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &sync_mode); + sync_agent_set_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &syncType); + sync_agent_set_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &interval); sync_agent_set_param_value(&(param_array[9]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &lastSessionStatus); sync_agent_set_param_value(&(param_array[10]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &lastSessionTime); @@ -741,7 +727,7 @@ sync_agent_ec_task_error_e get_profile_sync_category_task_process(unsigned int p int contentType; int enabled = 0; - char *srcURI = NULL; + int srcURI = 0; char *tgtURI = NULL; char *id = NULL; char *password = NULL; @@ -762,7 +748,7 @@ sync_agent_ec_task_error_e get_profile_sync_category_task_process(unsigned int p sync_agent_set_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &result); sync_agent_set_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &enabled); - sync_agent_set_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &srcURI); + sync_agent_set_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &srcURI); sync_agent_set_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &tgtURI); sync_agent_set_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); sync_agent_set_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); diff --git a/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c b/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c index b6b14db..bda3a46 100755 --- a/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c +++ b/src/agent/service-adapter/protocol-binder/oma_ds_protocol_binder.c @@ -563,7 +563,7 @@ static sync_agent_pb_error_e _oma_ds_binder_devinf_converter_function(sync_agent } } - __append_devinf_contenttype_to_wbxml_node(devInfDataStore->rx_pref, binder, datastore_node, ELEMENT_RX_PREF); + err = __append_devinf_contenttype_to_wbxml_node(devInfDataStore->rx_pref, binder, datastore_node, ELEMENT_RX_PREF); if (err != SYNC_AGENT_PB_RETURN_OK) goto error; @@ -571,19 +571,19 @@ static sync_agent_pb_error_e _oma_ds_binder_devinf_converter_function(sync_agent devinf_content_type_s *devInfContentType = NULL; for (rxIter = devInfDataStore->rx; rxIter != NULL; rxIter = g_list_next(rxIter)) { devInfContentType = rxIter->data; - __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_RX); + err = __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_RX); if (err != SYNC_AGENT_PB_RETURN_OK) goto error; } - __append_devinf_contenttype_to_wbxml_node(devInfDataStore->tx_pref, binder, datastore_node, ELEMENT_TX_PREF); + err = __append_devinf_contenttype_to_wbxml_node(devInfDataStore->tx_pref, binder, datastore_node, ELEMENT_TX_PREF); if (err != SYNC_AGENT_PB_RETURN_OK) goto error; GList *txIter = NULL; for (txIter = devInfDataStore->tx; txIter != NULL; txIter = g_list_next(txIter)) { devInfContentType = txIter->data; - __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_TX); + err = __append_devinf_contenttype_to_wbxml_node(devInfContentType, binder, datastore_node, ELEMENT_TX); if (err != SYNC_AGENT_PB_RETURN_OK) goto error; diff --git a/src/agent/service-adapter/sa_common_interface.c b/src/agent/service-adapter/sa_common_interface.c index 614aded..c2e2a6a 100755 --- a/src/agent/service-adapter/sa_common_interface.c +++ b/src/agent/service-adapter/sa_common_interface.c @@ -201,7 +201,7 @@ static sa_error_type_e _create_session(int account_id, char *session_id, bool se } /* create session info */ - errorType = create_session(VERSION_12, PROTOCOL_TYPE_DS, account_id, session_id, pSourceLocation, pTargetLocation, session); + errorType = create_session(VERSION_12, PROTOCOL_TYPE_DS, account_id, session_id, dup_location(pSourceLocation), dup_location(pTargetLocation), session); if (errorType != SA_INTERNAL_OK) { _DEBUG_ERROR("failed to create session"); goto error; @@ -216,18 +216,38 @@ static sa_error_type_e _create_session(int account_id, char *session_id, bool se error: - if (id != NULL) + if (id != NULL) { free(id); - if (pwd != NULL) + id = NULL; + } + if (pwd != NULL) { free(pwd); - if (targetUrl != NULL) + pwd = NULL; + } + if (targetUrl != NULL) { free(targetUrl); - if (sourceUrl != NULL) + targetUrl = NULL; + } + if (sourceUrl != NULL) { free(sourceUrl); - if (nextNonce != NULL) + sourceUrl = NULL; + } + if (nextNonce != NULL) { free(nextNonce); - if (pTempChal != NULL) + nextNonce = NULL; + } + if (pTempChal != NULL) { free_chal(pTempChal); + pTempChal = NULL; + } + if (pSourceLocation != NULL) { + free_location(pSourceLocation); + pSourceLocation = NULL; + } + if (pTargetLocation != NULL) { + free_location(pTargetLocation); + pTargetLocation = NULL; + } _INNER_FUNC_EXIT; return errorType; @@ -245,7 +265,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl char *credData = NULL; char *decoded_nonce = NULL; bool resume = false; - char *value = NULL; alert_type_e alert_type = ALERT_UNKNOWN; /*pkg1 always has final tag */ @@ -333,10 +352,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl decoded_nonce = NULL; } - if (nextNonce != NULL) { - free(nextNonce); - nextNonce = NULL; - } nonce_size = 0; if (errorType != SA_INTERNAL_OK) { @@ -527,8 +542,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl free(targetUrl); if (nextNonce != NULL) free(nextNonce); - if (value != NULL) - free(value); if (pCred != NULL) free_cred(pCred); @@ -548,8 +561,6 @@ static sa_error_type_e _generate_presync_msg(session_s * session, bool server_fl free(targetUrl); if (nextNonce != NULL) free(nextNonce); - if (value != NULL) - free(value); if (syncml != NULL) free_syncml(syncml); if (pSyncHdr != NULL) @@ -731,6 +742,9 @@ static sa_error_type_e _generate_msg(session_s * session, void **sync_obj, bool } free_commands(commands); + if (binder != NULL) + oma_ds_1_2_binder_terminate(binder); + _INNER_FUNC_EXIT; return errorType; } @@ -2617,7 +2631,7 @@ int auto_configure(char *addr, char *id, char *password, GList ** configure) target = NULL; } */ - +/* GList *iter = NULL; GList *innerIter = NULL; devinf_datastore_s *devInfDataStore = NULL; @@ -2670,7 +2684,7 @@ int auto_configure(char *addr, char *id, char *password, GList ** configure) } } } - +*/ tempConfigure = g_list_append(tempConfigure, contactCandidate); tempConfigure = g_list_append(tempConfigure, calendarCandidate); tempConfigure = g_list_append(tempConfigure, memoCandidate); diff --git a/src/agent/service-adapter/sa_session.c b/src/agent/service-adapter/sa_session.c index 3ff27a1..6b0feae 100755 --- a/src/agent/service-adapter/sa_session.c +++ b/src/agent/service-adapter/sa_session.c @@ -903,6 +903,7 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s * free_command(session->large_obj_cmd); session->large_obj_cmd = NULL; + command = NULL; } else { status_s *temp = NULL; errorType = create_new_status_location(session, ERROR_SIZE_MISMATCH, command, changedItem->source, changedItem->target, convert_command_type_change_type(changeType), &temp); @@ -925,6 +926,7 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s * } } } + if (changeType == CHANGE_ADD) { int datastore_id = 0; if (strcmp(changedItem->content_type, ELEMENT_TEXT_VCARD) == 0 || strcmp(changedItem->content_type, ELEMENT_TEXT_VCARD_30) == 0) @@ -971,7 +973,10 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s * } status_s *temp = NULL; - errorType = create_new_status_location(session, ERROR_UNKNOWN, command, changedItem->source, changedItem->target, convert_command_type_change_type(changeType), &temp); + + if (command != NULL) + errorType = create_new_status_location(session, ERROR_UNKNOWN, command, changedItem->source, changedItem->target, convert_command_type_change_type(changeType), &temp); + if (errorType != SA_INTERNAL_OK) { _DEBUG_ERROR("failed in create_new_status_location"); goto error; @@ -985,8 +990,10 @@ static sa_error_type_e _receive_changes_command(session_s * session, command_s * error: - if (changed != NULL) + if (changed) { free_changed_item(changed); + changed = NULL; + } _INNER_FUNC_ENTER; return errorType; @@ -1485,6 +1492,7 @@ sa_error_type_e receive_commands(session_s * session, GList * receive_command, b command = iter->data; if (auto_config != true || (auto_config == true && command->type == COMMAND_TYPE_RESULTS)) { + _DEBUG_INFO("command->type = %d", command->type); switch (command->type) { case COMMAND_TYPE_UNKNOWN: case COMMAND_TYPE_HEADER: @@ -1525,7 +1533,7 @@ sa_error_type_e receive_commands(session_s * session, GList * receive_command, b case COMMAND_TYPE_REPLACE: case COMMAND_TYPE_DELETE: { - if (command->type != COMMAND_TYPE_ADD || luid_str_list != NULL) { + if (luid_str_list != NULL) { errorType = _receive_changes_command(session, command, luid_str_list, &index, &changedDatastore); } else { _DEBUG_ERROR("luid_str_list is NULL !!"); diff --git a/src/agent/service-adapter/sa_util.c b/src/agent/service-adapter/sa_util.c index 6538765..fb450d9 100755 --- a/src/agent/service-adapter/sa_util.c +++ b/src/agent/service-adapter/sa_util.c @@ -34,12 +34,13 @@ void put_into_list(GList ** commands, GList ** commands_last, void *command) { _EXTERN_FUNC_ENTER; - GList *temp = NULL; if (*commands_last == NULL) { - *commands_last = *commands = g_list_append(*commands, command); + *commands = g_list_append(*commands, command); + *commands_last = *commands; } else { - temp = g_list_append(*commands_last, command); - *commands_last = g_list_next(*commands_last); + *commands_last = g_list_append(*commands_last, command); + *commands = g_list_first(*commands_last); + *commands_last = g_list_last(*commands_last); } _EXTERN_FUNC_EXIT; diff --git a/src/agent/service-engine/se_account.c b/src/agent/service-engine/se_account.c index 803f9d3..b1608d8 100755 --- a/src/agent/service-engine/se_account.c +++ b/src/agent/service-engine/se_account.c @@ -56,6 +56,11 @@ static datastore_cp_info predefinedServer[] = { {"Everdroid", 1} }; +static char * _convert_to_sync_mode_str(int sync_mode); +static char * _convert_to_sync_type_str(int sync_type); +static char * _convert_to_interval_str(int interval); +static char * _convert_to_src_uri_str(int src_uri); + static se_error_type_e _add_profile(char *addr, char *id, char *password, char *access_name, int *account_id); static se_error_type_e _set_profile_info(int account_id, char *profile_name, char *sync_mode, char *sync_type, char *interval); static se_error_type_e _set_profile_category(int account_id, sync_service_s * category); @@ -69,6 +74,145 @@ static se_error_type_e _set_profile_category_info_cp(int account_id, int content static se_error_type_e __set_profile_category_info_into_cofnig_list(int account_id, int content_type, int enabled, char *src_uri, char *tgt_uri, char *id, char *password, GList ** config_list); static se_error_type_e ___append_config_value(int account_id, char *key, char *value, char *type, char *access_name, GList ** list); +static char * _convert_to_sync_mode_str(int sync_mode) +{ + _INNER_FUNC_ENTER; + + _DEBUG_INFO("sync_mode: [%d]",sync_mode); + char *sync_mode_str = NULL; + + switch (sync_mode) { + case MODE_MANUAL: + sync_mode_str = DEFINE_SYNC_MODE_MANUAL; + break; + case MODE_PERIODIC: + sync_mode_str = DEFINE_SYNC_MODE_PERIODIC; + break; + case MODE_PUSH: + sync_mode_str = DEFINE_SYNC_MODE_PUSH; + break; + default: + _DEBUG_ERROR("sync_mode is invalid!!"); + break; + } + + _DEBUG_INFO("sync_mode_str: [%s]",sync_mode_str); + + _INNER_FUNC_EXIT; + return sync_mode_str; +} + +static char * _convert_to_sync_type_str(int sync_type) +{ + _INNER_FUNC_ENTER; + char *sync_type_str = NULL; + + _DEBUG_INFO("sync_type: [%d]",sync_type); + + switch (sync_type) { + case SYNC_TYPE_FULL_SYNC: + sync_type_str = DEFINE_ALERT_SLOW_SYNC_STR; + break; + case SYNC_TYPE_UPDATE_BOTH: + sync_type_str = DEFINE_ALERT_TWO_WAY_STR; + break; + case SYNC_TYPE_UPDATE_TO_SERVER: + sync_type_str = DEFINE_ALERT_ONE_WAY_FROM_CLIENT_STR; + break; + case SYNC_TYPE_UPDATE_TO_PHONE: + sync_type_str = DEFINE_ALERT_ONE_WAY_FROM_SERVER_STR; + break; + case SYNC_TYPE_REFRESH_FROM_SERVER: + sync_type_str = DEFINE_ALERT_REFRESH_FROM_SERVER_STR; + break; + case SYNC_TYPE_REFRESH_FROM_PHONE: + sync_type_str = DEFINE_ALERT_REFRESH_FROM_CLIENT_STR; + break; + default: + _DEBUG_ERROR("sync_type is invalid!!"); + sync_type_str = DEFINE_ALERT_UNKNOWN_STR; + break; + } + + _DEBUG_INFO("sync_type_str: [%s]",sync_type_str); + + _INNER_FUNC_EXIT; + return sync_type_str; +} + +static char * _convert_to_interval_str(int interval) +{ + _INNER_FUNC_ENTER; + char *interval_str = NULL; + + _DEBUG_INFO("interval: [%d]",interval); + + switch (interval) { + case SYNC_INTERVAL_5_MINUTES: + interval_str = DEFINE_SYNC_INTERVAL_5_MINUTES_STR; + break; + case SYNC_INTERVAL_15_MINUTES: + interval_str = DEFINE_SYNC_INTERVAL_15_MINUTES_STR; + break; + case SYNC_INTERVAL_1_HOUR: + interval_str = DEFINE_SYNC_INTERVAL_1_HOUR_STR; + break; + case SYNC_INTERVAL_4_HOURS: + interval_str = DEFINE_SYNC_INTERVAL_4_HOURS_STR; + break; + case SYNC_INTERVAL_12_HOURS: + interval_str = DEFINE_SYNC_INTERVAL_12_HOURS_STR; + break; + case SYNC_INTERVAL_1_DAY: + interval_str = DEFINE_SYNC_INTERVAL_1_DAY_STR; + break; + case SYNC_INTERVAL_1_WEEK: + interval_str = DEFINE_SYNC_INTERVAL_1_WEEK_STR; + break; + case SYNC_INTERVAL_1_MONTH: + interval_str = DEFINE_SYNC_INTERVAL_1_MONTH_STR; + break; + default: + _DEBUG_ERROR("interval is invalid!!"); + break; + } + + _DEBUG_INFO("interval_str: [%s]",interval_str); + + _INNER_FUNC_EXIT; + return interval_str; +} + +static char * _convert_to_src_uri_str(int src_uri) +{ + _INNER_FUNC_ENTER; + char* src_uri_str = NULL; + + _DEBUG_INFO("src_uri: [%d]",src_uri); + + switch (src_uri) { + case SRC_URI_CONTACT: + src_uri_str = DEFINE_SOURCE_CONTACT_URI; + break; + case SRC_URI_CALENDAR: + src_uri_str = DEFINE_SOURCE_CALENDAR_URI; + break; + case SRC_URI_MEMO: + src_uri_str = DEFINE_SOURCE_MEMO_URI; + break; + case SRC_URI_CALLLOG: + src_uri_str = DEFINE_SOURCE_CALLLOG_URI; + break; + default: + _DEBUG_ERROR("src_uri is invalid!!"); + break; + } + _DEBUG_INFO("src_uri_str: [%s]", src_uri_str); + + _INNER_FUNC_EXIT; + return src_uri_str; +} + static se_error_type_e _add_profile(char *addr, char *id, char *password, char *access_name, int *account_id) { _INNER_FUNC_ENTER; @@ -353,7 +497,7 @@ static se_error_type_e _set_profile_category(int account_id, sync_service_s * ca _DEBUG_TRACE("category->content_type : %d", category->service_type); _DEBUG_TRACE("category->enabled : %d", category->enabled); - _DEBUG_TRACE("category->src_uri : %s", category->src_uri); + _DEBUG_TRACE("category->src_uri : %d", category->src_uri); _DEBUG_TRACE("category->tgt_uri : %s", category->tgt_uri); _DEBUG_TRACE("category->id : %s", category->id); _DEBUG_TRACE("category->password : %s", category->password); @@ -366,6 +510,7 @@ static se_error_type_e _set_profile_category(int account_id, sync_service_s * ca char datastore_source[128]; char datastore_id[128]; char datastore_pw[128]; + char *src_uri_str = NULL; if (category->service_type == TYPE_CONTACT) datastore = DEFINE_CONFIG_KEY_PROFILE_CATEGORY_CONTACTS; @@ -388,12 +533,19 @@ static se_error_type_e _set_profile_category(int account_id, sync_service_s * ca goto error; } - result = set_config_str(account_id, datastore_source, category->src_uri, "string", "SE"); + src_uri_str = _convert_to_src_uri_str(category->src_uri); + if (src_uri_str == NULL){ + _DEBUG_ERROR("failed in _convert_to_src_uri_str"); + goto error; + } + + result = set_config_str(account_id, datastore_source, src_uri_str, "string", "SE"); if (result == false) { _DEBUG_ERROR("failed in set_config"); err = SE_INTERNAL_DA_ERROR; goto error; } + _DEBUG_INFO("src_uri_str: [%s]",src_uri_str); result = set_config_str(account_id, datastore_target, category->tgt_uri, "string", "SE"); if (result == false) { @@ -426,6 +578,7 @@ static se_error_type_e _set_profile_category(int account_id, sync_service_s * ca static se_error_type_e _set_periodic_sync_config(int account_id, char *sync_mode, char *interval) { _INNER_FUNC_ENTER; + _DEBUG_TRACE("account_id = %d", account_id); _DEBUG_TRACE("sync_mode = %s", sync_mode); se_error_type_e err = SE_INTERNAL_OK; @@ -460,14 +613,14 @@ static se_error_type_e _set_periodic_sync_config(int account_id, char *sync_mode } if (strcmp(sync_mode, DEFINE_SYNC_MODE_PERIODIC) == 0 && interval != NULL) { - +/* result = set_config_str(account_id, DEFINE_CONFIG_KEY_PROFILE_CLIENT_SYNC_TYPE, DEFINE_ALERT_TWO_WAY_STR, "string", "SE"); if (result == false) { _DEBUG_ERROR("failed in set_config"); err = SE_INTERNAL_DA_ERROR; goto error; } - +*/ int week[] = { DAY_SUN, DAY_MON, DAY_TUE, DAY_WED, DAY_THU, DAY_FRI, DAY_SAT }; time_t current_time; struct tm *struct_time; @@ -510,6 +663,10 @@ static se_error_type_e _set_periodic_sync_config(int account_id, char *sync_mode _DEBUG_TRACE("1 week"); alarm_info->repeat_type = REPEAT_WEEKLY; alarm_info->repeat_value = week[struct_time->tm_wday]; + } else if (strcmp(interval, "1 month") == 0) { + _DEBUG_TRACE("1 month"); + alarm_info->repeat_type = REPEAT;//REPEAT_MONTHLY; + alarm_info->repeat_value = (((24 * 60) * 60) * 30 ); } scheduler_err = sync_agent_add_service_data(1, alarm_info, &alarm_id); @@ -538,14 +695,19 @@ static se_error_type_e _set_periodic_sync_config(int account_id, char *sync_mode error: - if (value != NULL) + if (value != NULL) { free(value); + value = NULL; + } if (alarm_info != NULL) { - if (alarm_info->start_alarm_time != NULL) + if (alarm_info->start_alarm_time != NULL) { free(alarm_info->start_alarm_time); + alarm_info->start_alarm_time = NULL; + } free(alarm_info); + alarm_info = NULL; } _INNER_FUNC_EXIT; @@ -670,12 +832,20 @@ static se_error_type_e _set_profile_category_info(int account_id, sync_service_s retvm_if(category == NULL, SE_INTERNAL_NOT_DEFINED, "category is NULL"); se_error_type_e err = SE_INTERNAL_OK; - err = __set_profile_category_info_into_cofnig_list(account_id, category->service_type, category->enabled, category->src_uri, category->tgt_uri, category->id, category->password, config_list); + char *src_uri_str = NULL; + + src_uri_str = _convert_to_src_uri_str(category->src_uri); + if (src_uri_str == NULL) { + _DEBUG_ERROR("failed in _convert_to_src_uri_str"); + goto error; + } + + err = __set_profile_category_info_into_cofnig_list(account_id, category->service_type, category->enabled, src_uri_str, category->tgt_uri, category->id, category->password, config_list); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed in _set_profile_category_info_into_cofnig_list"); goto error; } - + _DEBUG_INFO("src_uri_str: [%s]",src_uri_str); error: _INNER_FUNC_EXIT; @@ -1016,6 +1186,7 @@ static se_error_type_e _get_empty_profile_dir_name(char **empty_profile_dir_name char profileIndex[2]; int index; int i; + int cnt = 0; sync_agent_acc_error_e acc_err = SYNC_AGENT_ACC_SUCCESS; sync_agent_fw_account_s *fw_account = NULL; @@ -1031,6 +1202,9 @@ static se_error_type_e _get_empty_profile_dir_name(char **empty_profile_dir_name goto error; } + cnt = g_list_length(account_info_list); + _DEBUG_INFO("account_info_list , length = %d", cnt); + for (iter = account_info_list; iter != NULL; iter = g_list_next(iter)) { fw_account = (sync_agent_fw_account_s *) iter->data; @@ -1039,6 +1213,7 @@ static se_error_type_e _get_empty_profile_dir_name(char **empty_profile_dir_name profileDirName = NULL; } + _DEBUG_INFO("fw_account->account_id = %d", fw_account->account_id); result = get_config(fw_account->account_id, DEFINE_CONFIG_KEY_PROFILE_DIR_NAME, &profileDirName); if (result == false) { _DEBUG_ERROR("failed in get_Config"); @@ -1075,7 +1250,7 @@ static se_error_type_e _get_empty_profile_dir_name(char **empty_profile_dir_name return err; } -bool add_profile(char *profile_dir_name, char *profile_name, char *addr, char *id, char *password, char *sync_mode, char *sync_type, char *interval, GList * categories, int *account_id) +bool add_profile(char *profile_name, char *addr, char *id, char *password, int sync_mode, int sync_type, int interval, GList * categories, int *account_id) { _EXTERN_FUNC_ENTER; @@ -1083,13 +1258,17 @@ bool add_profile(char *profile_dir_name, char *profile_name, char *addr, char *i _DEBUG_INFO("addr = %s", addr); _DEBUG_INFO("id = %s", id); _DEBUG_INFO("password = %s", password); - _DEBUG_INFO("sync_mode = %s", sync_mode); - _DEBUG_INFO("sync_type = %s", sync_type); - _DEBUG_INFO("interval = %s", interval); + _DEBUG_INFO("sync_mode = %d", sync_mode); + _DEBUG_INFO("sync_type = %d", sync_type); + _DEBUG_INFO("interval = %d", interval); se_error_type_e err = SE_INTERNAL_OK; int account = -1; GList *config_list = NULL; + char *profile_dir_name = NULL; + char * sync_mode_str = NULL; + char * sync_type_str = NULL; + char * interval_str = NULL; sync_agent_da_return_e da_err = sync_agent_open_agent(); if (da_err != SYNC_AGENT_DA_SUCCESS) { @@ -1097,25 +1276,68 @@ bool add_profile(char *profile_dir_name, char *profile_name, char *addr, char *i goto error; } + // Assign profile_dir_name + err = _get_empty_profile_dir_name(&profile_dir_name); + if (err != SE_INTERNAL_OK) { + _DEBUG_ERROR("failed in _get_empty_profileDirName"); + goto error; + } + + if (profile_dir_name == NULL) { + _DEBUG_ERROR("Maximum profiles count is %d, no more profile", MAXIMUM_ACCOUNT_COUNT); + err = SE_INTERNAL_ERROR; + goto error; + } + _DEBUG_INFO("profile_dir_name[%s]", profile_dir_name); + err = _add_profile(addr, id, password, "SE", &account); if (err != SE_INTERNAL_OK) { - _DEBUG_ERROR("failed in add_Account"); + _DEBUG_ERROR("failed in _add_profile"); goto error; } - err = _set_profile_info_into_config_list(account, profile_dir_name, addr, profile_name, sync_mode, sync_type, interval, NULL, NULL, &config_list); + sync_mode_str = _convert_to_sync_mode_str(sync_mode); + if (sync_mode_str == NULL) { + _DEBUG_ERROR("_convert_to_sync_mode_str failed!!"); + err = SE_INTERNAL_ERROR; + goto error; + } + + sync_type_str = _convert_to_sync_type_str(sync_type); + if (sync_type_str == NULL) { + _DEBUG_ERROR("_convert_to_sync_type_str failed!!"); + err = SE_INTERNAL_ERROR; + goto error; + } + + interval_str = _convert_to_interval_str(interval); + if (interval_str == NULL) { + _DEBUG_ERROR("_convert_to_interval_str failed!!"); + err = SE_INTERNAL_ERROR; + goto error; + } + + _DEBUG_INFO("sync_mode_str : [%s]", sync_mode_str); + _DEBUG_INFO("sync_type_str : [%s]", sync_type_str); + _DEBUG_INFO("interval_str : [%s]", interval_str); + + err = _set_profile_info_into_config_list(account, profile_dir_name, addr, profile_name, sync_mode_str, sync_type_str, interval_str, NULL, NULL, &config_list); if (err != SE_INTERNAL_OK) { - _DEBUG_ERROR("failed in add_Account"); + _DEBUG_ERROR("_set_profile_info_into_config_list failed!!"); goto error; } + int cnt = 0; + cnt = g_list_length(categories); + _DEBUG_INFO("categories length : [%d]", cnt); + sync_service_s *category = NULL; GList *iter = NULL; for (iter = categories; iter != NULL; iter = g_list_next(iter)) { category = iter->data; err = _set_profile_category_info(account, category, &config_list); if (err != SE_INTERNAL_OK) { - _DEBUG_ERROR("failed in __set_profile_category"); + _DEBUG_ERROR("failed in _set_profile_category_info"); goto error; } } @@ -1123,10 +1345,11 @@ bool add_profile(char *profile_dir_name, char *profile_name, char *addr, char *i da_err = sync_agent_add_config_list(config_list); if (da_err != SYNC_AGENT_DA_SUCCESS) { err = SE_INTERNAL_DA_ERROR; + _DEBUG_ERROR("failed in sync_agent_add_config_list"); goto error; } - err = _set_periodic_sync_config(account, sync_mode, interval); + err = _set_periodic_sync_config(account, sync_mode_str, interval_str); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed in _set_periodic_sync_config"); goto error; @@ -1445,7 +1668,7 @@ bool add_profile_dive(int *account_id) return true; } -bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char *password, char *sync_mode, char *sync_type, char *interval, GList * categories) +bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char *password, int sync_mode, int sync_type, int interval, GList * categories) { _EXTERN_FUNC_ENTER; @@ -1453,6 +1676,9 @@ bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char sync_agent_acc_error_e acc_err = SYNC_AGENT_ACC_SUCCESS; sync_agent_fw_account_s *fw_account = NULL; bool result; + char* sync_mode_str = NULL; + char* sync_type_str = NULL; + char* interval_str = NULL; sync_agent_da_return_e da_err = sync_agent_open_agent(); if (da_err != SYNC_AGENT_DA_SUCCESS) { @@ -1485,13 +1711,34 @@ bool edit_profile(int account_id, char *profile_name, char *addr, char *id, char goto error; } - err = _set_profile_info(account_id, profile_name, sync_mode, sync_type, interval); + sync_mode_str = _convert_to_sync_mode_str(sync_mode); + if (sync_mode_str == NULL) { + _DEBUG_ERROR("_convert_to_sync_mode_str failed!!"); + err = SE_INTERNAL_DA_ERROR; + goto error; + } + + sync_type_str = _convert_to_sync_type_str(sync_type); + if (sync_type_str == NULL) { + _DEBUG_ERROR("_convert_to_sync_type_str failed!!"); + err = SE_INTERNAL_DA_ERROR; + goto error; + } + + interval_str = _convert_to_interval_str(interval); + if (interval_str == NULL) { + _DEBUG_ERROR("_convert_to_interval_str failed!!"); + err = SE_INTERNAL_DA_ERROR; + goto error; + } + + err = _set_profile_info(account_id, profile_name, sync_mode_str, sync_type_str, interval_str); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed in __set_profile_info"); goto error; } - err = _set_periodic_sync_config(account_id, sync_mode, interval); + err = _set_periodic_sync_config(account_id, sync_mode_str, interval_str); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed in __set_profile_info"); goto error; diff --git a/src/agent/service-engine/se_notification.c b/src/agent/service-engine/se_notification.c index 1fdf1c5..6a22701 100755 --- a/src/agent/service-engine/se_notification.c +++ b/src/agent/service-engine/se_notification.c @@ -36,7 +36,7 @@ #define NOTI_KEY "OMADS" #define OMA_DS_UI_PKG "ug-setting-synchronise-efl" -se_error_type_e send_noti_session_process(char *profile, char *sync_type, char *progress, char *error) +se_error_type_e send_noti_session_process(char *profile, int sync_type, char *progress, char *error) { _EXTERN_FUNC_ENTER; @@ -59,7 +59,7 @@ se_error_type_e send_noti_session_process(char *profile, char *sync_type, char * } sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile); - sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type); + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_type); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)progress); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)error); @@ -81,7 +81,7 @@ se_error_type_e send_noti_session_process(char *profile, char *sync_type, char * return err; } -se_error_type_e send_noti_process_update(char *profile_dir_name, char *sync_type, char *uri, char *progress_status, char *operation_type, int is_from_server, int total_per_operation, int synced_per_operation, int total_per_db, int synced_per_db) +se_error_type_e send_noti_process_update(char *profile_dir_name, int sync_type, int uri, char *progress_status, char *operation_type, int is_from_server, int total_per_operation, int synced_per_operation, int total_per_db, int synced_per_db) { _EXTERN_FUNC_ENTER; @@ -104,8 +104,8 @@ se_error_type_e send_noti_process_update(char *profile_dir_name, char *sync_type } sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_dir_name); - sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type); - sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)uri); + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &sync_type); + sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &uri); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)progress_status); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)operation_type); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &is_from_server); diff --git a/src/agent/service-engine/se_storage.c b/src/agent/service-engine/se_storage.c index 51beeff..e204715 100755 --- a/src/agent/service-engine/se_storage.c +++ b/src/agent/service-engine/se_storage.c @@ -36,6 +36,10 @@ static se_error_type_e _write_sync_type(int account_id, alert_type_e alert_type); static se_error_type_e _write_last_session_values(int account_id, sync_session_result_e sync_session_result, int last_session_time); +static int _convert_sync_mode_value(char* sync_mode_str); +static int _convert_sync_type_value(char* sync_type_str); +static int _convert_interval_value(char* interval_str); +static int _convert_src_uri_value(char* src_uri_str); static se_error_type_e _write_sync_type(int account_id, alert_type_e alert_type) { @@ -109,6 +113,124 @@ static se_error_type_e _write_last_session_values(int account_id, sync_session_r return err; } +static int _convert_sync_mode_value(char* sync_mode_str) +{ + _INNER_FUNC_ENTER; + _DEBUG_INFO("sync_mode_str: [%s]", sync_mode_str); + + int sync_mode_value = 0; + + if (strcmp(sync_mode_str,DEFINE_SYNC_MODE_MANUAL) == 0){ + sync_mode_value = MODE_MANUAL; + } else if (strcmp(sync_mode_str,DEFINE_SYNC_MODE_PERIODIC) == 0){ + sync_mode_value = MODE_PERIODIC; + } else if (strcmp(sync_mode_str,DEFINE_SYNC_MODE_PUSH) == 0){ + sync_mode_value = MODE_PUSH; + } else { + _DEBUG_ERROR("sync_mode_str is invalid!!"); + goto error; + } + + error: + + _INNER_FUNC_EXIT; + return sync_mode_value; + +} + +static int _convert_sync_type_value(char* sync_type_str) +{ + _INNER_FUNC_ENTER; + _DEBUG_INFO("sync_type_str: [%s]", sync_type_str); + + int sync_type_value = 0; + + if (strcmp(sync_type_str,DEFINE_ALERT_SLOW_SYNC_STR) == 0){ + sync_type_value = SYNC_TYPE_FULL_SYNC; + } else if (strcmp(sync_type_str,DEFINE_ALERT_TWO_WAY_STR) == 0){ + sync_type_value = SYNC_TYPE_UPDATE_BOTH; + } else if (strcmp(sync_type_str,DEFINE_ALERT_ONE_WAY_FROM_CLIENT_STR) == 0){ + sync_type_value = SYNC_TYPE_UPDATE_TO_SERVER; + } else if (strcmp(sync_type_str,DEFINE_ALERT_ONE_WAY_FROM_SERVER_STR) == 0){ + sync_type_value = SYNC_TYPE_UPDATE_TO_PHONE; + } else if (strcmp(sync_type_str,DEFINE_ALERT_REFRESH_FROM_SERVER_STR) == 0){ + sync_type_value = SYNC_TYPE_REFRESH_FROM_SERVER; + } else if (strcmp(sync_type_str,DEFINE_ALERT_REFRESH_FROM_CLIENT_STR) == 0){ + sync_type_value = SYNC_TYPE_REFRESH_FROM_PHONE; + } else { + _DEBUG_ERROR("sync_type_str is invalid!!"); + goto error; + } + + error: + + _INNER_FUNC_EXIT; + return sync_type_value; + +} + +static int _convert_interval_value(char* interval_str) +{ + _INNER_FUNC_ENTER; + _DEBUG_INFO("interval_str: [%s]", interval_str); + + int interval_value = 0; + + if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_5_MINUTES_STR) == 0){ + interval_value = SYNC_INTERVAL_5_MINUTES; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_15_MINUTES_STR) == 0){ + interval_value = SYNC_INTERVAL_15_MINUTES; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_1_HOUR_STR) == 0){ + interval_value = SYNC_INTERVAL_1_HOUR; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_4_HOURS_STR) == 0){ + interval_value = SYNC_INTERVAL_4_HOURS; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_12_HOURS_STR) == 0){ + interval_value = SYNC_INTERVAL_12_HOURS; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_1_DAY_STR) == 0){ + interval_value = SYNC_INTERVAL_1_DAY; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_1_WEEK_STR) == 0){ + interval_value = SYNC_INTERVAL_1_WEEK; + } else if (strcmp(interval_str,DEFINE_SYNC_INTERVAL_1_MONTH_STR) == 0){ + interval_value = SYNC_INTERVAL_1_MONTH; + } else { + _DEBUG_ERROR("interval_str is invalid!!"); + goto error; + } + + error: + + _INNER_FUNC_EXIT; + return interval_value; + +} + +static int _convert_src_uri_value(char* src_uri_str) +{ + _INNER_FUNC_ENTER; + _DEBUG_INFO("src_uri_str: [%s]", src_uri_str); + + int src_uri_value = 0; + + if (strcmp(src_uri_str,DEFINE_SOURCE_CONTACT_URI) == 0){ + src_uri_value = SRC_URI_CONTACT; + } else if (strcmp(src_uri_str,DEFINE_SOURCE_CALENDAR_URI) == 0){ + src_uri_value = SRC_URI_CALENDAR; + } else if (strcmp(src_uri_str,DEFINE_SOURCE_MEMO_URI) == 0){ + src_uri_value = SRC_URI_MEMO; + } else if (strcmp(src_uri_str,DEFINE_SOURCE_CALLLOG_URI) == 0){ + src_uri_value = SRC_URI_CALLLOG; + } else { + _DEBUG_ERROR("src_uri_str is invalid!!"); + goto error; + } + + error: + + _INNER_FUNC_EXIT; + return src_uri_value; + +} + se_error_type_e write_profile_data(int account_id, alert_type_e alert_type, sync_session_result_e sync_session_result, int last_session_time, int only_from_client) { _EXTERN_FUNC_ENTER; @@ -299,7 +421,7 @@ se_error_type_e write_sync_resource_info(int account_id, int content_type, int l return err; } -bool get_profile_data(int account_id, char **profile_name, char **addr, char **id, char **password, char **sync_mode, char **sync_type, char **interval, int *last_session_status, int *last_session_time) +bool get_profile_data(int account_id, char **profile_name, char **addr, char **id, char **password, int *sync_mode, int *sync_type, int *interval, int *last_session_status, int *last_session_time) { _EXTERN_FUNC_ENTER; @@ -311,6 +433,12 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i GList *iter = NULL; sync_agent_da_config_s *config_data = NULL; + char *sync_mode_str = NULL; + char *sync_type_str = NULL; + char *interval_str = NULL; + int sync_mode_value = 0; + int sync_type_value = 0; + int interval_value = 0; char *lastSessionStatus_str = NULL; char *lastSessionTime_str = NULL; @@ -367,21 +495,21 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_SYNC_MODE) == 0) { if (config_data->value != NULL) { - *sync_mode = strdup(config_data->value); + sync_mode_str = strdup(config_data->value); continue; } } if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_CLIENT_SYNC_TYPE) == 0) { if (config_data->value != NULL) { - *sync_type = strdup(config_data->value); + sync_type_str = strdup(config_data->value); continue; } } if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL) == 0) { if (config_data->value != NULL) { - *interval = strdup(config_data->value); + interval_str = strdup(config_data->value); continue; } } @@ -403,6 +531,24 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i } } + if (sync_mode_str != NULL) { + sync_mode_value = _convert_sync_mode_value(sync_mode_str); + _DEBUG_INFO("sync_mode_value: [%d]", sync_mode_value); + *sync_mode = sync_mode_value; + } + + if (sync_type_str != NULL) { + sync_type_value = _convert_sync_type_value(sync_type_str); + _DEBUG_INFO("sync_type_value: [%d]", sync_type_value); + *sync_type = sync_type_value; + } + + if (interval_str != NULL) { + interval_value = _convert_interval_value(interval_str); + _DEBUG_INFO("interval_value: [%d]", interval_value); + *interval = sync_type_value; + } + if (lastSessionStatus_str != NULL) *last_session_status = atoi(lastSessionStatus_str); @@ -417,11 +563,30 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i sync_agent_close_agent(); - if (lastSessionStatus_str != NULL) + if (sync_mode_str != NULL) { + free(sync_mode_str); + sync_mode_str = NULL; + } + + if (sync_type_str != NULL) { + free(sync_type_str); + sync_type_str = NULL; + } + + if (interval_str != NULL) { + free(interval_str); + interval_str = NULL; + } + + if (lastSessionStatus_str != NULL) { free(lastSessionStatus_str); + lastSessionStatus_str = NULL; + } - if (lastSessionTime_str != NULL) + if (lastSessionTime_str != NULL) { free(lastSessionTime_str); + lastSessionTime_str = NULL; + } _EXTERN_FUNC_EXIT; @@ -431,13 +596,15 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i return true; } -bool get_profile_sync_category(int account_id, int content_type, int *enabled, char **src_uri, char **tgt_uri, char **id, char **password) +bool get_profile_sync_category(int account_id, int content_type, int *enabled, int *src_uri, char **tgt_uri, char **id, char **password) { _EXTERN_FUNC_ENTER; se_error_type_e err = SE_INTERNAL_OK; char *datastore = NULL; char *enabled_str = NULL; + char *src_uri_str = NULL; + int src_uri_value = 0; char datastore_source[128]; char datastore_target[128]; @@ -494,7 +661,7 @@ bool get_profile_sync_category(int account_id, int content_type, int *enabled, c if (strcmp(config_data->key, datastore_source) == 0) { if (config_data->value != NULL) { - *src_uri = strdup(config_data->value); + src_uri_str = strdup(config_data->value); continue; } } @@ -526,14 +693,26 @@ bool get_profile_sync_category(int account_id, int content_type, int *enabled, c if (enabled_str != NULL) *enabled = atoi(enabled_str); + if (src_uri_str != NULL) { + src_uri_value = _convert_src_uri_value(src_uri_str); + *src_uri = src_uri_value; + } + error: sync_agent_free_config_list(config_list); sync_agent_close_agent(); - if (enabled_str != NULL) + if (enabled_str != NULL) { free(enabled_str); + enabled_str = NULL; + } + + if (src_uri_str != NULL) { + free(src_uri_str); + src_uri_str = NULL; + } _EXTERN_FUNC_EXIT; @@ -777,6 +956,14 @@ bool get_all_profiles_data(GList ** list) GList *free_iter = NULL; sync_agent_ds_service_info *category_info = NULL; + char* sync_mode_str = NULL; + char* sync_type_str = NULL; + char* interval_str = NULL; + char* src_uri_str = NULL; + int sync_mode_value = 0; + int sync_type_value = 0; + int interval_value = 0; + int src_uri_value = 0; sync_agent_da_return_e da_err = sync_agent_open_agent(); if (da_err != SYNC_AGENT_DA_SUCCESS) { @@ -847,21 +1034,30 @@ bool get_all_profiles_data(GList ** list) if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_SYNC_MODE) == 0) { if (config_data->value != NULL) { - sync_info->sync_mode = strdup(config_data->value); + sync_mode_str = strdup(config_data->value); + sync_mode_value = _convert_sync_mode_value(sync_mode_str); + _DEBUG_INFO("sync_mode_value: [%d]", sync_mode_value); + sync_info->sync_mode = sync_mode_value; continue; } } if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_CLIENT_SYNC_TYPE) == 0) { if (config_data->value != NULL) { - sync_info->sync_type = strdup(config_data->value); + sync_type_str = strdup(config_data->value); + sync_type_value = _convert_sync_type_value(sync_type_str); + _DEBUG_INFO("sync_type_value: [%d]", sync_type_value); + sync_info->sync_type = sync_type_value; continue; } } if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL) == 0) { if (config_data->value != NULL) { - sync_info->interval = strdup(config_data->value); + interval_str = strdup(config_data->value); + interval_value = _convert_interval_value(interval_str); + _DEBUG_INFO("interval_value: [%d]", interval_value); + sync_info->interval =interval_value; continue; } } @@ -932,7 +1128,10 @@ bool get_all_profiles_data(GList ** list) if (strcmp(config_data->key, datastore_source) == 0) { if (config_data->value != NULL) { - category_info->src_uri = strdup(config_data->value); + src_uri_str = strdup(config_data->value); + src_uri_value = _convert_src_uri_value(src_uri_str); + _DEBUG_INFO("src_uri_value: [%d]", src_uri_value); + category_info->src_uri = src_uri_value; continue; } } @@ -977,13 +1176,35 @@ bool get_all_profiles_data(GList ** list) error: + if (sync_mode_str != NULL) { + free(sync_mode_str); + sync_mode_str = NULL; + } + + if (sync_type_str != NULL) { + free(sync_type_str); + sync_type_str = NULL; + } + + if (interval_str != NULL) { + free(interval_str); + interval_str = NULL; + } + + if (src_uri_str != NULL) { + free(src_uri_str); + src_uri_str = NULL; + } + for (free_iter = account_list; free_iter != NULL; free_iter = g_list_next(free_iter)) { sync_agent_ds_free_profile_info((ds_profile_h) free_iter->data); _DEBUG_INFO("free sync_agent_ds_profile_info"); } - if (profile_info != NULL) + if (profile_info != NULL) { free(profile_info); + profile_info = NULL; + } sync_agent_free_fw_account_list(account_info_list); diff --git a/src/agent/service-engine/se_sync.c b/src/agent/service-engine/se_sync.c index c946921..367b89b 100755 --- a/src/agent/service-engine/se_sync.c +++ b/src/agent/service-engine/se_sync.c @@ -39,6 +39,8 @@ #define LOG_TAG "OMA_DS_SE" #endif +static int __convert_alert_to_sync_type_value(alert_type_e sync_type); +static int __convert_src_uri_value(char *src_uri); static se_error_type_e _session_process(int account_id, alert_type_e server_sync_type, sync_progress_e process, sync_error_e error); static se_error_type_e __process_update(int account_id, alert_type_e server_sync_type, sync_progress_status_e progress_status, operation_type_e operation_type, int content_type, bool is_from_server, bool need_to_save, sync_result_s * sync_result); static se_error_type_e _write_sync_data(int account_id, alert_type_e alert_type, sync_session_result_e sync_session_result, int last_session_time, int only_from_client); @@ -88,6 +90,64 @@ static inline long myclock() return (tv.tv_sec * 1000 + tv.tv_usec / 1000); } +static int __convert_alert_to_sync_type_value(alert_type_e sync_type) +{ + _INNER_FUNC_ENTER; + + int sync_type_value = 0; + _DEBUG_INFO("sync_type: [%d]", sync_type); + + switch (sync_type) { + case ALERT_TWO_WAY: + sync_type_value = SYNC_TYPE_UPDATE_BOTH; + break; + case ALERT_SLOW_SYNC: + sync_type_value = SYNC_TYPE_FULL_SYNC; + break; + case ALERT_ONE_WAY_FROM_CLIENT: + sync_type_value = SYNC_TYPE_UPDATE_TO_SERVER; + break; + case ALERT_REFRESH_FROM_CLIENT: + sync_type_value = SYNC_TYPE_REFRESH_FROM_PHONE; + break; + case ALERT_ONE_WAY_FROM_SERVER: + sync_type_value = SYNC_TYPE_UPDATE_TO_PHONE; + break; + case ALERT_REFRESH_FROM_SERVER: + sync_type_value = SYNC_TYPE_REFRESH_FROM_SERVER; + break; + default: + _DEBUG_ERROR("sync_type is invalid!!"); + break; + } + + _INNER_FUNC_EXIT; + return sync_type_value; +} + +static int __convert_src_uri_value(char *src_uri) +{ + _INNER_FUNC_ENTER; + + int src_uri_value = 0; + _DEBUG_INFO("src_uri: [%s]", src_uri); + + if (strcmp(src_uri,DEFINE_SOURCE_CONTACT_URI) == 0) { + src_uri_value = SRC_URI_CONTACT; + } else if (strcmp(src_uri,DEFINE_SOURCE_CALENDAR_URI)) { + src_uri_value = SRC_URI_CALENDAR; + } else if (strcmp(src_uri,DEFINE_SOURCE_MEMO_URI)) { + src_uri_value = SRC_URI_MEMO; + } else if (strcmp(src_uri,DEFINE_SOURCE_CALLLOG_URI)) { + src_uri_value = SRC_URI_CALLLOG; + } else { + _DEBUG_ERROR("src_uri is invalid!!"); + } + + _INNER_FUNC_EXIT; + return src_uri_value; +} + static se_error_type_e _session_process(int account_id, alert_type_e server_sync_type, sync_progress_e process, sync_error_e error) { _INNER_FUNC_ENTER; @@ -95,6 +155,7 @@ static se_error_type_e _session_process(int account_id, alert_type_e server_sync char *profileDirName = NULL; se_error_type_e err = SE_INTERNAL_OK; bool result; + int sync_type_value = 0; result = get_config(account_id, DEFINE_CONFIG_KEY_PROFILE_DIR_NAME, &profileDirName); if (result == false) { @@ -103,8 +164,11 @@ static se_error_type_e _session_process(int account_id, alert_type_e server_sync goto error; } + sync_type_value = __convert_alert_to_sync_type_value(server_sync_type); + _DEBUG_INFO("sync_type_value: [%d]", sync_type_value); + if (profileDirName != NULL) { - err = session_process(profileDirName, server_sync_type, process, error); + err = session_process(profileDirName, sync_type_value, process, error); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed to send noti"); goto error; @@ -112,8 +176,10 @@ static se_error_type_e _session_process(int account_id, alert_type_e server_sync } error: - if (profileDirName != NULL) + if (profileDirName != NULL) { free(profileDirName); + profileDirName = NULL; + } _INNER_FUNC_EXIT; @@ -133,6 +199,8 @@ static se_error_type_e __process_update(int account_id, alert_type_e server_sync char *sync_type = NULL; char *operation = NULL; char *progress = NULL; + int sync_type_value = 0; + int uri_value = 0; bool result; result = get_config(account_id, DEFINE_CONFIG_KEY_PROFILE_DIR_NAME, &profileDirName); @@ -157,6 +225,8 @@ static se_error_type_e __process_update(int account_id, alert_type_e server_sync } sync_type = __convert_sync_type_str(server_sync_type); + sync_type_value = __convert_alert_to_sync_type_value(server_sync_type); + _DEBUG_INFO("sync_type_value: [%d]", sync_type_value); progress = ___convert_sync_progress_status_str(progress_status); @@ -171,8 +241,15 @@ static se_error_type_e __process_update(int account_id, alert_type_e server_sync if (datastoreinfo_per_content_type[content_type]->source != NULL) uri = strdup(datastoreinfo_per_content_type[content_type]->source); } + if (uri != NULL) { + uri_value = __convert_src_uri_value(uri); + _DEBUG_INFO("uri_value: [%d]", uri_value); + } else { + _DEBUG_ERROR("uri is NULL!!"); + goto error; + } - err = send_noti_process_update(profileDirName, sync_type, uri, progress, operation, is_from_server, 0, 0, sync_result->number_of_change, sync_result->add_count + sync_result->replace_count + sync_result->delete_count); + err = send_noti_process_update(profileDirName, sync_type_value, uri_value, progress, operation, is_from_server, 0, 0, sync_result->number_of_change, sync_result->add_count + sync_result->replace_count + sync_result->delete_count); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed in send_noti_process_update"); goto error; @@ -965,7 +1042,7 @@ static se_error_type_e _assemble_changed_datastores(int account_id, alert_type_e /*_DEBUG_TRACE("sync_agent_refresh_item_tbl_from_service"); sync_agent_refresh_item_tbl_from_service(account_id, datastoreinfo_per_content_type[content_type]->plugin_type);*/ - /* Delete All item (include changelog), before adapting server item data… */ + /* Delete All item (include changelog), before adapting server item data */ _DEBUG_TRACE("sync_agent_begin_service = %d", datastoreinfo_per_content_type[content_type]->datastore_id); sync_agent_begin_service(datastoreinfo_per_content_type[content_type]->datastore_id); sync_agent_begin_transaction(); @@ -1072,7 +1149,16 @@ static se_error_type_e _assemble_changed_datastores(int account_id, alert_type_e } _DEBUG_TRACE("sync_agent_end_service = %d", datastoreinfo_per_content_type[content_type]->datastore_id); - sync_agent_end_service(datastoreinfo_per_content_type[content_type]->datastore_id, 1); + da_err = sync_agent_end_service(datastoreinfo_per_content_type[content_type]->datastore_id, 1); + if (da_err != SYNC_AGENT_DA_SUCCESS) { + + sync_agent_end_transaction(SYNC_AGENT_DA_TRANSACTION_COMMIT); + sync_agent_free_item_list(item_list); + + _DEBUG_ERROR("failed in sync_agent_end_service !!"); + err = SE_INTERNAL_DA_ERROR; + goto error; + } sync_agent_end_transaction(SYNC_AGENT_DA_TRANSACTION_COMMIT); sync_agent_free_item_list(item_list); } @@ -2416,6 +2502,9 @@ static char *_convert_sync_progress_str(sync_progress_e process) case PROGRESS_DONE: syncProcess = DEFINE_SYNC_DONE; break; + case PROGRESS_CANCEL: + syncProcess = DEFINE_SYNC_CANCEL; + break; case PROGRESS_ERROR: syncProcess = DEFINE_SYNC_ERROR; break; @@ -2775,7 +2864,7 @@ bool synchronize(int account_id, char *sync_mode, san_package_s * san_package) bool cancel_status = check_cancel_status(); if (cancel_status) { err = SE_INTERNAL_SUSPEND; - _DEBUG_INFO("cancle flag is on"); + _DEBUG_INFO("cancel_status is on"); goto suspend_part; } } else { @@ -2790,7 +2879,7 @@ bool synchronize(int account_id, char *sync_mode, san_package_s * san_package) bool cancel_status = check_cancel_status(); if (cancel_status) { err = SE_INTERNAL_SUSPEND; - _DEBUG_INFO("cancle flag is on"); + _DEBUG_INFO("cancel_status is on"); goto suspend_part; } } @@ -2838,8 +2927,10 @@ bool synchronize(int account_id, char *sync_mode, san_package_s * san_package) suspend_part: errorCode = suspend_sync(TRANSPORT_TYPE, account_id, server_flag); + if (errorCode != COMMON_OK) { - _DEBUG_ERROR("Failed in suspend_sync = %d", errorCode); + _DEBUG_ERROR("failed in suspend_sync = %d",errorCode); + err = SE_INTERNAL_SA_ERROR; if (errorCode == COMMON_SUSPEND_FAIL) _off_resume_flag(account_id); @@ -2968,8 +3059,6 @@ void convert_common_errorcode(common_error_type_e errorCode, sync_progress_e * p _EXTERN_FUNC_ENTER; switch (errorCode) { - case COMMON_CANCEL: - case COMMON_SUSPEND_FAIL: case COMMON_OK: /*ERROR_INTERNAL_OK */ { /* Do nothing : Error None @@ -2982,6 +3071,13 @@ void convert_common_errorcode(common_error_type_e errorCode, sync_progress_e * p *error = ERROR_NONE; } break; + case COMMON_SUSPEND_FAIL: + case COMMON_CANCEL: + { + *process = PROGRESS_CANCEL; + *error = ERROR_NONE; + } + break; case COMMON_MISCONFIGURATION: /*ERROR_INTERNAL_MISCONFIGURATION : need configure infomation (account_id, id, pw, server_url...) */ { *process = PROGRESS_ERROR; @@ -3046,12 +3142,15 @@ void convert_engine_errorcode(se_error_type_e err, sync_progress_e * process, sy _EXTERN_FUNC_ENTER; switch (err) { - case SE_INTERNAL_SUSPEND: - case SE_INTERNAL_CANCEL: case SE_INTERNAL_OK: *process = PROGRESS_DONE; *error = ERROR_NONE; break; + case SE_INTERNAL_SUSPEND: + case SE_INTERNAL_CANCEL: + *process = PROGRESS_CANCEL; + *error = ERROR_NONE; + break; case ERROR_UNKNOWN: case SE_INTERNAL_SA_ERROR: case SE_INTERNAL_SCHEDULER_ERROR: @@ -3096,8 +3195,11 @@ se_error_type_e session_process(char *profileDirName, alert_type_e server_sync_t char *sync_type = NULL; char *syncProcess = NULL; char *syncError = NULL; + int sync_type_value = 0; sync_type = __convert_sync_type_str(server_sync_type); + sync_type_value = __convert_alert_to_sync_type_value(server_sync_type); + _DEBUG_INFO("sync_type_value: [%d]", sync_type_value); syncProcess = _convert_sync_progress_str(process); @@ -3108,7 +3210,7 @@ se_error_type_e session_process(char *profileDirName, alert_type_e server_sync_t goto error; } - err = send_noti_session_process(profileDirName, sync_type, syncProcess, syncError); + err = send_noti_session_process(profileDirName, sync_type_value, syncProcess, syncError); if (err != SE_INTERNAL_OK) { _DEBUG_ERROR("failed in send_noti_session_process"); goto error; diff --git a/src/plugins/ds-public/vcard/src/plugin_interface.c b/src/plugins/ds-public/vcard/src/plugin_interface.c index 5131f38..1f22810 100755 --- a/src/plugins/ds-public/vcard/src/plugin_interface.c +++ b/src/plugins/ds-public/vcard/src/plugin_interface.c @@ -749,9 +749,10 @@ static int _contacts_vcard_get_content(const char *vcard_stream, const char *con cursor++; } len = cursor - found; - if (len < buf_size) - memcpy(value, found, len); - else { + if (len < buf_size) { + if(value) + memcpy(value, found, len); + } else { value = realloc(value, len + 1); if (value) { buf_size = len + 1; @@ -761,13 +762,17 @@ static int _contacts_vcard_get_content(const char *vcard_stream, const char *con continue; } } - value[len] = '\0'; - if (fn) + + if (value) + value[len] = '\0'; + + if (fn) { if (fn(value + type_len + 1, data)) { free(value); _INNER_FUNC_EXIT; return 0; } + } vcard_stream = found + type_len; } diff --git a/src/plugins/ds-public/xcalllog/src/plugin_interface.c b/src/plugins/ds-public/xcalllog/src/plugin_interface.c index 3ba4c05..b2c6889 100755 --- a/src/plugins/ds-public/xcalllog/src/plugin_interface.c +++ b/src/plugins/ds-public/xcalllog/src/plugin_interface.c @@ -187,6 +187,7 @@ static sync_agent_da_return_e _get_calllog_name(int contact_id, char **name) // } else // name = 0; +/* sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS; contacts_error_e err = CONTACTS_ERROR_NONE; contacts_record_h record = NULL; @@ -212,6 +213,103 @@ static sync_agent_da_return_e _get_calllog_name(int contact_id, char **name) _INNER_FUNC_EXIT; return ret; +*/ +//////////////////////////////////////////////////////////////////////////////////// + + sync_agent_da_return_e ret = SYNC_AGENT_DA_SUCCESS; + contacts_error_e err = CONTACTS_ERROR_NONE; + contacts_record_h record = NULL; + + contacts_query_h query = NULL; + contacts_filter_h filter = NULL; + contacts_list_h list = NULL; + int count = 0; + + if (contact_id != 0) { + err = contacts_query_create(_contacts_person_phone_log._uri, &query); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_query_create Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_filter_create(_contacts_person_phone_log._uri, &filter); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_filter_create Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_filter_add_int(filter, _contacts_person_phone_log.person_id, CONTACTS_MATCH_EQUAL, contact_id /* person_id */ ); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_filter_set_int Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_query_set_filter(query, filter); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_query_set_filter Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_db_get_count_with_query(query, &count); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_db_get_count_with_query Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + _DEBUG_INFO("count = %d", count); + + if( count > 0 ) { + err = contacts_db_get_records_with_query(query, 0, 1, &list); + if (err == CONTACTS_ERROR_NONE) { + _DEBUG_INFO("[da_xcalllog_plugIn] contacts_db_get_records_with_query Success!! \n"); + + err = contacts_list_first(list); + if(err == CONTACTS_ERROR_NONE) { + err = contacts_list_get_current_record_p(list, &record); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_list_get_current_record_p Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } + + err = contacts_record_get_str(record, _contacts_person_phone_log.display_name, name); + if (err != CONTACTS_ERROR_NONE) { + _DEBUG_ERROR("[da_xcalllog_plugIn] contacts_record_get_str Fail\n"); + ret = _convert_service_error_to_common_error(err); + goto GET_FINISH; + } else { + _DEBUG_INFO("[da_xcalllog_plugIn] contacts_record_get_str Success !! \n"); + } + } + } + + } else { + name = 0; + } + } + + contacts_query_destroy(query); + contacts_filter_destroy(filter); + contacts_list_destroy(list, true); + + _INNER_FUNC_EXIT; + return ret; + + + GET_FINISH: + + contacts_query_destroy(query); + contacts_filter_destroy(filter); + contacts_list_destroy(list, true); + + *name = 0; + _EXTERN_FUNC_EXIT; + return ret; + } static char *_calllog_put_content(char *vcard_stream, char *content_type, char *content_value)