4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
26 #include <dbus/dbus.h>
28 #include <notification_db.h>
29 #include <notification_debug.h>
30 #include <notification_ongoing.h>
31 #include <notification_internal.h>
33 notification_error_e notification_ongoing_update_progress(const char *caller_pkgname,
37 DBusConnection *connection = NULL;
38 DBusMessage *signal = NULL;
42 dbus_error_init(&err);
43 connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
45 NOTIFICATION_ERR("Fail to dbus_bus_get");
46 return NOTIFICATION_ERROR_FROM_DBUS;
50 dbus_message_new_signal("/dbus/signal", "notification.ongoing",
53 NOTIFICATION_ERR("Fail to dbus_message_new_signal");
54 return NOTIFICATION_ERROR_FROM_DBUS;
57 ret = dbus_message_append_args(signal,
58 DBUS_TYPE_STRING, &caller_pkgname,
59 DBUS_TYPE_INT32, &priv_id,
60 DBUS_TYPE_DOUBLE, &progress,
64 ret = dbus_connection_send(connection, signal, NULL);
66 dbus_connection_flush(connection);
70 dbus_message_unref(signal);
73 NOTIFICATION_INFO("Send progress info : %s(%d) %.2f",
74 caller_pkgname, priv_id, progress);
75 return NOTIFICATION_ERROR_NONE;
78 return NOTIFICATION_ERROR_FROM_DBUS;
81 notification_error_e notification_ongoing_update_size(const char *caller_pkgname,
82 int priv_id, double size)
84 DBusConnection *connection = NULL;
85 DBusMessage *signal = NULL;
89 dbus_error_init(&err);
90 connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
92 NOTIFICATION_ERR("Fail to dbus_bus_get");
93 return NOTIFICATION_ERROR_FROM_DBUS;
97 dbus_message_new_signal("/dbus/signal", "notification.ongoing",
100 NOTIFICATION_ERR("Fail to dbus_message_new_signal");
101 return NOTIFICATION_ERROR_FROM_DBUS;
104 ret = dbus_message_append_args(signal,
105 DBUS_TYPE_STRING, &caller_pkgname,
106 DBUS_TYPE_INT32, &priv_id,
107 DBUS_TYPE_DOUBLE, &size,
109 NOTIFICATION_INFO("arg...");
111 ret = dbus_connection_send(connection, signal, NULL);
112 NOTIFICATION_INFO("Send size info : %s(%d) %.2f",
113 caller_pkgname, priv_id, size);
116 dbus_connection_flush(connection);
120 dbus_message_unref(signal);
123 NOTIFICATION_INFO("Send size info : %s(%d) %.2f",
124 caller_pkgname, priv_id, size);
125 return NOTIFICATION_ERROR_NONE;
128 return NOTIFICATION_ERROR_FROM_DBUS;