#include "device/bluetooth/floss/floss_manager_client.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/observer_list.h"
#include "base/task/single_thread_task_runner.h"
#include "components/device_event_log/device_event_log.h"
#include "dbus/bus.h"
#include "dbus/exported_object.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
#include "device/bluetooth/bluez/bluez_features.h"
#include "device/bluetooth/chromeos_platform_features.h"
#include "device/bluetooth/floss/floss_dbus_client.h"
#include "device/bluetooth/floss/floss_features.h"
namespace floss {
AdapterWithEnabled;
template <>
bool FlossDBusClient::ReadDBusParam(dbus::MessageReader* reader,
AdapterWithEnabled* adapter) { … }
template <>
const DBusTypeInfo& GetDBusTypeInfo<AdapterWithEnabled>(
const AdapterWithEnabled* unused) { … }
const char FlossManagerClient::kExportedCallbacksPath[] = …"/org/chromium/bluetooth/manager/callback/lacros";
#else
"/org/chromium/bluetooth/manager/callback";
#endif
const char FlossManagerClient::kObjectManagerPath[] = …;
const int FlossManagerClient::kSetFlossRetryCount = …;
const int FlossManagerClient::kSetFlossRetryDelayMs = …;
const int FlossManagerClient::kSetFlossEnabledDBusTimeoutMs = …;
FlossManagerClient::FlossManagerClient() = default;
FlossManagerClient::~FlossManagerClient() { … }
void FlossManagerClient::AddObserver(FlossManagerClient::Observer* observer) { … }
void FlossManagerClient::RemoveObserver(
FlossManagerClient::Observer* observer) { … }
std::vector<int> FlossManagerClient::GetAdapters() const { … }
int FlossManagerClient::GetDefaultAdapter() const { … }
bool FlossManagerClient::GetAdapterPresent(int adapter) const { … }
bool FlossManagerClient::GetAdapterEnabled(int adapter) const { … }
void FlossManagerClient::GetFlossEnabledWithTarget(bool target,
int retry,
int retry_wait_ms) { … }
void FlossManagerClient::SetFlossEnabled(
bool enabled,
int retry,
int retry_wait_ms,
std::optional<ResponseCallback<bool>> cb) { … }
void FlossManagerClient::SetAdapterEnabled(int adapter,
bool enabled,
ResponseCallback<Void> callback) { … }
base::Version FlossManagerClient::GetFlossApiVersion() const { … }
void FlossManagerClient::DoGetFlossApiVersion() { … }
bool FlossManagerClient::IsCompatibleFlossApi() { … }
void FlossManagerClient::OnSetAdapterEnabled(DBusResult<Void> response) { … }
void FlossManagerClient::SetLLPrivacy(ResponseCallback<bool> callback,
const bool enable) { … }
void FlossManagerClient::SetDevCoredump(ResponseCallback<Void> callback,
const bool enable) { … }
void FlossManagerClient::RegisterWithManager() { … }
void FlossManagerClient::RemoveManager() { … }
void FlossManagerClient::Init(dbus::Bus* bus,
const std::string& service_name,
const int adapter_index,
base::Version version,
base::OnceClosure on_ready) { … }
void FlossManagerClient::HandleGetDefaultAdapter(DBusResult<int32_t> response) { … }
void FlossManagerClient::HandleGetAvailableAdapters(
DBusResult<std::vector<AdapterWithEnabled>> adapters) { … }
void FlossManagerClient::HandleRegisterCallback(DBusResult<Void> result) { … }
void FlossManagerClient::HandleGetAdapterEnabledAfterPresent(
int32_t adapter,
DBusResult<bool> response) { … }
void FlossManagerClient::OnHciDeviceChanged(int32_t adapter, bool present) { … }
void FlossManagerClient::OnHciEnabledChanged(int32_t adapter, bool enabled) { … }
void FlossManagerClient::OnDefaultAdapterChanged(int32_t adapter) { … }
void FlossManagerClient::HandleSetFlossEnabled(bool target,
int retry,
int retry_wait_ms,
DBusResult<Void> response) { … }
void FlossManagerClient::HandleGetFlossEnabled(bool target,
int retry,
int retry_wait_ms,
DBusResult<bool> response) { … }
void FlossManagerClient::CompleteSetFlossEnabled(DBusResult<bool> ret) { … }
void FlossManagerClient::HandleGetFlossApiVersion(
DBusResult<uint32_t> response) { … }
dbus::PropertySet* FlossManagerClient::CreateProperties(
dbus::ObjectProxy* object_proxy,
const dbus::ObjectPath& object_path,
const std::string& interface_name) { … }
void FlossManagerClient::ObjectAdded(const dbus::ObjectPath& object_path,
const std::string& interface_name) { … }
void FlossManagerClient::ObjectRemoved(const dbus::ObjectPath& object_path,
const std::string& interface_name) { … }
std::unique_ptr<FlossManagerClient> FlossManagerClient::Create() { … }
}