OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/dbus.h" | 5 #include "chromeos/dbus/dbus.h" |
6 | 6 |
7 #include <dbus/dbus.h> | 7 #include <dbus/dbus.h> |
8 #include <dbus/dbus-glib-bindings.h> | 8 #include <dbus/dbus-glib-bindings.h> |
9 #include <dbus/dbus-glib-lowlevel.h> | 9 #include <dbus/dbus-glib-lowlevel.h> |
10 #include <base/logging.h> | 10 #include <base/logging.h> |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return false; | 225 return false; |
226 } | 226 } |
227 | 227 |
228 // Determine a path from the service name and register the object. | 228 // Determine a path from the service name and register the object. |
229 dbus_g_connection_register_g_object(connection.g_connection(), | 229 dbus_g_connection_register_g_object(connection.g_connection(), |
230 service_path, | 230 service_path, |
231 object); | 231 object); |
232 return true; | 232 return true; |
233 } | 233 } |
234 | 234 |
235 | 235 void SendSignalWithNoArgumentsToSystemBus(const char* path, |
| 236 const char* interface_name, |
| 237 const char* signal_name) { |
| 238 CHECK(path); |
| 239 CHECK(interface_name); |
| 240 CHECK(signal_name); |
| 241 chromeos::dbus::Proxy proxy(chromeos::dbus::GetSystemBusConnection(), |
| 242 path, |
| 243 interface_name); |
| 244 DBusMessage* signal = ::dbus_message_new_signal( |
| 245 path, |
| 246 interface_name, |
| 247 signal_name); |
| 248 if (!signal) { |
| 249 LOG(ERROR) << "Failed to create a signal: " |
| 250 << "path: " << path << ", " |
| 251 << "interface_name: " << interface_name << ", " |
| 252 << "signal_name: " << signal_name; |
| 253 return; |
| 254 } |
| 255 ::dbus_g_proxy_send(proxy.gproxy(), signal, NULL); |
| 256 ::dbus_message_unref(signal); |
| 257 } |
236 | 258 |
237 } // namespace dbus | 259 } // namespace dbus |
238 } // namespace chromeos | 260 } // namespace chromeos |
OLD | NEW |