OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chromeos/dbus/bluetooth_gatt_service_client.h" | 9 #include "chromeos/dbus/bluetooth_gatt_service_client.h" |
10 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 DCHECK(characteristic->object_path() == object_path); | 243 DCHECK(characteristic->object_path() == object_path); |
244 characteristics_.erase(iter); | 244 characteristics_.erase(iter); |
245 | 245 |
246 FOR_EACH_OBSERVER(device::BluetoothGattService::Observer, observers_, | 246 FOR_EACH_OBSERVER(device::BluetoothGattService::Observer, observers_, |
247 GattCharacteristicRemoved(this, characteristic)); | 247 GattCharacteristicRemoved(this, characteristic)); |
248 NotifyServiceChanged(); | 248 NotifyServiceChanged(); |
249 | 249 |
250 delete characteristic; | 250 delete characteristic; |
251 } | 251 } |
252 | 252 |
| 253 void BluetoothRemoteGattServiceChromeOS::GattCharacteristicPropertyChanged( |
| 254 const dbus::ObjectPath& object_path, |
| 255 const std::string& property_name) { |
| 256 if (characteristics_.find(object_path) == characteristics_.end()) { |
| 257 VLOG(2) << "Properties of unknown characteristic changed"; |
| 258 return; |
| 259 } |
| 260 |
| 261 // We may receive a property changed event in certain cases, e.g. when the |
| 262 // characteristic "Flags" property has been updated with values from the |
| 263 // "Characteristic Extended Properties" descriptor. In this case, kick off |
| 264 // a service changed observer event to let observers refresh the |
| 265 // characteristics. |
| 266 BluetoothGattCharacteristicClient::Properties* properties = |
| 267 DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()-> |
| 268 GetProperties(object_path); |
| 269 DCHECK(properties); |
| 270 if (property_name != properties->flags.name()) |
| 271 return; |
| 272 |
| 273 NotifyServiceChanged(); |
| 274 } |
| 275 |
253 } // namespace chromeos | 276 } // namespace chromeos |
OLD | NEW |