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

Unified Diff: device/bluetooth/bluetooth_adapter_chromeos.cc

Issue 418483003: device/bluetooth: Move GATT observer methods to BluetoothAdapter::Observer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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_adapter_chromeos.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_chromeos.cc
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
index bdfa4cee64cd24d10af42158cf66de5ce5f516e9..a5f1a98e6e62ff015621560292779f3f78896f86 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -22,6 +22,9 @@
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_device_chromeos.h"
#include "device/bluetooth/bluetooth_pairing_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_characteristic_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_descriptor_chromeos.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "device/bluetooth/bluetooth_socket_chromeos.h"
#include "device/bluetooth/bluetooth_socket_thread.h"
#include "device/bluetooth/bluetooth_uuid.h"
@@ -752,6 +755,117 @@ void BluetoothAdapterChromeOS::NotifyDeviceChanged(
DeviceChanged(this, device));
}
+void BluetoothAdapterChromeOS::NotifyGattServiceAdded(
+ BluetoothRemoteGattServiceChromeOS* service) {
+ DCHECK_EQ(service->GetAdapter(), this);
+ DCHECK_EQ(
+ static_cast<BluetoothDeviceChromeOS*>(service->GetDevice())->adapter_,
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattServiceAdded(this, service->GetDevice(), service));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattServiceRemoved(
+ BluetoothRemoteGattServiceChromeOS* service) {
+ DCHECK_EQ(service->GetAdapter(), this);
+ DCHECK_EQ(
+ static_cast<BluetoothDeviceChromeOS*>(service->GetDevice())->adapter_,
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattServiceRemoved(this, service->GetDevice(), service));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattServiceChanged(
+ BluetoothRemoteGattServiceChromeOS* service) {
+ DCHECK_EQ(service->GetAdapter(), this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattServiceChanged(this, service));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattDiscoveryComplete(
+ BluetoothRemoteGattServiceChromeOS* service) {
+ DCHECK_EQ(service->GetAdapter(), this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattDiscoveryCompleteForService(this, service));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattCharacteristicAdded(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ characteristic->GetService())->GetAdapter(),
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattCharacteristicAdded(this, characteristic));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattCharacteristicRemoved(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ characteristic->GetService())->GetAdapter(),
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattCharacteristicRemoved(this, characteristic));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattDescriptorAdded(
+ BluetoothRemoteGattDescriptorChromeOS* descriptor) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ descriptor->GetCharacteristic()->GetService())->GetAdapter(),
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattDescriptorAdded(this, descriptor));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattDescriptorRemoved(
+ BluetoothRemoteGattDescriptorChromeOS* descriptor) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ descriptor->GetCharacteristic()->GetService())->GetAdapter(),
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattDescriptorRemoved(this, descriptor));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattCharacteristicValueChanged(
+ BluetoothRemoteGattCharacteristicChromeOS* characteristic,
+ const std::vector<uint8>& value) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ characteristic->GetService())->GetAdapter(),
+ this);
+
+ FOR_EACH_OBSERVER(
+ BluetoothAdapter::Observer,
+ observers_,
+ GattCharacteristicValueChanged(this, characteristic, value));
+}
+
+void BluetoothAdapterChromeOS::NotifyGattDescriptorValueChanged(
+ BluetoothRemoteGattDescriptorChromeOS* descriptor,
+ const std::vector<uint8>& value) {
+ DCHECK_EQ(static_cast<BluetoothRemoteGattServiceChromeOS*>(
+ descriptor->GetCharacteristic()->GetService())->GetAdapter(),
+ this);
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer,
+ observers_,
+ GattDescriptorValueChanged(this, descriptor, value));
+}
+
void BluetoothAdapterChromeOS::OnSetDiscoverable(
const base::Closure& callback,
const ErrorCallback& error_callback,
« no previous file with comments | « device/bluetooth/bluetooth_adapter_chromeos.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698