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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_service_mac.mm

Issue 2745983003: Bluetooth: macOS: Adding logs (Closed)
Patch Set: Changing GetIdentifier() by GetUUID() + pointer 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
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5d2b736e551e3f0a5eaa4ae182c39a00b94d94d8 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) << *this << ": DiscoverCharacteristics.";
is_discovery_complete_ = false;
[GetCBPeripheral() discoverCharacteristics:nil forService:GetService()];
}
void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
DCHECK(!is_discovery_complete_);
+ VLOG(1) << *this << ": 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
+ << ": 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,8 @@ 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 << ": New characteristic, properties "
+ << gatt_characteristic_mac->GetProperties();
gatt_characteristic_mac->DiscoverDescriptors();
GetMacAdapter()->NotifyGattCharacteristicAdded(gatt_characteristic_mac);
}
@@ -113,6 +120,7 @@ void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() {
std::unique_ptr<BluetoothRemoteGattCharacteristicMac>
characteristic_to_remove;
pair_to_remove->second.swap(characteristic_to_remove);
+ VLOG(1) << *characteristic_to_remove << ": Removed characteristic.";
gatt_characteristic_macs_.erase(pair_to_remove);
GetMacAdapter()->NotifyGattCharacteristicRemoved(
characteristic_to_remove.get());
@@ -142,6 +150,7 @@ void BluetoothRemoteGattServiceMac::SendNotificationIfComplete() {
return pair.second->IsDiscoveryComplete();
}) == gatt_characteristic_macs_.end();
if (is_discovery_complete_) {
+ VLOG(1) << *this << ": Discovery complete.";
GetMacAdapter()->NotifyGattServiceChanged(this);
}
}
@@ -207,4 +216,15 @@ BluetoothRemoteGattServiceMac::GetBluetoothRemoteGattCharacteristicMac(
}
}
+DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<(
+ std::ostream& out,
+ const BluetoothRemoteGattServiceMac& service) {
+ const BluetoothLowEnergyDeviceMac* bluetooth_device_mac_ =
+ static_cast<const BluetoothLowEnergyDeviceMac*>(service.GetDevice());
+ return out << "<BluetoothRemoteGattServiceMac "
+ << service.GetUUID().canonical_value() << "/" << &service
+ << ", device: " << bluetooth_device_mac_->GetAddress() << "/"
+ << bluetooth_device_mac_ << ">";
+}
+
} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_service_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698