Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1303)

Unified Diff: device/bluetooth/bluetooth_remote_gatt_service_mac.mm

Issue 2745983003: Bluetooth: macOS: Adding logs (Closed)
Patch Set: Last fix about GetIdentifier() Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_remote_gatt_service_mac.mm
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_mac.mm b/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
index 505321e6aa15a60eb11cd9cf1f988f6c3a5d2d3d..7d547d3b4eb371c89071953128e6f47dc7dbfbc6 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
+++ b/device/bluetooth/bluetooth_remote_gatt_service_mac.mm
@@ -78,12 +78,14 @@ BluetoothRemoteGattServiceMac::GetCharacteristic(
}
void BluetoothRemoteGattServiceMac::DiscoverCharacteristics() {
+ VLOG(1) << ToString() << ": DiscoverCharacteristics.";
is_discovery_complete_ = false;
[GetCBPeripheral() discoverCharacteristics:nil forService:GetService()];
}
void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
DCHECK(!is_discovery_complete_);
+ VLOG(1) << ToString() << ": DidDiscoverCharacteristics.";
std::unordered_set<std::string> characteristic_identifier_to_remove;
for (const auto& iter : gatt_characteristic_macs_) {
characteristic_identifier_to_remove.insert(iter.first);
@@ -93,6 +95,9 @@ void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
BluetoothRemoteGattCharacteristicMac* gatt_characteristic_mac =
GetBluetoothRemoteGattCharacteristicMac(cb_characteristic);
if (gatt_characteristic_mac) {
+ VLOG(1) << gatt_characteristic_mac->ToString()
+ << ": Known characteristic, properties "
+ << gatt_characteristic_mac->GetProperties();
const std::string& identifier = gatt_characteristic_mac->GetIdentifier();
characteristic_identifier_to_remove.erase(identifier);
gatt_characteristic_mac->DiscoverDescriptors();
@@ -104,6 +109,9 @@ void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
auto result_iter = gatt_characteristic_macs_.insert(
{identifier, base::WrapUnique(gatt_characteristic_mac)});
DCHECK(result_iter.second);
+ VLOG(1) << gatt_characteristic_mac->ToString()
+ << ": New characteristic, properties "
+ << gatt_characteristic_mac->GetProperties();
gatt_characteristic_mac->DiscoverDescriptors();
GetMacAdapter()->NotifyGattCharacteristicAdded(gatt_characteristic_mac);
}
@@ -112,6 +120,8 @@ void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
auto pair_to_remove = gatt_characteristic_macs_.find(identifier);
std::unique_ptr<BluetoothRemoteGattCharacteristicMac>
characteristic_to_remove;
+ VLOG(1) << characteristic_to_remove->ToString()
+ << ": Removed characteristic.";
pair_to_remove->second.swap(characteristic_to_remove);
gatt_characteristic_macs_.erase(pair_to_remove);
GetMacAdapter()->NotifyGattCharacteristicRemoved(
@@ -142,6 +152,7 @@ void BluetoothRemoteGattServiceMac::SendNotificationIfComplete() {
return pair.second->IsDiscoveryComplete();
}) == gatt_characteristic_macs_.end();
if (is_discovery_complete_) {
+ VLOG(1) << ToString() << ": Discovery complete.";
GetMacAdapter()->NotifyGattServiceChanged(this);
}
}
@@ -207,4 +218,9 @@ BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac(
}
}
+std::string BluetoothRemoteGattServiceMac::ToString() const {
+ return std::string("<BluetoothRemoteGattServiceMac ") + GetIdentifier() +
+ ", device " + bluetooth_device_mac_->GetIdentifier() + ">";
ortuno 2017/03/14 00:34:33 Same here: UUID might be more useful.
+}
+
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698