bluetooth_debug_manager_client.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2019 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_DEBUG_MANAGER_CLIENT_H_
  5. #define DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEBUG_MANAGER_CLIENT_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/callback.h"
  9. #include "dbus/object_path.h"
  10. #include "device/bluetooth/bluetooth_export.h"
  11. #include "device/bluetooth/dbus/bluez_dbus_client.h"
  12. namespace bluez {
  13. // BluetoothDebugManagerClient is used to communicate with the debug manager
  14. // object of the Bluetooth daemon.
  15. class DEVICE_BLUETOOTH_EXPORT BluetoothDebugManagerClient
  16. : public BluezDBusClient {
  17. public:
  18. BluetoothDebugManagerClient(const BluetoothDebugManagerClient&) = delete;
  19. BluetoothDebugManagerClient& operator=(const BluetoothDebugManagerClient&) =
  20. delete;
  21. ~BluetoothDebugManagerClient() override;
  22. // The ErrorCallback is used by debug manager methods to indicate failure.
  23. // It receives two arguments: the name of the error in |error_name| and
  24. // an optional message in |error_message|.
  25. typedef base::OnceCallback<void(const std::string& error_name,
  26. const std::string& error_message)>
  27. ErrorCallback;
  28. // Invoke D-Bus API to update bluetooth devcoredump state.
  29. virtual void SetDevCoredump(const bool enable,
  30. base::OnceClosure callback,
  31. ErrorCallback error_callback) = 0;
  32. // Invoke D-Bus API to enable or disable LL privacy.
  33. virtual void SetLLPrivacy(const bool enable,
  34. base::OnceClosure callback,
  35. ErrorCallback error_callback) = 0;
  36. // Invoke D-Bus API to enable or disable the Bluetooth Quality Report.
  37. virtual void SetBluetoothQualityReport(const bool enable,
  38. base::OnceClosure callback,
  39. ErrorCallback error_callback) = 0;
  40. // Invoke D-Bus API to set the levels of logging verbosity for each of
  41. // the bluetooth daemons and kernel.
  42. virtual void SetLogLevels(const uint8_t bluez_level,
  43. const uint8_t kernel_level,
  44. base::OnceClosure callback,
  45. ErrorCallback error_callback) = 0;
  46. // Creates the instance.
  47. static BluetoothDebugManagerClient* Create();
  48. // Constants used to indicate exceptional error conditions. These are
  49. // returned as the |error_name| in ErrorCallback.
  50. static const char kNoResponseError[];
  51. static const char kInvalidArgumentError[];
  52. protected:
  53. BluetoothDebugManagerClient();
  54. };
  55. } // namespace bluez
  56. #endif // DEVICE_BLUETOOTH_DBUS_BLUETOOTH_DEBUG_MANAGER_CLIENT_H_