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

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc

Issue 264053004: device/bluetooth: Improvements to GATT descriptor access API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pull & rebase. Created 6 years, 7 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_characteristic_chromeos.cc
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
index a2b28a10520d5c6f48e9b82d329e52831685cd9d..bb175e3f375fb2df4f9006dd3ea056aed119443f 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.cc
@@ -114,6 +114,16 @@ BluetoothRemoteGattCharacteristicChromeOS::GetDescriptors() const {
return descriptors;
}
+device::BluetoothGattDescriptor*
+BluetoothRemoteGattCharacteristicChromeOS::GetDescriptor(
+ const std::string& identifier) const {
+ DescriptorMap::const_iterator iter =
+ descriptors_.find(dbus::ObjectPath(identifier));
+ if (iter == descriptors_.end())
+ return NULL;
+ return iter->second;
+}
+
bool BluetoothRemoteGattCharacteristicChromeOS::AddDescriptor(
device::BluetoothGattDescriptor* descriptor) {
VLOG(1) << "Descriptors cannot be added to a remote GATT characteristic.";
@@ -194,6 +204,8 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorAdded(
DCHECK(descriptor->GetIdentifier() == object_path.value());
DCHECK(descriptor->GetUUID().IsValid());
DCHECK(service_);
+
+ service_->NotifyDescriptorAddedOrRemoved(this, descriptor, true /* added */);
service_->NotifyServiceChanged();
}
@@ -211,9 +223,12 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorRemoved(
BluetoothRemoteGattDescriptorChromeOS* descriptor = iter->second;
DCHECK(descriptor->object_path() == object_path);
descriptors_.erase(iter);
+
+ service_->NotifyDescriptorAddedOrRemoved(this, descriptor, false /* added */);
delete descriptor;
DCHECK(service_);
+
service_->NotifyServiceChanged();
}
@@ -224,8 +239,21 @@ void BluetoothRemoteGattCharacteristicChromeOS::GattDescriptorPropertyChanged(
if (iter == descriptors_.end())
return;
+ // Ignore all property changes except for "Value".
+ BluetoothGattDescriptorClient::Properties* properties =
+ DBusThreadManager::Get()->GetBluetoothGattDescriptorClient()->
+ GetProperties(object_path);
+ DCHECK(properties);
+ if (property_name != properties->value.name())
+ return;
+
VLOG(1) << "GATT descriptor property changed: " << object_path.value()
<< ", property: " << property_name;
+
+ DCHECK(service_);
+
+ service_->NotifyDescriptorValueChanged(
+ this, iter->second, properties->value.value());
}
void BluetoothRemoteGattCharacteristicChromeOS::OnGetValue(

Powered by Google App Engine
This is Rietveld 408576698