Files
rk35xx-android14/external/libbrillo/brillo/dbus/dbus_connection.h
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

41 lines
1.2 KiB
C++

// Copyright 2016 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIBBRILLO_BRILLO_DBUS_DBUS_CONNECTION_H_
#define LIBBRILLO_BRILLO_DBUS_DBUS_CONNECTION_H_
#include <base/memory/ref_counted.h>
#include <base/time/time.h>
#include <dbus/bus.h>
#include <brillo/brillo_export.h>
namespace brillo {
// DBusConnection adds D-Bus support to Daemon.
class BRILLO_EXPORT DBusConnection final {
public:
DBusConnection();
~DBusConnection();
// Instantiates dbus::Bus and establishes a D-Bus connection. Returns a
// reference to the connected bus, or an empty pointer in case of error.
scoped_refptr<::dbus::Bus> Connect();
// Instantiates dbus::Bus and tries to establish a D-Bus connection for up to
// |timeout|. If the connection can't be established after the timeout, fails
// returning an empty pointer.
scoped_refptr<::dbus::Bus> ConnectWithTimeout(base::TimeDelta timeout);
private:
scoped_refptr<::dbus::Bus> bus_;
private:
DISALLOW_COPY_AND_ASSIGN(DBusConnection);
};
} // namespace brillo
#endif // LIBBRILLO_BRILLO_DBUS_DBUS_CONNECTION_H_