[Internal: Function add] sync_profile_id set/get.
authorsanghyuk Ko <sanghyuk.ko@samsung.com>
Wed, 3 Jul 2013 14:14:13 +0000 (23:14 +0900)
committersanghyuk Ko <sanghyuk.ko@samsung.com>
Wed, 3 Jul 2013 14:14:13 +0000 (23:14 +0900)
[Problem]
-
[Cause]
-
[Solution]
-

Change-Id: I3c37badc6aeb6bb0d441b2a3382af668a3c3608a

include/service-engine/se_sync.h
src/agent/framework/task/oma_ds_engine_controller_task.c
src/agent/service-engine/se_sync.c

index 7f63c5c..cc44d1f 100755 (executable)
@@ -231,4 +231,50 @@ bool refresh_from_service_all(int account_id);
  */
 se_error_type_e cancel_sync_request();
 
+/**
+ * @par Description: API to set profile_id during sync session
+ *
+ * @par Purpose:
+ * @par Typical use case:
+ * @par Method of function operation:
+ * @par Important notes:
+ *
+ * @return
+ *
+ * @par Errors:
+ *
+ * @pre None.
+ * @post
+ * @see
+ * @remarks None.
+ *
+ * @par Sample Code:
+ * @code
+ * @endcode
+ */
+se_error_type_e set_sync_profile_id(int profile_id);
+
+/**
+ * @par Description: API to get profile_id during sync session
+ *
+ * @par Purpose:
+ * @par Typical use case:
+ * @par Method of function operation:
+ * @par Important notes:
+ *
+ * @return                     integer type    profile_id
+ *
+ * @par Errors:
+ *
+ * @pre None.
+ * @post
+ * @see
+ * @remarks None.
+ *
+ * @par Sample Code:
+ * @code
+ * @endcode
+ */
+se_error_type_e get_sync_profile_id(int *profile_id);
+
 #endif                         /* SYNCENGINE_H_ */
index a68bee5..cf609c1 100755 (executable)
@@ -1061,7 +1061,9 @@ bool get_synchronizing_profile_id(int *pProfile_id)
 {
        _EXTERN_FUNC_ENTER;
 
-       bool success = false;
+       se_error_type_e err = SE_INTERNAL_OK;
+       bool success = true;
+/*
        request_msg_info_t *pMsg_info = NULL;
        GList *iter = NULL;
 
@@ -1070,6 +1072,7 @@ bool get_synchronizing_profile_id(int *pProfile_id)
 
                if (pMsg_info->sync_type == SYNC_MODE_MANUAL || pMsg_info->sync_type == SYNC_MODE_PERIODIC || pMsg_info->sync_type == SYNC_MODE_SAN) {
                        success = true;
+                       _DEBUG_INFO("profile_id : [%d]", pMsg_info->profile_id);
                        *pProfile_id = pMsg_info->profile_id;
 
                        sync_request_id_list = g_list_first(sync_request_id_list);
@@ -1078,6 +1081,12 @@ bool get_synchronizing_profile_id(int *pProfile_id)
                }
        }
 
+*/
+       err = get_sync_profile_id(pProfile_id);
+       if (err != SE_INTERNAL_OK) {
+               _DEBUG_ERROR("get_sync_profile_id failed!!");
+       }
+
        _EXTERN_FUNC_EXIT;
        return success;
 }
index a50098d..6d91d24 100755 (executable)
@@ -83,6 +83,8 @@ static se_error_type_e _check_low_battery();
 static se_error_type_e _open_services();
 static se_error_type_e _close_services();
 
+static int sync_profile_id = 0;
+
 static inline long myclock()
 {
        struct timeval tv;
@@ -2691,6 +2693,11 @@ bool synchronize(int account_id, char *sync_mode, san_package_s * san_package)
        alert_type_e server_sync_type = ALERT_UNKNOWN;
        int only_from_client = 0;
 
+       err = set_sync_profile_id(account_id);
+       if (err != SE_INTERNAL_OK) {
+               _DEBUG_ERROR("set_sync_profile_id failed!!");
+       }
+
        int session_time = sync_agent_convert_seconds_to_utc(time(NULL));       /*lastSessionTime for resultView; */
        _DEBUG_INFO("session_time = %d", session_time);
 
@@ -3001,6 +3008,11 @@ bool synchronize(int account_id, char *sync_mode, san_package_s * san_package)
 
        _off_synchronising_account(account_id);
 
+       err = set_sync_profile_id(0);
+       if (err != SE_INTERNAL_OK) {
+               _DEBUG_ERROR("set_sync_profile_id failed!!");
+       }
+
        _session_process(account_id, server_sync_type, process, error);
        _DEBUG_INFO("server_sync_type = %d", server_sync_type);
        _DEBUG_INFO("process = %d", process);
@@ -3304,7 +3316,7 @@ bool refresh_from_service_all(int account_id)
 {
        _EXTERN_FUNC_ENTER;
 
-       if (account_id < 1) {\r
+       if (account_id < 1) {
                _DEBUG_ERROR("account_id is invalid!!");
                return false;
        } else {
@@ -3361,3 +3373,31 @@ se_error_type_e cancel_sync_request()
 
        return err;
 }
+
+se_error_type_e set_sync_profile_id(int profile_id)
+{
+       _EXTERN_FUNC_ENTER;
+
+       se_error_type_e err = SE_INTERNAL_OK;
+
+       _DEBUG_INFO("profile_id : [%d]", profile_id);
+       sync_profile_id = profile_id;
+
+       _EXTERN_FUNC_EXIT;
+
+       return err;
+}
+
+se_error_type_e get_sync_profile_id(int *profile_id)
+{
+       _EXTERN_FUNC_ENTER;
+
+       se_error_type_e err = SE_INTERNAL_OK;
+
+       _DEBUG_INFO("sync_profile_id : [%d]", sync_profile_id);
+       *profile_id = sync_profile_id;
+
+       _EXTERN_FUNC_EXIT;
+
+       return err;
+}
\ No newline at end of file