summaryrefslogtreecommitdiffstats
path: root/device/bluetooth
diff options
context:
space:
mode:
authorarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 21:40:40 +0000
committerarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 21:40:40 +0000
commit9de24e1772c78dd2265cb0a515f545c94c20a72e (patch)
tree3b45fe079a4f75f38f1327c9c1cc364f7eb1cc92 /device/bluetooth
parent28c837e6d3f4d5417ce162389998f1370f10f69b (diff)
downloadchromium_src-9de24e1772c78dd2265cb0a515f545c94c20a72e.zip
chromium_src-9de24e1772c78dd2265cb0a515f545c94c20a72e.tar.gz
chromium_src-9de24e1772c78dd2265cb0a515f545c94c20a72e.tar.bz2
device/bluetooth: Send GattServiceChanged event for new Chrc. properties.
BluetoothRemoteGattServiceChromeOS now sends a GattServiceChanged observer event when a new value for a characteristic property is received. This is needed when the "Characteristic Extended Properties" descriptor is present for a characteristic and its value is asynchronously read by bluetoothd, which results in a PropertiesChanged signal for the "Flags" property of GattCharacteristic1. BUG=382253 Review URL: https://codereview.chromium.org/346743002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/bluetooth')
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc23
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_service_chromeos.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
index 81aaa3d..4f88edf 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.cc
@@ -250,4 +250,27 @@ void BluetoothRemoteGattServiceChromeOS::GattCharacteristicRemoved(
delete characteristic;
}
+void BluetoothRemoteGattServiceChromeOS::GattCharacteristicPropertyChanged(
+ const dbus::ObjectPath& object_path,
+ const std::string& property_name) {
+ if (characteristics_.find(object_path) == characteristics_.end()) {
+ VLOG(2) << "Properties of unknown characteristic changed";
+ return;
+ }
+
+ // We may receive a property changed event in certain cases, e.g. when the
+ // characteristic "Flags" property has been updated with values from the
+ // "Characteristic Extended Properties" descriptor. In this case, kick off
+ // a service changed observer event to let observers refresh the
+ // characteristics.
+ BluetoothGattCharacteristicClient::Properties* properties =
+ DBusThreadManager::Get()->GetBluetoothGattCharacteristicClient()->
+ GetProperties(object_path);
+ DCHECK(properties);
+ if (property_name != properties->flags.name())
+ return;
+
+ NotifyServiceChanged();
+}
+
} // namespace chromeos
diff --git a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
index e490ffc..c9de5ce 100644
--- a/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
+++ b/device/bluetooth/bluetooth_remote_gatt_service_chromeos.h
@@ -113,6 +113,9 @@ class BluetoothRemoteGattServiceChromeOS
const dbus::ObjectPath& object_path) OVERRIDE;
virtual void GattCharacteristicRemoved(
const dbus::ObjectPath& object_path) OVERRIDE;
+ virtual void GattCharacteristicPropertyChanged(
+ const dbus::ObjectPath& object_path,
+ const std::string& property_name) OVERRIDE;
// Object path of the GATT service.
dbus::ObjectPath object_path_;