| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <iterator> | 5 #include <iterator> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "dbus/property.h" | 8 #include "dbus/property.h" |
| 9 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" | 9 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" |
| 10 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" | 10 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return; | 158 return; |
| 159 | 159 |
| 160 VLOG(1) << "Service property changed: \"" << property_name << "\", " | 160 VLOG(1) << "Service property changed: \"" << property_name << "\", " |
| 161 << object_path.value(); | 161 << object_path.value(); |
| 162 bluez::BluetoothGattServiceClient::Properties* properties = | 162 bluez::BluetoothGattServiceClient::Properties* properties = |
| 163 bluez::BluezDBusManager::Get() | 163 bluez::BluezDBusManager::Get() |
| 164 ->GetBluetoothGattServiceClient() | 164 ->GetBluetoothGattServiceClient() |
| 165 ->GetProperties(object_path); | 165 ->GetProperties(object_path); |
| 166 DCHECK(properties); | 166 DCHECK(properties); |
| 167 | 167 |
| 168 if (property_name != properties->characteristics.name()) { | 168 NotifyServiceChanged(); |
| 169 NotifyServiceChanged(); | |
| 170 return; | |
| 171 } | |
| 172 | |
| 173 if (discovery_complete_) | |
| 174 return; | |
| 175 | |
| 176 VLOG(1) << "All characteristics were discovered for service: " | |
| 177 << object_path.value(); | |
| 178 discovery_complete_ = true; | |
| 179 DCHECK(GetAdapter()); | |
| 180 GetAdapter()->NotifyGattDiscoveryComplete(this); | |
| 181 } | 169 } |
| 182 | 170 |
| 183 void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded( | 171 void BluetoothRemoteGattServiceBlueZ::GattCharacteristicAdded( |
| 184 const dbus::ObjectPath& object_path) { | 172 const dbus::ObjectPath& object_path) { |
| 185 if (characteristics_.find(object_path) != characteristics_.end()) { | 173 if (characteristics_.find(object_path) != characteristics_.end()) { |
| 186 VLOG(1) << "Remote GATT characteristic already exists: " | 174 VLOG(1) << "Remote GATT characteristic already exists: " |
| 187 << object_path.value(); | 175 << object_path.value(); |
| 188 return; | 176 return; |
| 189 } | 177 } |
| 190 | 178 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 DCHECK(GetAdapter()); | 243 DCHECK(GetAdapter()); |
| 256 | 244 |
| 257 if (property_name == properties->flags.name()) | 245 if (property_name == properties->flags.name()) |
| 258 NotifyServiceChanged(); | 246 NotifyServiceChanged(); |
| 259 else if (property_name == properties->value.name()) | 247 else if (property_name == properties->value.name()) |
| 260 GetAdapter()->NotifyGattCharacteristicValueChanged( | 248 GetAdapter()->NotifyGattCharacteristicValueChanged( |
| 261 iter->second, properties->value.value()); | 249 iter->second, properties->value.value()); |
| 262 } | 250 } |
| 263 | 251 |
| 264 } // namespace bluez | 252 } // namespace bluez |
| OLD | NEW |