Index: device/bluetooth/bluetooth_adapter_mac.mm |
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm |
index f33d79290ca0a91ad6b37d341e59a4ad65b41997..667bbd6e06425cd14a23461624b662165cbff694 100644 |
--- a/device/bluetooth/bluetooth_adapter_mac.mm |
+++ b/device/bluetooth/bluetooth_adapter_mac.mm |
@@ -519,14 +519,16 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated( |
// otherwise update the existing device. |
const bool is_new_device = device_mac == nullptr; |
if (is_new_device) { |
- VLOG(1) << "LowEnergyDeviceUpdated new device"; |
// A new device has been found. |
device_mac = new BluetoothLowEnergyDeviceMac(this, peripheral); |
+ VLOG(1) << *device_mac << ": New Device."; |
} else if (DoesCollideWithKnownDevice(peripheral, device_mac)) { |
return; |
} |
DCHECK(device_mac); |
+ VLOG(3) << *device_mac << ": Device updated with " |
+ << base::SysNSStringToUTF8([advertisement_data description]); |
// Get Advertised UUIDs |
BluetoothDevice::UUIDList advertised_uuids; |
@@ -576,7 +578,10 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated( |
} |
// TODO(krstnmnlsn): Implement. crbug.com/511025 |
-void BluetoothAdapterMac::LowEnergyCentralManagerUpdatedState() {} |
+void BluetoothAdapterMac::LowEnergyCentralManagerUpdatedState() { |
+ VLOG(1) << "Central manager state updated: " |
+ << [low_energy_central_manager_ state]; |
+} |
void BluetoothAdapterMac::AddPairedDevices() { |
// Add any new paired devices. |
@@ -594,6 +599,7 @@ BluetoothAdapterMac::RetrieveGattConnectedDevicesWithService( |
const BluetoothUUID* uuid) { |
NSArray* cbUUIDs = nil; |
if (!uuid) { |
+ VLOG(1) << "Retrieving all connected devices."; |
// It is not possible to ask for all connected peripherals with |
// -[CBCentralManager retrieveConnectedPeripheralsWithServices:] by passing |
// nil. To try to get most of the peripherals, the search is done with |
@@ -601,6 +607,8 @@ BluetoothAdapterMac::RetrieveGattConnectedDevicesWithService( |
CBUUID* genericAccessServiceUUID = [CBUUID UUIDWithString:@"1800"]; |
cbUUIDs = @[ genericAccessServiceUUID ]; |
} else { |
+ VLOG(1) << "Retrieving connected devices with UUID: " |
+ << uuid->canonical_value(); |
NSString* uuidString = |
base::SysUTF8ToNSString(uuid->canonical_value().c_str()); |
cbUUIDs = @[ [CBUUID UUIDWithString:uuidString] ]; |
@@ -626,6 +634,7 @@ BluetoothAdapterMac::RetrieveGattConnectedDevicesWithService( |
} |
} |
connected_devices.push_back(device_mac); |
+ VLOG(1) << *device_mac << ": New connected device."; |
} |
return connected_devices; |
} |
@@ -661,15 +670,15 @@ void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, |
[low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
return; |
} |
- VLOG(1) << "Failed to connect to peripheral"; |
BluetoothDevice::ConnectErrorCode error_code = |
BluetoothDevice::ConnectErrorCode::ERROR_UNKNOWN; |
if (error) { |
error_code = BluetoothDeviceMac::GetConnectErrorCodeFromNSError(error); |
- VLOG(1) << "Bluetooth error, domain: " << error.domain.UTF8String |
- << ", error code: " << error.code |
- << ", converted into: " << error_code; |
+ VLOG(1) << "Converting Bluetooth error, domain: " << error.domain.UTF8String |
+ << ", error code: " << error.code << ", to: " << error_code; |
} |
+ VLOG(1) << *device_mac << ": Failed to connect to peripheral with error " |
+ << error; |
device_mac->DidFailToConnectGatt(error_code); |
} |
@@ -681,11 +690,6 @@ void BluetoothAdapterMac::DidDisconnectPeripheral(CBPeripheral* peripheral, |
[low_energy_central_manager_ cancelPeripheralConnection:peripheral]; |
return; |
} |
- VLOG(1) << "Disconnected from peripheral."; |
- if (error) { |
- VLOG(1) << "Bluetooth error, domain: " << error.domain.UTF8String |
- << ", error code: " << error.code; |
- } |
device_mac->DidDisconnectPeripheral(error); |
} |