Convert VLOG -> DVLOG in device/bluetooth/bluez
The Chromium C++ style guide recommends that DVLOG is used as it "avoids bloating the release executable and in debug can be selectively enabled at runtime". Bug: 519010 Change-Id: I1d896ea332426b8d3ec281a4b313221e8b8fb19d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024251 Reviewed-by: Ovidio de Jesús Ruiz-Henríquez <odejesush@chromium.org> Commit-Queue: Md. Hasanur Rashid <hasanur.r@samsung.com> Cr-Commit-Position: refs/heads/master@{#735940}
This commit is contained in:

committed by
Commit Bot

parent
eaac25c228
commit
fe5cb8b0c4
device/bluetooth/bluez
bluetooth_adapter_profile_bluez.ccbluetooth_device_bluez.ccbluetooth_gatt_connection_bluez.ccbluetooth_local_gatt_characteristic_bluez.ccbluetooth_local_gatt_descriptor_bluez.ccbluetooth_local_gatt_service_bluez.ccbluetooth_pairing_bluez.ccbluetooth_remote_gatt_characteristic_bluez.ccbluetooth_remote_gatt_descriptor_bluez.ccbluetooth_remote_gatt_service_bluez.ccbluetooth_socket_bluez.cc
@@ -29,7 +29,7 @@ void BluetoothAdapterProfileBlueZ::Register(
|
|||||||
std::unique_ptr<BluetoothAdapterProfileBlueZ> profile(
|
std::unique_ptr<BluetoothAdapterProfileBlueZ> profile(
|
||||||
new BluetoothAdapterProfileBlueZ(uuid));
|
new BluetoothAdapterProfileBlueZ(uuid));
|
||||||
|
|
||||||
VLOG(1) << "Registering profile: " << profile->object_path().value();
|
DVLOG(1) << "Registering profile: " << profile->object_path().value();
|
||||||
const dbus::ObjectPath& object_path = profile->object_path();
|
const dbus::ObjectPath& object_path = profile->object_path();
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
->GetBluetoothProfileManagerClient()
|
->GetBluetoothProfileManagerClient()
|
||||||
@@ -58,8 +58,8 @@ bool BluetoothAdapterProfileBlueZ::SetDelegate(
|
|||||||
const dbus::ObjectPath& device_path,
|
const dbus::ObjectPath& device_path,
|
||||||
bluez::BluetoothProfileServiceProvider::Delegate* delegate) {
|
bluez::BluetoothProfileServiceProvider::Delegate* delegate) {
|
||||||
DCHECK(delegate);
|
DCHECK(delegate);
|
||||||
VLOG(1) << "SetDelegate: " << object_path_.value() << " dev "
|
DVLOG(1) << "SetDelegate: " << object_path_.value() << " dev "
|
||||||
<< device_path.value();
|
<< device_path.value();
|
||||||
|
|
||||||
if (delegates_.find(device_path.value()) != delegates_.end()) {
|
if (delegates_.find(device_path.value()) != delegates_.end()) {
|
||||||
return false;
|
return false;
|
||||||
@@ -72,8 +72,8 @@ bool BluetoothAdapterProfileBlueZ::SetDelegate(
|
|||||||
void BluetoothAdapterProfileBlueZ::RemoveDelegate(
|
void BluetoothAdapterProfileBlueZ::RemoveDelegate(
|
||||||
const dbus::ObjectPath& device_path,
|
const dbus::ObjectPath& device_path,
|
||||||
const base::Closure& unregistered_callback) {
|
const base::Closure& unregistered_callback) {
|
||||||
VLOG(1) << object_path_.value() << " dev " << device_path.value()
|
DVLOG(1) << object_path_.value() << " dev " << device_path.value()
|
||||||
<< ": RemoveDelegate";
|
<< ": RemoveDelegate";
|
||||||
|
|
||||||
if (delegates_.find(device_path.value()) == delegates_.end())
|
if (delegates_.find(device_path.value()) == delegates_.end())
|
||||||
return;
|
return;
|
||||||
@@ -83,7 +83,7 @@ void BluetoothAdapterProfileBlueZ::RemoveDelegate(
|
|||||||
if (delegates_.size() != 0)
|
if (delegates_.size() != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VLOG(1) << device_path.value() << " No delegates left, unregistering.";
|
DVLOG(1) << device_path.value() << " No delegates left, unregistering.";
|
||||||
|
|
||||||
// No users left, release the profile.
|
// No users left, release the profile.
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
@@ -107,7 +107,7 @@ void BluetoothAdapterProfileBlueZ::OnUnregisterProfileError(
|
|||||||
|
|
||||||
// bluez::BluetoothProfileServiceProvider::Delegate:
|
// bluez::BluetoothProfileServiceProvider::Delegate:
|
||||||
void BluetoothAdapterProfileBlueZ::Released() {
|
void BluetoothAdapterProfileBlueZ::Released() {
|
||||||
VLOG(1) << object_path_.value() << ": Release";
|
DVLOG(1) << object_path_.value() << ": Release";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothAdapterProfileBlueZ::NewConnection(
|
void BluetoothAdapterProfileBlueZ::NewConnection(
|
||||||
@@ -121,8 +121,8 @@ void BluetoothAdapterProfileBlueZ::NewConnection(
|
|||||||
delegate_path = dbus::ObjectPath("");
|
delegate_path = dbus::ObjectPath("");
|
||||||
|
|
||||||
if (delegates_.find(delegate_path.value()) == delegates_.end()) {
|
if (delegates_.find(delegate_path.value()) == delegates_.end()) {
|
||||||
VLOG(1) << object_path_.value() << ": New connection for device "
|
DVLOG(1) << object_path_.value() << ": New connection for device "
|
||||||
<< device_path.value() << " which has no delegates!";
|
<< device_path.value() << " which has no delegates!";
|
||||||
std::move(callback).Run(REJECTED);
|
std::move(callback).Run(REJECTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -140,8 +140,8 @@ void BluetoothAdapterProfileBlueZ::RequestDisconnection(
|
|||||||
delegate_path = dbus::ObjectPath("");
|
delegate_path = dbus::ObjectPath("");
|
||||||
|
|
||||||
if (delegates_.find(delegate_path.value()) == delegates_.end()) {
|
if (delegates_.find(delegate_path.value()) == delegates_.end()) {
|
||||||
VLOG(1) << object_path_.value() << ": RequestDisconnection for device "
|
DVLOG(1) << object_path_.value() << ": RequestDisconnection for device "
|
||||||
<< device_path.value() << " which has no delegates!";
|
<< device_path.value() << " which has no delegates!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void BluetoothAdapterProfileBlueZ::RequestDisconnection(
|
|||||||
void BluetoothAdapterProfileBlueZ::Cancel() {
|
void BluetoothAdapterProfileBlueZ::Cancel() {
|
||||||
// Cancel() should only go to a delegate accepting connections.
|
// Cancel() should only go to a delegate accepting connections.
|
||||||
if (delegates_.find("") == delegates_.end()) {
|
if (delegates_.find("") == delegates_.end()) {
|
||||||
VLOG(1) << object_path_.value() << ": Cancel with no delegate!";
|
DVLOG(1) << object_path_.value() << ": Cancel with no delegate!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -812,7 +812,7 @@ void BluetoothDeviceBlueZ::GattServiceRemoved(
|
|||||||
const dbus::ObjectPath& object_path) {
|
const dbus::ObjectPath& object_path) {
|
||||||
auto iter = gatt_services_.find(object_path.value());
|
auto iter = gatt_services_.find(object_path.value());
|
||||||
if (iter == gatt_services_.end()) {
|
if (iter == gatt_services_.end()) {
|
||||||
VLOG(3) << "Unknown GATT service removed: " << object_path.value();
|
DVLOG(3) << "Unknown GATT service removed: " << object_path.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,8 +842,8 @@ void BluetoothDeviceBlueZ::UpdateGattServices(
|
|||||||
|
|
||||||
DCHECK(IsGattServicesDiscoveryComplete());
|
DCHECK(IsGattServicesDiscoveryComplete());
|
||||||
|
|
||||||
VLOG(3) << "Updating the list of GATT services associated with device "
|
DVLOG(3) << "Updating the list of GATT services associated with device "
|
||||||
<< object_path_.value();
|
<< object_path_.value();
|
||||||
|
|
||||||
const std::vector<dbus::ObjectPath> service_paths =
|
const std::vector<dbus::ObjectPath> service_paths =
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
|
@@ -52,7 +52,7 @@ bool BluetoothGattConnectionBlueZ::IsConnected() {
|
|||||||
|
|
||||||
void BluetoothGattConnectionBlueZ::Disconnect() {
|
void BluetoothGattConnectionBlueZ::Disconnect() {
|
||||||
if (!connected_) {
|
if (!connected_) {
|
||||||
VLOG(1) << "Connection already inactive.";
|
DVLOG(1) << "Connection already inactive.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ BluetoothLocalGattCharacteristic::Create(
|
|||||||
return characteristic->weak_ptr_factory_.GetWeakPtr();
|
return characteristic->weak_ptr_factory_.GetWeakPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // device
|
} // namespace device
|
||||||
|
|
||||||
namespace bluez {
|
namespace bluez {
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ BluetoothLocalGattCharacteristicBlueZ::BluetoothLocalGattCharacteristicBlueZ(
|
|||||||
properties_(properties),
|
properties_(properties),
|
||||||
permissions_(permissions),
|
permissions_(permissions),
|
||||||
service_(service) {
|
service_(service) {
|
||||||
VLOG(1) << "Creating local GATT characteristic with identifier: "
|
DVLOG(1) << "Creating local GATT characteristic with identifier: "
|
||||||
<< GetIdentifier();
|
<< GetIdentifier();
|
||||||
service->AddCharacteristic(base::WrapUnique(this));
|
service->AddCharacteristic(base::WrapUnique(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ BluetoothLocalGattDescriptor::Create(
|
|||||||
return descriptor->weak_ptr_factory_.GetWeakPtr();
|
return descriptor->weak_ptr_factory_.GetWeakPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // device
|
} // namespace device
|
||||||
|
|
||||||
namespace bluez {
|
namespace bluez {
|
||||||
|
|
||||||
@@ -44,8 +44,8 @@ BluetoothLocalGattDescriptorBlueZ::BluetoothLocalGattDescriptorBlueZ(
|
|||||||
permissions_(permissions),
|
permissions_(permissions),
|
||||||
characteristic_(characteristic) {
|
characteristic_(characteristic) {
|
||||||
DCHECK(characteristic->GetService());
|
DCHECK(characteristic->GetService());
|
||||||
VLOG(1) << "Creating local GATT descriptor with identifier: "
|
DVLOG(1) << "Creating local GATT descriptor with identifier: "
|
||||||
<< GetIdentifier();
|
<< GetIdentifier();
|
||||||
characteristic->AddDescriptor(base::WrapUnique(this));
|
characteristic->AddDescriptor(base::WrapUnique(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -44,7 +44,8 @@ BluetoothLocalGattServiceBlueZ::BluetoothLocalGattServiceBlueZ(
|
|||||||
uuid_(uuid),
|
uuid_(uuid),
|
||||||
is_primary_(is_primary),
|
is_primary_(is_primary),
|
||||||
delegate_(delegate) {
|
delegate_(delegate) {
|
||||||
VLOG(1) << "Creating local GATT service with identifier: " << GetIdentifier();
|
DVLOG(1) << "Creating local GATT service with identifier: "
|
||||||
|
<< GetIdentifier();
|
||||||
adapter->AddLocalGattService(base::WrapUnique(this));
|
adapter->AddLocalGattService(base::WrapUnique(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,11 +40,11 @@ BluetoothPairingBlueZ::BluetoothPairingBlueZ(
|
|||||||
: device_(device),
|
: device_(device),
|
||||||
pairing_delegate_(pairing_delegate),
|
pairing_delegate_(pairing_delegate),
|
||||||
pairing_delegate_used_(false) {
|
pairing_delegate_used_(false) {
|
||||||
VLOG(1) << "Created BluetoothPairingBlueZ for " << device_->GetAddress();
|
DVLOG(1) << "Created BluetoothPairingBlueZ for " << device_->GetAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
BluetoothPairingBlueZ::~BluetoothPairingBlueZ() {
|
BluetoothPairingBlueZ::~BluetoothPairingBlueZ() {
|
||||||
VLOG(1) << "Destroying BluetoothPairingBlueZ for " << device_->GetAddress();
|
DVLOG(1) << "Destroying BluetoothPairingBlueZ for " << device_->GetAddress();
|
||||||
|
|
||||||
if (!pairing_delegate_used_) {
|
if (!pairing_delegate_used_) {
|
||||||
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
|
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingMethod",
|
||||||
|
@@ -48,8 +48,8 @@ BluetoothRemoteGattCharacteristicBlueZ::BluetoothRemoteGattCharacteristicBlueZ(
|
|||||||
has_notify_session_(false),
|
has_notify_session_(false),
|
||||||
service_(service),
|
service_(service),
|
||||||
num_of_characteristic_value_read_in_progress_(0) {
|
num_of_characteristic_value_read_in_progress_(0) {
|
||||||
VLOG(1) << "Creating remote GATT characteristic with identifier: "
|
DVLOG(1) << "Creating remote GATT characteristic with identifier: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
->GetBluetoothGattDescriptorClient()
|
->GetBluetoothGattDescriptorClient()
|
||||||
->AddObserver(this);
|
->AddObserver(this);
|
||||||
@@ -155,9 +155,9 @@ bool BluetoothRemoteGattCharacteristicBlueZ::IsNotifying() const {
|
|||||||
void BluetoothRemoteGattCharacteristicBlueZ::ReadRemoteCharacteristic(
|
void BluetoothRemoteGattCharacteristicBlueZ::ReadRemoteCharacteristic(
|
||||||
ValueCallback callback,
|
ValueCallback callback,
|
||||||
ErrorCallback error_callback) {
|
ErrorCallback error_callback) {
|
||||||
VLOG(1) << "Sending GATT characteristic read request to characteristic: "
|
DVLOG(1) << "Sending GATT characteristic read request to characteristic: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
|
||||||
<< ".";
|
<< ".";
|
||||||
|
|
||||||
DCHECK_GE(num_of_characteristic_value_read_in_progress_, 0);
|
DCHECK_GE(num_of_characteristic_value_read_in_progress_, 0);
|
||||||
++num_of_characteristic_value_read_in_progress_;
|
++num_of_characteristic_value_read_in_progress_;
|
||||||
@@ -175,9 +175,9 @@ void BluetoothRemoteGattCharacteristicBlueZ::WriteRemoteCharacteristic(
|
|||||||
const std::vector<uint8_t>& value,
|
const std::vector<uint8_t>& value,
|
||||||
base::OnceClosure callback,
|
base::OnceClosure callback,
|
||||||
ErrorCallback error_callback) {
|
ErrorCallback error_callback) {
|
||||||
VLOG(1) << "Sending GATT characteristic write request to characteristic: "
|
DVLOG(1) << "Sending GATT characteristic write request to characteristic: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value()
|
||||||
<< ", with value: " << value << ".";
|
<< ", with value: " << value << ".";
|
||||||
|
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
->GetBluetoothGattCharacteristicClient()
|
->GetBluetoothGattCharacteristicClient()
|
||||||
@@ -193,10 +193,10 @@ void BluetoothRemoteGattCharacteristicBlueZ::PrepareWriteRemoteCharacteristic(
|
|||||||
const std::vector<uint8_t>& value,
|
const std::vector<uint8_t>& value,
|
||||||
base::OnceClosure callback,
|
base::OnceClosure callback,
|
||||||
ErrorCallback error_callback) {
|
ErrorCallback error_callback) {
|
||||||
VLOG(1) << "Sending GATT characteristic prepare write request to "
|
DVLOG(1) << "Sending GATT characteristic prepare write request to "
|
||||||
<< "characteristic: " << GetIdentifier()
|
<< "characteristic: " << GetIdentifier()
|
||||||
<< ", UUID: " << GetUUID().canonical_value()
|
<< ", UUID: " << GetUUID().canonical_value()
|
||||||
<< ", with value: " << value << ".";
|
<< ", with value: " << value << ".";
|
||||||
|
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
->GetBluetoothGattCharacteristicClient()
|
->GetBluetoothGattCharacteristicClient()
|
||||||
@@ -251,8 +251,8 @@ void BluetoothRemoteGattCharacteristicBlueZ::UnsubscribeFromNotifications(
|
|||||||
void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorAdded(
|
void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorAdded(
|
||||||
const dbus::ObjectPath& object_path) {
|
const dbus::ObjectPath& object_path) {
|
||||||
if (descriptors_.find(object_path.value()) != descriptors_.end()) {
|
if (descriptors_.find(object_path.value()) != descriptors_.end()) {
|
||||||
VLOG(1) << "Remote GATT characteristic descriptor already exists: "
|
DVLOG(1) << "Remote GATT characteristic descriptor already exists: "
|
||||||
<< object_path.value();
|
<< object_path.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,12 +262,13 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorAdded(
|
|||||||
->GetProperties(object_path);
|
->GetProperties(object_path);
|
||||||
DCHECK(properties);
|
DCHECK(properties);
|
||||||
if (properties->characteristic.value() != this->object_path()) {
|
if (properties->characteristic.value() != this->object_path()) {
|
||||||
VLOG(3) << "Remote GATT descriptor does not belong to this characteristic.";
|
DVLOG(3)
|
||||||
|
<< "Remote GATT descriptor does not belong to this characteristic.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << "Adding new remote GATT descriptor for GATT characteristic: "
|
DVLOG(1) << "Adding new remote GATT descriptor for GATT characteristic: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
||||||
|
|
||||||
// NOTE: Can't use std::make_unique due to private constructor.
|
// NOTE: Can't use std::make_unique due to private constructor.
|
||||||
BluetoothRemoteGattDescriptorBlueZ* descriptor =
|
BluetoothRemoteGattDescriptorBlueZ* descriptor =
|
||||||
@@ -285,12 +286,12 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorRemoved(
|
|||||||
const dbus::ObjectPath& object_path) {
|
const dbus::ObjectPath& object_path) {
|
||||||
auto iter = descriptors_.find(object_path.value());
|
auto iter = descriptors_.find(object_path.value());
|
||||||
if (iter == descriptors_.end()) {
|
if (iter == descriptors_.end()) {
|
||||||
VLOG(2) << "Unknown descriptor removed: " << object_path.value();
|
DVLOG(2) << "Unknown descriptor removed: " << object_path.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << "Removing remote GATT descriptor from characteristic: "
|
DVLOG(1) << "Removing remote GATT descriptor from characteristic: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
||||||
|
|
||||||
auto descriptor = std::move(iter->second);
|
auto descriptor = std::move(iter->second);
|
||||||
auto* descriptor_bluez =
|
auto* descriptor_bluez =
|
||||||
@@ -309,7 +310,7 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorPropertyChanged(
|
|||||||
const std::string& property_name) {
|
const std::string& property_name) {
|
||||||
auto iter = descriptors_.find(object_path.value());
|
auto iter = descriptors_.find(object_path.value());
|
||||||
if (iter == descriptors_.end()) {
|
if (iter == descriptors_.end()) {
|
||||||
VLOG(2) << "Unknown descriptor removed: " << object_path.value();
|
DVLOG(2) << "Unknown descriptor removed: " << object_path.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,8 +334,8 @@ void BluetoothRemoteGattCharacteristicBlueZ::GattDescriptorPropertyChanged(
|
|||||||
|
|
||||||
void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifySuccess(
|
void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifySuccess(
|
||||||
base::OnceClosure callback) {
|
base::OnceClosure callback) {
|
||||||
VLOG(1) << "Started notifications from characteristic: "
|
DVLOG(1) << "Started notifications from characteristic: "
|
||||||
<< object_path().value();
|
<< object_path().value();
|
||||||
has_notify_session_ = true;
|
has_notify_session_ = true;
|
||||||
std::move(callback).Run();
|
std::move(callback).Run();
|
||||||
}
|
}
|
||||||
@@ -343,9 +344,9 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStartNotifyError(
|
|||||||
ErrorCallback error_callback,
|
ErrorCallback error_callback,
|
||||||
const std::string& error_name,
|
const std::string& error_name,
|
||||||
const std::string& error_message) {
|
const std::string& error_message) {
|
||||||
VLOG(1) << "Failed to start notifications from characteristic: "
|
DVLOG(1) << "Failed to start notifications from characteristic: "
|
||||||
<< object_path().value() << ": " << error_name << ", "
|
<< object_path().value() << ": " << error_name << ", "
|
||||||
<< error_message;
|
<< error_message;
|
||||||
std::move(error_callback)
|
std::move(error_callback)
|
||||||
.Run(
|
.Run(
|
||||||
BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(error_name));
|
BluetoothRemoteGattServiceBlueZ::DBusErrorToServiceError(error_name));
|
||||||
@@ -361,9 +362,9 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnStopNotifyError(
|
|||||||
base::OnceClosure callback,
|
base::OnceClosure callback,
|
||||||
const std::string& error_name,
|
const std::string& error_name,
|
||||||
const std::string& error_message) {
|
const std::string& error_message) {
|
||||||
VLOG(1) << "Call to stop notifications failed for characteristic: "
|
DVLOG(1) << "Call to stop notifications failed for characteristic: "
|
||||||
<< object_path().value() << ": " << error_name << ", "
|
<< object_path().value() << ": " << error_name << ", "
|
||||||
<< error_message;
|
<< error_message;
|
||||||
|
|
||||||
// Since this is a best effort operation, treat this as success.
|
// Since this is a best effort operation, treat this as success.
|
||||||
OnStopNotifySuccess(std::move(callback));
|
OnStopNotifySuccess(std::move(callback));
|
||||||
@@ -373,8 +374,8 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnReadError(
|
|||||||
ErrorCallback error_callback,
|
ErrorCallback error_callback,
|
||||||
const std::string& error_name,
|
const std::string& error_name,
|
||||||
const std::string& error_message) {
|
const std::string& error_message) {
|
||||||
VLOG(1) << "Operation failed: " << error_name
|
DVLOG(1) << "Operation failed: " << error_name
|
||||||
<< ", message: " << error_message;
|
<< ", message: " << error_message;
|
||||||
--num_of_characteristic_value_read_in_progress_;
|
--num_of_characteristic_value_read_in_progress_;
|
||||||
DCHECK_GE(num_of_characteristic_value_read_in_progress_, 0);
|
DCHECK_GE(num_of_characteristic_value_read_in_progress_, 0);
|
||||||
std::move(error_callback)
|
std::move(error_callback)
|
||||||
@@ -385,8 +386,8 @@ void BluetoothRemoteGattCharacteristicBlueZ::OnWriteError(
|
|||||||
ErrorCallback error_callback,
|
ErrorCallback error_callback,
|
||||||
const std::string& error_name,
|
const std::string& error_name,
|
||||||
const std::string& error_message) {
|
const std::string& error_message) {
|
||||||
VLOG(1) << "Operation failed: " << error_name
|
DVLOG(1) << "Operation failed: " << error_name
|
||||||
<< ", message: " << error_message;
|
<< ", message: " << error_message;
|
||||||
std::move(error_callback)
|
std::move(error_callback)
|
||||||
.Run(BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name));
|
.Run(BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name));
|
||||||
}
|
}
|
||||||
|
@@ -40,8 +40,8 @@ BluetoothRemoteGattDescriptorBlueZ::BluetoothRemoteGattDescriptorBlueZ(
|
|||||||
const dbus::ObjectPath& object_path)
|
const dbus::ObjectPath& object_path)
|
||||||
: BluetoothGattDescriptorBlueZ(object_path),
|
: BluetoothGattDescriptorBlueZ(object_path),
|
||||||
characteristic_(characteristic) {
|
characteristic_(characteristic) {
|
||||||
VLOG(1) << "Creating remote GATT descriptor with identifier: "
|
DVLOG(1) << "Creating remote GATT descriptor with identifier: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
BluetoothRemoteGattDescriptorBlueZ::~BluetoothRemoteGattDescriptorBlueZ() =
|
BluetoothRemoteGattDescriptorBlueZ::~BluetoothRemoteGattDescriptorBlueZ() =
|
||||||
@@ -83,9 +83,9 @@ BluetoothRemoteGattDescriptorBlueZ::GetPermissions() const {
|
|||||||
void BluetoothRemoteGattDescriptorBlueZ::ReadRemoteDescriptor(
|
void BluetoothRemoteGattDescriptorBlueZ::ReadRemoteDescriptor(
|
||||||
ValueCallback callback,
|
ValueCallback callback,
|
||||||
ErrorCallback error_callback) {
|
ErrorCallback error_callback) {
|
||||||
VLOG(1) << "Sending GATT characteristic descriptor read request to "
|
DVLOG(1) << "Sending GATT characteristic descriptor read request to "
|
||||||
<< "descriptor: " << GetIdentifier()
|
<< "descriptor: " << GetIdentifier()
|
||||||
<< ", UUID: " << GetUUID().canonical_value();
|
<< ", UUID: " << GetUUID().canonical_value();
|
||||||
|
|
||||||
bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
|
bluez::BluezDBusManager::Get()->GetBluetoothGattDescriptorClient()->ReadValue(
|
||||||
object_path(), std::move(callback),
|
object_path(), std::move(callback),
|
||||||
@@ -98,10 +98,10 @@ void BluetoothRemoteGattDescriptorBlueZ::WriteRemoteDescriptor(
|
|||||||
const std::vector<uint8_t>& new_value,
|
const std::vector<uint8_t>& new_value,
|
||||||
base::OnceClosure callback,
|
base::OnceClosure callback,
|
||||||
ErrorCallback error_callback) {
|
ErrorCallback error_callback) {
|
||||||
VLOG(1) << "Sending GATT characteristic descriptor write request to "
|
DVLOG(1) << "Sending GATT characteristic descriptor write request to "
|
||||||
<< "characteristic: " << GetIdentifier()
|
<< "characteristic: " << GetIdentifier()
|
||||||
<< ", UUID: " << GetUUID().canonical_value()
|
<< ", UUID: " << GetUUID().canonical_value()
|
||||||
<< ", with value: " << new_value << ".";
|
<< ", with value: " << new_value << ".";
|
||||||
|
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
->GetBluetoothGattDescriptorClient()
|
->GetBluetoothGattDescriptorClient()
|
||||||
@@ -115,8 +115,8 @@ void BluetoothRemoteGattDescriptorBlueZ::OnError(
|
|||||||
ErrorCallback error_callback,
|
ErrorCallback error_callback,
|
||||||
const std::string& error_name,
|
const std::string& error_name,
|
||||||
const std::string& error_message) {
|
const std::string& error_message) {
|
||||||
VLOG(1) << "Operation failed: " << error_name
|
DVLOG(1) << "Operation failed: " << error_name
|
||||||
<< ", message: " << error_message;
|
<< ", message: " << error_message;
|
||||||
|
|
||||||
std::move(error_callback)
|
std::move(error_callback)
|
||||||
.Run(BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name));
|
.Run(BluetoothGattServiceBlueZ::DBusErrorToServiceError(error_name));
|
||||||
|
@@ -23,8 +23,8 @@ BluetoothRemoteGattServiceBlueZ::BluetoothRemoteGattServiceBlueZ(
|
|||||||
BluetoothDeviceBlueZ* device,
|
BluetoothDeviceBlueZ* device,
|
||||||
const dbus::ObjectPath& object_path)
|
const dbus::ObjectPath& object_path)
|
||||||
: BluetoothGattServiceBlueZ(adapter, object_path), device_(device) {
|
: BluetoothGattServiceBlueZ(adapter, object_path), device_(device) {
|
||||||
VLOG(1) << "Creating remote GATT service with identifier: "
|
DVLOG(1) << "Creating remote GATT service with identifier: "
|
||||||
<< object_path.value();
|
<< object_path.value();
|
||||||
DCHECK(GetAdapter());
|
DCHECK(GetAdapter());
|
||||||
|
|
||||||
bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
|
bluez::BluezDBusManager::Get()->GetBluetoothGattServiceClient()->AddObserver(
|
||||||
@@ -133,8 +133,8 @@ void BluetoothRemoteGattServiceBlueZ::GattServicePropertyChanged(
|
|||||||
if (object_path != this->object_path())
|
if (object_path != this->object_path())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VLOG(1) << "Service property changed: \"" << property_name << "\", "
|
DVLOG(1) << "Service property changed: \"" << property_name << "\", "
|
||||||
<< object_path.value();
|
<< object_path.value();
|
||||||
bluez::BluetoothGattServiceClient::Properties* properties =
|
bluez::BluetoothGattServiceClient::Properties* properties =
|
||||||
bluez::BluezDBusManager::Get()
|
bluez::BluezDBusManager::Get()
|
||||||
->GetBluetoothGattServiceClient()
|
->GetBluetoothGattServiceClient()
|
||||||
@@ -147,8 +147,8 @@ void BluetoothRemoteGattServiceBlueZ::GattServicePropertyChanged(
|
|||||||
void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded(
|
void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded(
|
||||||
const dbus::ObjectPath& object_path) {
|
const dbus::ObjectPath& object_path) {
|
||||||
if (characteristics_.find(object_path.value()) != characteristics_.end()) {
|
if (characteristics_.find(object_path.value()) != characteristics_.end()) {
|
||||||
VLOG(1) << "Remote GATT characteristic already exists: "
|
DVLOG(1) << "Remote GATT characteristic already exists: "
|
||||||
<< object_path.value();
|
<< object_path.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,12 +158,12 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded(
|
|||||||
->GetProperties(object_path);
|
->GetProperties(object_path);
|
||||||
DCHECK(properties);
|
DCHECK(properties);
|
||||||
if (properties->service.value() != this->object_path()) {
|
if (properties->service.value() != this->object_path()) {
|
||||||
VLOG(2) << "Remote GATT characteristic does not belong to this service.";
|
DVLOG(2) << "Remote GATT characteristic does not belong to this service.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << "Adding new remote GATT characteristic for GATT service: "
|
DVLOG(1) << "Adding new remote GATT characteristic for GATT service: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
||||||
|
|
||||||
// NOTE: Can't use std::make_unique due to private constructor.
|
// NOTE: Can't use std::make_unique due to private constructor.
|
||||||
BluetoothRemoteGattCharacteristicBlueZ* characteristic =
|
BluetoothRemoteGattCharacteristicBlueZ* characteristic =
|
||||||
@@ -180,12 +180,12 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicRemoved(
|
|||||||
const dbus::ObjectPath& object_path) {
|
const dbus::ObjectPath& object_path) {
|
||||||
auto iter = characteristics_.find(object_path.value());
|
auto iter = characteristics_.find(object_path.value());
|
||||||
if (iter == characteristics_.end()) {
|
if (iter == characteristics_.end()) {
|
||||||
VLOG(2) << "Unknown GATT characteristic removed: " << object_path.value();
|
DVLOG(2) << "Unknown GATT characteristic removed: " << object_path.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << "Removing remote GATT characteristic from service: "
|
DVLOG(1) << "Removing remote GATT characteristic from service: "
|
||||||
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
<< GetIdentifier() << ", UUID: " << GetUUID().canonical_value();
|
||||||
|
|
||||||
auto characteristic = std::move(iter->second);
|
auto characteristic = std::move(iter->second);
|
||||||
DCHECK(
|
DCHECK(
|
||||||
@@ -205,7 +205,7 @@ void BluetoothRemoteGattServiceBlueZ::GattCharacteristicPropertyChanged(
|
|||||||
GetCharacteristic(object_path.value()));
|
GetCharacteristic(object_path.value()));
|
||||||
|
|
||||||
if (!characteristic_bluez) {
|
if (!characteristic_bluez) {
|
||||||
VLOG(3) << "Properties of unknown characteristic changed";
|
DVLOG(3) << "Properties of unknown characteristic changed";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -227,14 +227,14 @@ void BluetoothSocketBlueZ::RegisterProfile(
|
|||||||
// adapter isn't running yet. Report success and carry on;
|
// adapter isn't running yet. Report success and carry on;
|
||||||
// the profile will be registered when the daemon becomes available.
|
// the profile will be registered when the daemon becomes available.
|
||||||
if (!adapter->IsPresent()) {
|
if (!adapter->IsPresent()) {
|
||||||
VLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
|
DVLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
|
||||||
<< ": Delaying profile registration.";
|
<< ": Delaying profile registration.";
|
||||||
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, success_callback);
|
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, success_callback);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
|
DVLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
|
||||||
<< ": Acquiring profile.";
|
<< ": Acquiring profile.";
|
||||||
|
|
||||||
adapter->UseProfile(uuid_, device_path_, *options_, this,
|
adapter->UseProfile(uuid_, device_path_, *options_, this,
|
||||||
base::Bind(&BluetoothSocketBlueZ::OnRegisterProfile, this,
|
base::Bind(&BluetoothSocketBlueZ::OnRegisterProfile, this,
|
||||||
@@ -253,13 +253,13 @@ void BluetoothSocketBlueZ::OnRegisterProfile(
|
|||||||
profile_ = profile;
|
profile_ = profile;
|
||||||
|
|
||||||
if (device_path_.value().empty()) {
|
if (device_path_.value().empty()) {
|
||||||
VLOG(1) << uuid_.canonical_value() << ": Profile registered.";
|
DVLOG(1) << uuid_.canonical_value() << ": Profile registered.";
|
||||||
success_callback.Run();
|
success_callback.Run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLOG(1) << uuid_.canonical_value() << ": Got profile, connecting to "
|
DVLOG(1) << uuid_.canonical_value() << ": Got profile, connecting to "
|
||||||
<< device_path_.value();
|
<< device_path_.value();
|
||||||
|
|
||||||
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->ConnectProfile(
|
||||||
device_path_, uuid_.canonical_value(),
|
device_path_, uuid_.canonical_value(),
|
||||||
@@ -284,7 +284,7 @@ void BluetoothSocketBlueZ::OnConnectProfile(
|
|||||||
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
||||||
DCHECK(profile_);
|
DCHECK(profile_);
|
||||||
|
|
||||||
VLOG(1) << profile_->object_path().value() << ": Profile connected.";
|
DVLOG(1) << profile_->object_path().value() << ": Profile connected.";
|
||||||
UnregisterProfile();
|
UnregisterProfile();
|
||||||
success_callback.Run();
|
success_callback.Run();
|
||||||
}
|
}
|
||||||
@@ -315,8 +315,8 @@ void BluetoothSocketBlueZ::AdapterPresentChanged(BluetoothAdapter* adapter,
|
|||||||
|
|
||||||
DCHECK(!profile_);
|
DCHECK(!profile_);
|
||||||
|
|
||||||
VLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
|
DVLOG(1) << uuid_.canonical_value() << " on " << device_path_.value()
|
||||||
<< ": Acquiring profile.";
|
<< ": Acquiring profile.";
|
||||||
|
|
||||||
static_cast<BluetoothAdapterBlueZ*>(adapter)->UseProfile(
|
static_cast<BluetoothAdapterBlueZ*>(adapter)->UseProfile(
|
||||||
uuid_, device_path_, *options_, this,
|
uuid_, device_path_, *options_, this,
|
||||||
@@ -331,7 +331,7 @@ void BluetoothSocketBlueZ::OnInternalRegisterProfile(
|
|||||||
|
|
||||||
profile_ = profile;
|
profile_ = profile;
|
||||||
|
|
||||||
VLOG(1) << uuid_.canonical_value() << ": Profile re-registered";
|
DVLOG(1) << uuid_.canonical_value() << ": Profile re-registered";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothSocketBlueZ::OnInternalRegisterProfileError(
|
void BluetoothSocketBlueZ::OnInternalRegisterProfileError(
|
||||||
@@ -345,7 +345,7 @@ void BluetoothSocketBlueZ::Released() {
|
|||||||
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
||||||
DCHECK(profile_);
|
DCHECK(profile_);
|
||||||
|
|
||||||
VLOG(1) << profile_->object_path().value() << ": Release";
|
DVLOG(1) << profile_->object_path().value() << ": Release";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothSocketBlueZ::NewConnection(
|
void BluetoothSocketBlueZ::NewConnection(
|
||||||
@@ -355,8 +355,8 @@ void BluetoothSocketBlueZ::NewConnection(
|
|||||||
ConfirmationCallback callback) {
|
ConfirmationCallback callback) {
|
||||||
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
||||||
|
|
||||||
VLOG(1) << uuid_.canonical_value()
|
DVLOG(1) << uuid_.canonical_value()
|
||||||
<< ": New connection from device: " << device_path.value();
|
<< ": New connection from device: " << device_path.value();
|
||||||
|
|
||||||
if (!device_path_.value().empty()) {
|
if (!device_path_.value().empty()) {
|
||||||
DCHECK(device_path_ == device_path);
|
DCHECK(device_path_ == device_path);
|
||||||
@@ -373,7 +373,7 @@ void BluetoothSocketBlueZ::NewConnection(
|
|||||||
request->callback = std::move(callback);
|
request->callback = std::move(callback);
|
||||||
|
|
||||||
connection_request_queue_.push(std::move(request));
|
connection_request_queue_.push(std::move(request));
|
||||||
VLOG(1) << uuid_.canonical_value() << ": Connection is now pending.";
|
DVLOG(1) << uuid_.canonical_value() << ": Connection is now pending.";
|
||||||
if (accept_request_) {
|
if (accept_request_) {
|
||||||
AcceptConnectionRequest();
|
AcceptConnectionRequest();
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ void BluetoothSocketBlueZ::RequestDisconnection(
|
|||||||
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
||||||
DCHECK(profile_);
|
DCHECK(profile_);
|
||||||
|
|
||||||
VLOG(1) << profile_->object_path().value() << ": Request disconnection";
|
DVLOG(1) << profile_->object_path().value() << ": Request disconnection";
|
||||||
std::move(callback).Run(SUCCESS);
|
std::move(callback).Run(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ void BluetoothSocketBlueZ::Cancel() {
|
|||||||
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
||||||
DCHECK(profile_);
|
DCHECK(profile_);
|
||||||
|
|
||||||
VLOG(1) << profile_->object_path().value() << ": Cancel";
|
DVLOG(1) << profile_->object_path().value() << ": Cancel";
|
||||||
|
|
||||||
if (connection_request_queue_.empty())
|
if (connection_request_queue_.empty())
|
||||||
return;
|
return;
|
||||||
@@ -415,8 +415,8 @@ void BluetoothSocketBlueZ::AcceptConnectionRequest() {
|
|||||||
DCHECK(connection_request_queue_.size() >= 1);
|
DCHECK(connection_request_queue_.size() >= 1);
|
||||||
DCHECK(profile_);
|
DCHECK(profile_);
|
||||||
|
|
||||||
VLOG(1) << profile_->object_path().value()
|
DVLOG(1) << profile_->object_path().value()
|
||||||
<< ": Accepting pending connection.";
|
<< ": Accepting pending connection.";
|
||||||
|
|
||||||
ConnectionRequest* request = connection_request_queue_.front().get();
|
ConnectionRequest* request = connection_request_queue_.front().get();
|
||||||
request->accepting = true;
|
request->accepting = true;
|
||||||
@@ -530,7 +530,7 @@ void BluetoothSocketBlueZ::UnregisterProfile() {
|
|||||||
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
DCHECK(ui_task_runner()->RunsTasksInCurrentSequence());
|
||||||
DCHECK(profile_);
|
DCHECK(profile_);
|
||||||
|
|
||||||
VLOG(1) << profile_->object_path().value() << ": Release profile";
|
DVLOG(1) << profile_->object_path().value() << ": Release profile";
|
||||||
|
|
||||||
static_cast<BluetoothAdapterBlueZ*>(adapter_.get())
|
static_cast<BluetoothAdapterBlueZ*>(adapter_.get())
|
||||||
->ReleaseProfile(device_path_, profile_);
|
->ReleaseProfile(device_path_, profile_);
|
||||||
|
Reference in New Issue
Block a user