3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 * @brief This file is the source file of implementation of notify to ui
26 #include <sync_agent.h>
28 #include "service-engine/se_notification.h"
29 #include "service-engine/se_sync.h"
31 #ifndef OMADS_AGENT_LOG
33 #define LOG_TAG "OMA_DS_SE"
36 #define NOTI_KEY "OMADS"
37 #define OMA_DS_UI_PKG "ug-setting-synchronise-efl"
39 se_error_type_e send_noti_session_process(char *profile, char *sync_type, char *progress, char *error)
43 se_error_type_e err = SE_INTERNAL_OK;
46 sync_agent_event_data_s *noti = NULL;
48 if (profile == NULL) {
49 _DEBUG_ERROR("Not Defined profile");
50 err = SE_INTERNAL_NOT_DEFINED;
54 noti = sync_agent_create_noti(notiType);
56 _DEBUG_ERROR("failed to sync_agent_create_noti");
57 err = SE_INTERNAL_NO_MEMORY;
61 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile);
62 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type);
63 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)progress);
64 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)error);
66 sync_agent_event_error_e event_err;
67 sync_agent_send_noti(NOTI_KEY, noti, NULL, NULL, &event_err);
68 if (event_err != SYNC_AGENT_EVENT_SUCCESS) {
69 if (aul_app_is_running(OMA_DS_UI_PKG)) {
70 _DEBUG_ERROR("failed to sync_agent_send_noti");
71 err = SE_INTERNAL_EVENT_ERROR;
78 sync_agent_free_noti(noti);
84 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)
88 se_error_type_e err = SE_INTERNAL_OK;
91 sync_agent_event_data_s *noti = NULL;
93 if (profile_dir_name == NULL) {
94 _DEBUG_ERROR("Not Defined profileDirName");
95 err = SE_INTERNAL_NOT_DEFINED;
99 noti = sync_agent_create_noti(notiType);
101 _DEBUG_ERROR("failed to sync_agent_create_noti");
102 err = SE_INTERNAL_NO_MEMORY;
106 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)profile_dir_name);
107 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)sync_type);
108 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)uri);
109 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)progress_status);
110 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_STRING, (void *)operation_type);
111 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &is_from_server);
112 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &total_per_operation);
113 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &synced_per_operation);
114 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &total_per_db);
115 sync_agent_append_event_data_param(noti, SYNC_AGENT_EVENT_PARAM_TYPE_INTEGER, &synced_per_db);
117 sync_agent_event_error_e event_err;
118 sync_agent_send_noti(NOTI_KEY, noti, NULL, NULL, &event_err);
119 if (event_err != SYNC_AGENT_EVENT_SUCCESS) {
120 if (aul_app_is_running(OMA_DS_UI_PKG)) {
121 _DEBUG_ERROR("failed to sync_agent_send_noti");
122 err = SE_INTERNAL_EVENT_ERROR;
129 sync_agent_free_noti(noti);