bluetooth_advertisement_monitor_application_service_provider.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADVERTISEMENT_MONITOR_APPLICATION_SERVICE_PROVIDER_H_
  5. #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADVERTISEMENT_MONITOR_APPLICATION_SERVICE_PROVIDER_H_
  6. #include <memory>
  7. #include "dbus/bus.h"
  8. #include "dbus/object_path.h"
  9. #include "device/bluetooth/bluetooth_export.h"
  10. #include "device/bluetooth/dbus/bluetooth_advertisement_monitor_service_provider.h"
  11. namespace bluez {
  12. // BluetoothAdvertisementMonitorApplicationServiceProvider is used to provide a
  13. // D-Bus object that the Bluetooth daemon can communicate with to register
  14. // advertisement monitor service hierarchies.
  15. // This interface exists to manage instances of
  16. // BluetoothAdvertisementMonitorServiceProvider by signalling D-Bus when an
  17. // instance is added/removed and returning all managed instances when queried by
  18. // D-Bus.
  19. class DEVICE_BLUETOOTH_EXPORT
  20. BluetoothAdvertisementMonitorApplicationServiceProvider {
  21. public:
  22. BluetoothAdvertisementMonitorApplicationServiceProvider(
  23. const BluetoothAdvertisementMonitorApplicationServiceProvider&) = delete;
  24. BluetoothAdvertisementMonitorApplicationServiceProvider& operator=(
  25. const BluetoothAdvertisementMonitorApplicationServiceProvider&) = delete;
  26. virtual ~BluetoothAdvertisementMonitorApplicationServiceProvider();
  27. // Creates the instance where |bus| is the D-Bus bus connection to export the
  28. // object onto and |object_path| is the D-Bus object path that it should have.
  29. static std::unique_ptr<
  30. BluetoothAdvertisementMonitorApplicationServiceProvider>
  31. Create(dbus::Bus* bus, const dbus::ObjectPath& object_path);
  32. virtual void AddMonitor(
  33. std::unique_ptr<BluetoothAdvertisementMonitorServiceProvider>
  34. advertisement_monitor_service_provider) = 0;
  35. virtual void RemoveMonitor(const dbus::ObjectPath& monitor_path) = 0;
  36. protected:
  37. BluetoothAdvertisementMonitorApplicationServiceProvider();
  38. };
  39. } // namespace bluez
  40. #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_ADVERTISEMENT_MONITOR_APPLICATION_SERVICE_PROVIDER_H_