#ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADMIN_POLICY_CLIENT_H_
#define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADMIN_POLICY_CLIENT_H_
#include <string>
#include <vector>
#include "base/functional/callback.h"
#include "dbus/object_path.h"
#include "dbus/property.h"
#include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/dbus/bluez_dbus_client.h"
#include "device/bluetooth/public/cpp/bluetooth_uuid.h"
namespace bluez {
class DEVICE_BLUETOOTH_EXPORT BluetoothAdminPolicyClient
: public BluezDBusClient {
public:
static std::unique_ptr<BluetoothAdminPolicyClient> Create();
struct Properties : public dbus::PropertySet {
dbus::Property<std::vector<std::string>> service_allow_list;
dbus::Property<bool> is_blocked_by_policy;
Properties(dbus::ObjectProxy* object_proxy,
const std::string& interface_name,
const PropertyChangedCallback& callback);
~Properties() override;
};
class Observer {
public:
virtual ~Observer() = default;
virtual void AdminPolicyAdded(const dbus::ObjectPath& object_path) = 0;
virtual void AdminPolicyRemoved(const dbus::ObjectPath& object_path) = 0;
virtual void AdminPolicyPropertyChanged(
const dbus::ObjectPath& object_path,
const std::string& property_name) = 0;
};
~BluetoothAdminPolicyClient() override;
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0;
using ErrorCallback =
base::OnceCallback<void(const std::string& error_name,
const std::string& error_message)>;
using UUIDList = std::vector<device::BluetoothUUID>;
virtual void SetServiceAllowList(const dbus::ObjectPath& object_path,
const UUIDList& service_uuids,
base::OnceClosure callback,
ErrorCallback error_callback) = 0;
protected:
BluetoothAdminPolicyClient();
};
}
#endif