summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorscheib <scheib@chromium.org>2015-08-10 20:15:50 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-11 03:16:24 +0000
commit712d499916f54c7c78aa37adaa69d0f0701fa2cf (patch)
tree0f990fa5ccad561cd11b18af1ce69b8208b32712 /device
parent19456822c60beed368966ca9f6f3f6d199db233a (diff)
downloadchromium_src-712d499916f54c7c78aa37adaa69d0f0701fa2cf.zip
chromium_src-712d499916f54c7c78aa37adaa69d0f0701fa2cf.tar.gz
chromium_src-712d499916f54c7c78aa37adaa69d0f0701fa2cf.tar.bz2
bluetooth: mac: Add VLOGs to diagnose device discovery failures.
We currently do not understand why device discovery is succeeding on some recent Mac bluetooth chipsets, and failing on others. These VLOGs will improve our ability to collect reports and gather information from the CoreBluetooth API usage point of view. After device/bluetooth Mac Low Energy support is stable. That work is tracked in https://code.google.com/p/chromium/issues/detail?id=519010 BUG=516608 Review URL: https://codereview.chromium.org/1279373002 Cr-Commit-Position: refs/heads/master@{#342783}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/bluetooth_adapter_mac.mm13
-rw-r--r--device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm15
2 files changed, 22 insertions, 6 deletions
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index bdbca46..7bf7186 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -458,6 +458,7 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated(
// std::map [] operator).
BluetoothDevice*& device_reference = devices_[device_address];
if (!device_reference) {
+ VLOG(1) << "LowEnergyDeviceUpdated new device";
// A new device has been found.
device_reference =
new BluetoothLowEnergyDeviceMac(peripheral, advertisement_data, rssi);
@@ -466,9 +467,14 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated(
return;
}
- if (static_cast<BluetoothLowEnergyDeviceMac*>(device_reference)
- ->GetIdentifier() !=
- BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier(peripheral)) {
+ std::string stored_device_id = device_reference->GetIdentifier();
+ std::string updated_device_id =
+ BluetoothLowEnergyDeviceMac::GetPeripheralIdentifier(peripheral);
+ if (stored_device_id != updated_device_id) {
+ VLOG(1) << "LowEnergyDeviceUpdated stored_device_id != updated_device_id: "
+ << std::endl
+ << " " << stored_device_id << std::endl
+ << " " << updated_device_id;
// Collision, two identifiers map to the same hash address. With a 48 bit
// hash the probability of this occuring with 10,000 devices
// simultaneously present is 1e-6 (see
@@ -478,6 +484,7 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated(
}
// A device has an update.
+ VLOG(2) << "LowEnergyDeviceUpdated";
static_cast<BluetoothLowEnergyDeviceMac*>(device_reference)
->Update(peripheral, advertisement_data, rssi);
FOR_EACH_OBSERVER(BluetoothAdapter::Observer, observers_,
diff --git a/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm b/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm
index ceab792..d14b578 100644
--- a/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm
+++ b/device/bluetooth/bluetooth_low_energy_discovery_manager_mac.mm
@@ -31,16 +31,22 @@ void BluetoothLowEnergyDiscoveryManagerMac::StartDiscovery(
void BluetoothLowEnergyDiscoveryManagerMac::TryStartDiscovery() {
if (!discovering_) {
+ VLOG(1) << "TryStartDiscovery !discovering_";
return;
}
if (!pending_) {
+ VLOG(1) << "TryStartDiscovery !pending_";
return;
}
- // Can only start if the bluetooth power is turned on.
- if (!central_manager_ ||
- [central_manager_ state] != CBCentralManagerStatePoweredOn) {
+ if (!central_manager_) {
+ VLOG(1) << "TryStartDiscovery !central_manager_";
+ return;
+ }
+
+ if ([central_manager_ state] != CBCentralManagerStatePoweredOn) {
+ VLOG(1) << "TryStartDiscovery != CBCentralManagerStatePoweredOn";
return;
}
@@ -57,11 +63,13 @@ void BluetoothLowEnergyDiscoveryManagerMac::TryStartDiscovery() {
}
};
+ VLOG(1) << "TryStartDiscovery scanForPeripheralsWithServices";
[central_manager_ scanForPeripheralsWithServices:services options:nil];
pending_ = false;
}
void BluetoothLowEnergyDiscoveryManagerMac::StopDiscovery() {
+ VLOG(1) << "StopDiscovery";
if (discovering_ && !pending_) {
[central_manager_ stopScan];
}
@@ -77,6 +85,7 @@ void BluetoothLowEnergyDiscoveryManagerMac::DiscoveredPeripheral(
CBPeripheral* peripheral,
NSDictionary* advertisementData,
int rssi) {
+ VLOG(1) << "DiscoveredPeripheral";
observer_->LowEnergyDeviceUpdated(peripheral, advertisementData, rssi);
}