diff options
author | sanghyuk Ko <sanghyuk.ko@samsung.com> | 2013-03-20 17:35:56 +0900 |
---|---|---|
committer | sanghyuk Ko <sanghyuk.ko@samsung.com> | 2013-03-20 17:35:56 +0900 |
commit | bbae7d1b2a06e46d75c6673b2c67badee42bbdd7 (patch) | |
tree | 703bd1a017de95aaf702cc1eb229779febfccfd0 | |
parent | 2928ee51d097094087c5a6445bea90840f6f1db6 (diff) | |
download | oma-ds-agent-bbae7d1b2a06e46d75c6673b2c67badee42bbdd7.tar.gz oma-ds-agent-bbae7d1b2a06e46d75c6673b2c67badee42bbdd7.tar.bz2 oma-ds-agent-bbae7d1b2a06e46d75c6673b2c67badee42bbdd7.zip |
[Internal: API change] When profile gets, input param changed.
[Problem]
-
[Cause]
-
[Solution]
- When profile gets, input param changed.
Change-Id: Ia6bd333d985c7a400b630cc7d069ad4d5ff56d44
-rwxr-xr-x | include/common/common_define_internal.h | 18 | ||||
-rwxr-xr-x | include/service-engine/se_storage.h | 2 | ||||
-rwxr-xr-x | src/agent/framework/event/oma_ds_event_handler.c | 41 | ||||
-rwxr-xr-x | src/agent/framework/task/oma_ds_engine_controller_task.c | 51 | ||||
-rwxr-xr-x | src/agent/service-engine/se_account.c | 65 | ||||
-rwxr-xr-x | src/agent/service-engine/se_storage.c | 21 |
6 files changed, 101 insertions, 97 deletions
diff --git a/include/common/common_define_internal.h b/include/common/common_define_internal.h index 4c1ed97..75075e7 100755 --- a/include/common/common_define_internal.h +++ b/include/common/common_define_internal.h @@ -69,6 +69,7 @@ #define DEFINE_ALERT_REFRESH_FROM_SERVER_VALUE "205" #define DEFINE_ALERT_REFRESH_FROM_CLIENT_VALUE "203" +#define DEFINE_CONFIG_KEY_PROFILE_ID "Profile_id" #define DEFINE_CONFIG_KEY_PROFILE_SERVER_ID "Server_id" #define DEFINE_CONFIG_KEY_PROFILE_SYNC_MODE "Sync_mode" #define DEFINE_CONFIG_KEY_PROFILE_SERVER_IP "Server_ip" @@ -185,14 +186,15 @@ typedef enum { }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_NONE = 0, /**< None */ + SYNC_INTERVAL_5_MINUTES = 1, /**< 5 minutes */ + SYNC_INTERVAL_15_MINUTES = 2, /**< 15 minutes */ + SYNC_INTERVAL_1_HOUR = 3, /**< 1 hour */ + SYNC_INTERVAL_4_HOURS = 4, /**< 4 hours */ + SYNC_INTERVAL_12_HOURS = 5, /**< 12 hours */ + SYNC_INTERVAL_1_DAY = 6, /**< 1 day */ + SYNC_INTERVAL_1_WEEK = 7, /**< 1 week */ + SYNC_INTERVAL_1_MONTH = 8 /**< 1 month */ } sync_interval_e; typedef enum { diff --git a/include/service-engine/se_storage.h b/include/service-engine/se_storage.h index 5b29611..697edc7 100755 --- a/include/service-engine/se_storage.h +++ b/include/service-engine/se_storage.h @@ -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, int *sync_mode, int *sync_type, int *interval, int *last_session_status, int *last_session_time); +bool get_profile_data(int account_id, char **profile_dir_name, 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 diff --git a/src/agent/framework/event/oma_ds_event_handler.c b/src/agent/framework/event/oma_ds_event_handler.c index 94eeb97..853536f 100755 --- a/src/agent/framework/event/oma_ds_event_handler.c +++ b/src/agent/framework/event/oma_ds_event_handler.c @@ -433,7 +433,9 @@ int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync _EXTERN_FUNC_ENTER; int result = 0; - char *profile = NULL; + int profile_id = 0; + //char *profile = NULL; + char *profile_dir_name = NULL; char *profile_name = NULL; char *addr = NULL; char *id = NULL; @@ -444,19 +446,19 @@ int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync int last_session_status = 0; int last_session_time = 0; - sync_agent_get_event_data_param_str(request, &profile); - if (profile == NULL) { - _DEBUG_ERROR("profile is not defined"); + sync_agent_get_event_data_param_int(request, &profile_id); + if (profile_id < 1) { + _DEBUG_ERROR("profile_id is invalid!!"); result = 0; goto error; } - _DEBUG_INFO("request param : %s", profile); + _DEBUG_INFO("request param : %d", profile_id); - int account_id = get_account_id(profile, false); + //int account_id = get_account_id(profile, false); int in_param_index_array[1] = { 0 }; - void *in_param_value_array[1] = { &account_id }; + void *in_param_value_array[1] = { &profile_id }; sync_agent_ec_value_type_e in_param_value_type_array[1] = { SYNC_AGENT_EC_VALUE_TYPE_INT }; unsigned int out_param_count; @@ -467,19 +469,21 @@ int event_callback_get_profile_data_sync(sync_agent_event_data_s * request, sync sync_agent_request_sync_task(EC_MSG_TYPE_SYNC_TASK_GET_PROFILE_DATA, 0, 1, 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_STRUCT, &profile_name); - 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_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); + sync_agent_get_param_value(&(param_array[1]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profile_dir_name); + sync_agent_get_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profile_name); + sync_agent_get_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); + 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); + sync_agent_get_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &sync_mode); + sync_agent_get_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &sync_type); + sync_agent_get_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &interval); + sync_agent_get_param_value(&(param_array[9]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &last_session_status); + sync_agent_get_param_value(&(param_array[10]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &last_session_time); error: 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_STRING, (void *)profile_dir_name); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_name); 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); @@ -489,12 +493,12 @@ 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_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) { free(profile); profile = NULL; } - +*/ _EXTERN_FUNC_EXIT; return 0; } @@ -842,6 +846,7 @@ int event_callback_request_get_all_profiles_data(sync_agent_event_data_s * reque sync_agent_ds_server_info *server_info = &profile_info->server_info; sync_agent_ds_sync_info *sync_info = &profile_info->sync_info; + sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &profile_info->profile_id); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_info->profile_dir_name); sync_agent_append_event_data_param(response, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_info->profile_name); 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 6638e65..5d5e881 100755 --- a/src/agent/framework/task/oma_ds_engine_controller_task.c +++ b/src/agent/framework/task/oma_ds_engine_controller_task.c @@ -290,28 +290,30 @@ sync_agent_ec_task_spec_s *make_get_profile_data_task() 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, + sync_agent_ec_param_spec_s *pParam_spec3 = sync_agent_alloc_param_spec_structure("profile_dir_name", _string_copy_struct, free, false, true, false, NULL, false, NULL, false, NULL); - sync_agent_ec_param_spec_s *pParam_spec4 = sync_agent_alloc_param_spec_structure("addr", _string_copy_struct, free, + sync_agent_ec_param_spec_s *pParam_spec4 = sync_agent_alloc_param_spec_structure("profile_name", _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_structure("id", _string_copy_struct, free, + sync_agent_ec_param_spec_s *pParam_spec5 = sync_agent_alloc_param_spec_structure("addr", _string_copy_struct, free, 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, + sync_agent_ec_param_spec_s *pParam_spec6 = sync_agent_alloc_param_spec_structure("id", _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); + sync_agent_ec_param_spec_s *pParam_spec7 = 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_spec8 = sync_agent_alloc_param_spec_int("syncMode", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec9 = sync_agent_alloc_param_spec_int("syncType", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec10 = sync_agent_alloc_param_spec_int("interval", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec11 = sync_agent_alloc_param_spec_int("lastSessionStatus", false, true, false, 0, 0, false, 0, false, 0, 0); + sync_agent_ec_param_spec_s *pParam_spec12 = sync_agent_alloc_param_spec_int("lastSessionTime", 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, + sync_agent_ec_param_spec_s *param_spec_array[12] = { pParam_spec1, pParam_spec2, pParam_spec3, pParam_spec4, pParam_spec5, pParam_spec6, pParam_spec7, pParam_spec8, - pParam_spec9, pParam_spec10, pParam_spec11 + pParam_spec9, pParam_spec10, pParam_spec11, pParam_spec12 }; sync_agent_ec_task_spec_s *pTask_spec = sync_agent_alloc_simple_task_spec("get_profile_data", get_profile_data_task_process, NULL, NULL, - 11, param_spec_array); + 12, param_spec_array); sync_agent_unref_param_spec(pParam_spec1); sync_agent_unref_param_spec(pParam_spec2); @@ -324,6 +326,7 @@ sync_agent_ec_task_spec_s *make_get_profile_data_task() sync_agent_unref_param_spec(pParam_spec9); sync_agent_unref_param_spec(pParam_spec10); sync_agent_unref_param_spec(pParam_spec11); + sync_agent_unref_param_spec(pParam_spec12); _EXTERN_FUNC_EXIT; return pTask_spec; @@ -679,6 +682,7 @@ sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, sync_agent_ec_task_error_e err = SYNC_AGENT_EC_TASK_ERROR_RUN_SUCCESS; int accountId = 0; + char *profile_dir_name = NULL; char *profileName = NULL; char *addr = NULL; char *id = NULL; @@ -692,9 +696,9 @@ sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, bool res; 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); + retvm_if(accountId < 1, SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED, "account id = %d", accountId); - res = get_profile_data(accountId, &profileName, &addr, &id, &password, &sync_mode, &syncType, &interval, &lastSessionStatus, &lastSessionTime); + res = get_profile_data(accountId, &profile_dir_name, &profileName, &addr, &id, &password, &sync_mode, &syncType, &interval, &lastSessionStatus, &lastSessionTime); if (res == false) { err = SYNC_AGENT_EC_TASK_ERROR_RUN_FAILED; result = 0; @@ -702,15 +706,16 @@ sync_agent_ec_task_error_e get_profile_data_task_process(unsigned int param_cnt, result = 1; sync_agent_set_param_value(&(param_array[1]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &result); - sync_agent_set_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profileName); - 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_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); + sync_agent_set_param_value(&(param_array[2]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profile_dir_name); + sync_agent_set_param_value(&(param_array[3]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &profileName); + sync_agent_set_param_value(&(param_array[4]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &addr); + sync_agent_set_param_value(&(param_array[5]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &id); + sync_agent_set_param_value(&(param_array[6]->param_value), SYNC_AGENT_EC_VALUE_TYPE_STRUCT, &password); + sync_agent_set_param_value(&(param_array[7]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &sync_mode); + sync_agent_set_param_value(&(param_array[8]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &syncType); + sync_agent_set_param_value(&(param_array[9]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &interval); + sync_agent_set_param_value(&(param_array[10]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &lastSessionStatus); + sync_agent_set_param_value(&(param_array[11]->param_value), SYNC_AGENT_EC_VALUE_TYPE_INT, &lastSessionTime); _EXTERN_FUNC_EXIT; return err; diff --git a/src/agent/service-engine/se_account.c b/src/agent/service-engine/se_account.c index b1608d8..474672a 100755 --- a/src/agent/service-engine/se_account.c +++ b/src/agent/service-engine/se_account.c @@ -221,7 +221,7 @@ static se_error_type_e _add_profile(char *addr, char *id, char *password, char * sync_agent_acc_error_e account_err = SYNC_AGENT_ACC_SUCCESS; sync_agent_fw_account_s *fw_account = NULL; - int account; + int account = -1; char *folderID = NULL; account_err = sync_agent_create_fw_account(&fw_account); @@ -341,6 +341,7 @@ static se_error_type_e _add_profile(char *addr, char *id, char *password, char * new_folder_id = NULL; } + // call log folder ID folderID = sync_agent_generate_folder_luid(); if (folderID == NULL) { _DEBUG_ERROR("failed in sync_agent_generate_folder_luid"); @@ -356,7 +357,7 @@ static se_error_type_e _add_profile(char *addr, char *id, char *password, char * folder->account_id = account; folder->folder_id = strdup(folderID); - folder->data_store_id = TYPE_MEMO; + folder->data_store_id = TYPE_CALLLOG; folder->folder_type_id = 0; /* Default contacts folder */ folder->parent_folder_id = NULL; folder->service_id = strdup("0"); @@ -385,40 +386,9 @@ static se_error_type_e _add_profile(char *addr, char *id, char *password, char * new_folder_id = NULL; } - /* call log folder ID */ - folderID = sync_agent_generate_folder_luid(); - if (folderID == NULL) { - _DEBUG_ERROR("failed in sync_agent_generate_folder_luid"); - err = SE_INTERNAL_DA_ERROR; - goto error; - } - - ret = sync_agent_create_folder(&folder); - if (ret != SYNC_AGENT_DA_SUCCESS) { - _DEBUG_ERROR("sync_agent_create_folder() failed !!"); - goto error; - } - - folder->account_id = account; - folder->folder_id = strdup(folderID); - folder->data_store_id = TYPE_CALLLOG; - folder->folder_type_id = 0; /* Default contacts folder */ - folder->parent_folder_id = NULL; - folder->service_id = strdup("0"); - folder->access_name = strdup("EventHandler"); - - ret = sync_agent_add_folder(folder, &new_folder_id); - sync_agent_free_folder(folder); - folder = NULL; - - if (ret != SYNC_AGENT_DA_SUCCESS) { - _DEBUG_ERROR("Agent Add_Folder Failed_In sync_agent_add_account()!"); - _DEBUG_ERROR("[process_Event_Add_Account] Agent Add_Folder Failed_In sync_agent_add_account()!"); - err = SE_INTERNAL_ERROR; - goto error; - } + *account_id = account; - _DEBUG_TRACE("[process_Event_Add_Account] Successed Agent Add_Folder in sync_agent_add_account(), added Folder ID : %s", new_folder_id); + error: if (folderID != NULL) { free(folderID); @@ -430,13 +400,6 @@ static se_error_type_e _add_profile(char *addr, char *id, char *password, char * new_folder_id = NULL; } - *account_id = account; - - error: - - if (folderID != NULL) - free(folderID); - sync_agent_free_fw_account(fw_account); _INNER_FUNC_EXIT; @@ -635,7 +598,11 @@ static se_error_type_e _set_periodic_sync_config(int account_id, char *sync_mode alarm_info->start_alarm_time = g_strdup_printf("%.2d-%.2d-%.2dT%.2d:%.2d:%.2dZ", struct_time->tm_year + 1900, struct_time->tm_mon + 1, struct_time->tm_mday, struct_time->tm_hour, struct_time->tm_min, struct_time->tm_sec); alarm_info->is_disposable = 0; - if (strcmp(interval, "5 minutes") == 0) { + if (strcmp(interval, "None") == 0) { + _DEBUG_ERROR("interval is none!!"); + err = SE_INTERNAL_DA_ERROR; + goto error; + } else if (strcmp(interval, "5 minutes") == 0) { _DEBUG_TRACE("5 minutes"); alarm_info->repeat_type = REPEAT; alarm_info->repeat_value = 5 * 60; @@ -720,6 +687,15 @@ static se_error_type_e _set_profile_info_into_config_list(int account_id, char * se_error_type_e err = SE_INTERNAL_OK; bool result; + char *account_id_str = NULL; + + account_id_str = g_strdup_printf("%u", account_id); + result = ___append_config_value(account_id, DEFINE_CONFIG_KEY_PROFILE_ID, account_id_str, "int", "SE", config_list); + if (result == false) { + _DEBUG_ERROR("failed in _append_config_value"); + err = SE_INTERNAL_DA_ERROR; + goto error; + } result = ___append_config_value(account_id, DEFINE_CONFIG_KEY_PROFILE_DIR_NAME, profile_dir_name, "string", "SE", config_list); if (result == false) { @@ -763,7 +739,8 @@ static se_error_type_e _set_profile_info_into_config_list(int account_id, char * goto error; } - result = ___append_config_value(account_id, DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL, interval != NULL ? interval : "5 minutes", "string", "SE", config_list); + //result = ___append_config_value(account_id, DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL, interval != NULL ? interval : "5 minutes", "string", "SE", config_list); + result = ___append_config_value(account_id, DEFINE_CONFIG_KEY_PROFILE_SYNC_INTERVAL, interval, "string", "SE", config_list); if (result == false) { _DEBUG_ERROR("failed in _append_config_value"); err = SE_INTERNAL_DA_ERROR; diff --git a/src/agent/service-engine/se_storage.c b/src/agent/service-engine/se_storage.c index e204715..42efcff 100755 --- a/src/agent/service-engine/se_storage.c +++ b/src/agent/service-engine/se_storage.c @@ -193,7 +193,7 @@ static int _convert_interval_value(char* interval_str) } 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!!"); + interval_value = SYNC_INTERVAL_NONE; goto error; } @@ -421,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, int *sync_mode, int *sync_type, int *interval, int *last_session_status, int *last_session_time) +bool get_profile_data(int account_id, char **profile_dir_name, 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; @@ -479,6 +479,14 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i if (config_data != NULL) { if (config_data->key != NULL) { + + if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_DIR_NAME) == 0) { + if (config_data->value != NULL) { + *profile_dir_name = strdup(config_data->value); + continue; + } + } + if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_NAME) == 0) { if (config_data->value != NULL) { *profile_name = strdup(config_data->value); @@ -546,7 +554,7 @@ bool get_profile_data(int account_id, char **profile_name, char **addr, char **i if (interval_str != NULL) { interval_value = _convert_interval_value(interval_str); _DEBUG_INFO("interval_value: [%d]", interval_value); - *interval = sync_type_value; + *interval = interval_value; } if (lastSessionStatus_str != NULL) @@ -1011,6 +1019,13 @@ bool get_all_profiles_data(GList ** list) if (config_data != NULL) { if (config_data->key != NULL) { + if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_ID) == 0) { + if (config_data->value != NULL) { + profile_info->profile_id = atoi(config_data->value); + continue; + } + } + if (strcmp(config_data->key, DEFINE_CONFIG_KEY_PROFILE_DIR_NAME) == 0) { if (config_data->value != NULL) { profile_info->profile_dir_name = strdup(config_data->value); |