4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JuHak Park <juhaki.park@samsung.com>,
7 * JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8 * SunBong Ha <sunbong.ha@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
28 * For any sort of issue you concern as to this software,
29 * you may use following point of contact.
30 * All resources contributed on this software
31 * are orinigally written by S-Core Inc., a member of Samsung Group.
33 * SeongWon Shim <seongwon.shim@samsung.com>
39 * @brief This file is the source file of implementation of notify to ui
42 #include "agent-framework/Event/Event_Handler.h"
43 #include "agent-framework/Utility/fw_log.h"
44 #include "ServiceEngine/SE_Notification.h"
45 #include "ServiceEngine/SE_Sync.h"
47 #define LOG_TAG "OMA_DS_SE"
49 #define NOTI_KEY "OMADS"
51 SE_ErrorType send_noti_auto_configure(char *profileDirName, GList *configure)
55 SE_ErrorType err = SE_INTERNAL_OK;
57 if (!profileDirName) {
58 FW_LOGE("Not Defined profileDirName");
59 err = SE_INTERNAL_NOT_DEFINED;
64 Event_Data *noti = create_Noti(notiType);
66 FW_LOGE("failed to create_Noti");
67 err = SE_INTERNAL_NO_MEMORY;
71 append_eventdata_param(noti, STRING, (void *)profileDirName);
77 for (iter = configure; iter != NULL; iter = g_list_next(iter)) {
80 count = g_list_length(inIter);
81 FW_LOGV("count =%d", count);
82 append_eventdata_param(noti, INTEGER, &count);
84 for (inIter = iter->data; inIter != NULL; inIter = g_list_next(inIter)) {
85 config = inIter->data;
86 FW_LOGV("config = %s", config);
87 append_eventdata_param(noti, STRING, (void *)config);
91 EVENT_ERROR event_err;
92 send_Noti(NOTI_KEY, noti, NULL, NULL, &event_err);
94 if (event_err != EVENT_SUCCESS) {
95 FW_LOGE("failed to send_Noti");
96 err = SE_INTERNAL_EVENT_ERROR;
107 SE_ErrorType send_noti_sync_status(char *profileDirName)
111 SE_ErrorType err = SE_INTERNAL_OK;
114 Event_Data *noti = create_Noti(notiType);
116 FW_LOGE("failed to create_Noti");
117 err = SE_INTERNAL_NO_MEMORY;
121 FW_LOGV("synchronising profile is : %s", profileDirName);
123 append_eventdata_param(noti, STRING, (void *)profileDirName);
125 EVENT_ERROR event_err;
126 send_Noti(NOTI_KEY, noti, NULL, NULL, &event_err);
128 if (event_err != EVENT_SUCCESS) {
129 FW_LOGE("failed to send_Noti");
130 err = SE_INTERNAL_EVENT_ERROR;
141 SE_ErrorType send_noti_session_process(char *profile, char *progress, char *error)
145 SE_ErrorType err = SE_INTERNAL_OK;
148 FW_LOGE("Not Defined profile");
149 err = SE_INTERNAL_NOT_DEFINED;
154 Event_Data *noti = create_Noti(notiType);
156 FW_LOGE("failed to create_Noti");
157 err = SE_INTERNAL_NO_MEMORY;
161 append_eventdata_param(noti, STRING, (void *)profile);
162 append_eventdata_param(noti, STRING, (void *)progress);
163 append_eventdata_param(noti, STRING, (void *)error);
165 EVENT_ERROR event_err;
166 send_Noti(NOTI_KEY, noti, NULL, NULL, &event_err);
168 if (event_err != EVENT_SUCCESS) {
169 FW_LOGE("failed to send_Noti");
170 err = SE_INTERNAL_EVENT_ERROR;
181 SE_ErrorType send_noti_process_update(char *profileDirName, char *uri, char *progressStatus,
182 char *operationType, int isFromServer, int totalPerOperation,
183 int syncedPerOperation, int totalPerDb, int syncedPerDb)
187 SE_ErrorType err = SE_INTERNAL_OK;
189 if (!profileDirName) {
190 FW_LOGE("Not Defined profileDirName");
191 err = SE_INTERNAL_NOT_DEFINED;
196 Event_Data *noti = create_Noti(notiType);
198 FW_LOGE("failed to create_Noti");
199 err = SE_INTERNAL_NO_MEMORY;
203 append_eventdata_param(noti, STRING, (void *)profileDirName);
204 append_eventdata_param(noti, STRING, (void *)uri);
205 append_eventdata_param(noti, STRING, (void *)progressStatus);
206 append_eventdata_param(noti, STRING, (void *)operationType);
207 append_eventdata_param(noti, INTEGER, &isFromServer);
208 append_eventdata_param(noti, INTEGER, &totalPerOperation);
209 append_eventdata_param(noti, INTEGER, &syncedPerOperation);
210 append_eventdata_param(noti, INTEGER, &totalPerDb);
211 append_eventdata_param(noti, INTEGER, &syncedPerDb);
213 EVENT_ERROR event_err;
214 send_Noti(NOTI_KEY, noti, NULL, NULL, &event_err);
216 if (event_err != EVENT_SUCCESS) {
217 FW_LOGE("failed to send_Noti");
218 err = SE_INTERNAL_EVENT_ERROR;