/* * oma-ds-agent * Copyright (c) 2012 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @SE_Notification.c * @version 0.1 * @brief This file is the source file of implementation of notify to ui */ #include #include #include "service-engine/se_notification.h" #include "service-engine/se_sync.h" #ifndef OMADS_AGENT_LOG #undef LOG_TAG #define LOG_TAG "OMA_DS_SE" #endif #define NOTI_KEY "OMADS" #define OMA_DS_UI_PKG "ug-setting-synchronise-efl" se_error_type_e send_noti_session_process(char *profile, int sync_type, char *progress, char *error) { _EXTERN_FUNC_ENTER; se_error_type_e err = SE_INTERNAL_OK; int notiType = 1; sync_agent_event_data_s *noti = NULL; if (profile == NULL) { _DEBUG_ERROR("Not Defined profile"); err = SE_INTERNAL_NOT_DEFINED; goto error; } noti = sync_agent_create_noti(notiType); if (noti == NULL) { _DEBUG_ERROR("failed to sync_agent_create_noti"); err = SE_INTERNAL_NO_MEMORY; goto error; } 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_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); sync_agent_event_error_e event_err; sync_agent_send_noti(NOTI_KEY, noti, NULL, NULL, &event_err); if (event_err != SYNC_AGENT_EVENT_SUCCESS) { if (aul_app_is_running(OMA_DS_UI_PKG)) { _DEBUG_ERROR("failed to sync_agent_send_noti"); err = SE_INTERNAL_EVENT_ERROR; goto error; } } error: sync_agent_free_noti(noti); _EXTERN_FUNC_EXIT; return err; } 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; se_error_type_e err = SE_INTERNAL_OK; int notiType = 2; sync_agent_event_data_s *noti = NULL; if (profile_dir_name == NULL) { _DEBUG_ERROR("Not Defined profileDirName"); err = SE_INTERNAL_NOT_DEFINED; goto error; } noti = sync_agent_create_noti(notiType); if (noti == NULL) { _DEBUG_ERROR("failed to sync_agent_create_noti"); err = SE_INTERNAL_NO_MEMORY; goto error; } 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_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); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &total_per_operation); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &synced_per_operation); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &total_per_db); sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &synced_per_db); sync_agent_event_error_e event_err; sync_agent_send_noti(NOTI_KEY, noti, NULL, NULL, &event_err); if (event_err != SYNC_AGENT_EVENT_SUCCESS) { if (aul_app_is_running(OMA_DS_UI_PKG)) { _DEBUG_ERROR("failed to sync_agent_send_noti"); err = SE_INTERNAL_EVENT_ERROR; goto error; } } error: sync_agent_free_noti(noti); _EXTERN_FUNC_EXIT; return err; }