diff options
Diffstat (limited to 'src/agent/framework')
-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 |
2 files changed, 51 insertions, 41 deletions
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; |