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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_service_chromeos.h

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, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 22 matching lines...) Expand all
33 class BluetoothRemoteGattDescriptorChromeOS; 33 class BluetoothRemoteGattDescriptorChromeOS;
34 34
35 // The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService 35 // The BluetoothRemoteGattServiceChromeOS class implements BluetootGattService
36 // for remote GATT services on the the Chrome OS platform. 36 // for remote GATT services on the the Chrome OS platform.
37 class BluetoothRemoteGattServiceChromeOS 37 class BluetoothRemoteGattServiceChromeOS
38 : public device::BluetoothGattService, 38 : public device::BluetoothGattService,
39 public BluetoothGattServiceClient::Observer, 39 public BluetoothGattServiceClient::Observer,
40 public BluetoothGattCharacteristicClient::Observer { 40 public BluetoothGattCharacteristicClient::Observer {
41 public: 41 public:
42 // device::BluetoothGattService overrides. 42 // device::BluetoothGattService overrides.
43 virtual void AddObserver(
44 device::BluetoothGattService::Observer* observer) OVERRIDE;
45 virtual void RemoveObserver(
46 device::BluetoothGattService::Observer* observer) OVERRIDE;
47 virtual std::string GetIdentifier() const OVERRIDE; 43 virtual std::string GetIdentifier() const OVERRIDE;
48 virtual device::BluetoothUUID GetUUID() const OVERRIDE; 44 virtual device::BluetoothUUID GetUUID() const OVERRIDE;
49 virtual bool IsLocal() const OVERRIDE; 45 virtual bool IsLocal() const OVERRIDE;
50 virtual bool IsPrimary() const OVERRIDE; 46 virtual bool IsPrimary() const OVERRIDE;
51 virtual device::BluetoothDevice* GetDevice() const OVERRIDE; 47 virtual device::BluetoothDevice* GetDevice() const OVERRIDE;
52 virtual std::vector<device::BluetoothGattCharacteristic*> 48 virtual std::vector<device::BluetoothGattCharacteristic*>
53 GetCharacteristics() const OVERRIDE; 49 GetCharacteristics() const OVERRIDE;
54 virtual std::vector<device::BluetoothGattService*> 50 virtual std::vector<device::BluetoothGattService*>
55 GetIncludedServices() const OVERRIDE; 51 GetIncludedServices() const OVERRIDE;
56 virtual device::BluetoothGattCharacteristic* GetCharacteristic( 52 virtual device::BluetoothGattCharacteristic* GetCharacteristic(
57 const std::string& identifier) const OVERRIDE; 53 const std::string& identifier) const OVERRIDE;
58 virtual bool AddCharacteristic( 54 virtual bool AddCharacteristic(
59 device::BluetoothGattCharacteristic* characteristic) OVERRIDE; 55 device::BluetoothGattCharacteristic* characteristic) OVERRIDE;
60 virtual bool AddIncludedService( 56 virtual bool AddIncludedService(
61 device::BluetoothGattService* service) OVERRIDE; 57 device::BluetoothGattService* service) OVERRIDE;
62 virtual void Register(const base::Closure& callback, 58 virtual void Register(const base::Closure& callback,
63 const ErrorCallback& error_callback) OVERRIDE; 59 const ErrorCallback& error_callback) OVERRIDE;
64 virtual void Unregister(const base::Closure& callback, 60 virtual void Unregister(const base::Closure& callback,
65 const ErrorCallback& error_callback) OVERRIDE; 61 const ErrorCallback& error_callback) OVERRIDE;
66 62
67 // Object path of the underlying service. 63 // Object path of the underlying service.
68 const dbus::ObjectPath& object_path() const { return object_path_; } 64 const dbus::ObjectPath& object_path() const { return object_path_; }
69 65
70 // Returns the adapter associated with this service. 66 // Returns the adapter associated with this service.
71 scoped_refptr<device::BluetoothAdapter> GetAdapter() const; 67 BluetoothAdapterChromeOS* GetAdapter() const;
72 68
73 // Notifies its observers that the GATT service has changed. This is mainly 69 // Notifies its observers that the GATT service has changed. This is mainly
74 // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify 70 // used by BluetoothRemoteGattCharacteristicChromeOS instances to notify
75 // service observers when characteristic descriptors get added and removed. 71 // service observers when characteristic descriptors get added and removed.
76 void NotifyServiceChanged(); 72 void NotifyServiceChanged();
77 73
78 // Notifies its observers that the value of a characteristic has changed. 74 // Notifies its observers that the value of a characteristic has changed.
79 // Called by BluetoothRemoteGattCharacteristicChromeOS instances to notify 75 // Called by BluetoothRemoteGattCharacteristicChromeOS instances to notify
80 // service observers when their cached value is updated after a successful 76 // service observers when their cached value is updated after a successful
81 // read request or when a "ValueUpdated" signal is received. 77 // read request or when a "ValueUpdated" signal is received.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 const dbus::ObjectPath& object_path) OVERRIDE; 116 const dbus::ObjectPath& object_path) OVERRIDE;
121 virtual void GattCharacteristicRemoved( 117 virtual void GattCharacteristicRemoved(
122 const dbus::ObjectPath& object_path) OVERRIDE; 118 const dbus::ObjectPath& object_path) OVERRIDE;
123 virtual void GattCharacteristicPropertyChanged( 119 virtual void GattCharacteristicPropertyChanged(
124 const dbus::ObjectPath& object_path, 120 const dbus::ObjectPath& object_path,
125 const std::string& property_name) OVERRIDE; 121 const std::string& property_name) OVERRIDE;
126 122
127 // Object path of the GATT service. 123 // Object path of the GATT service.
128 dbus::ObjectPath object_path_; 124 dbus::ObjectPath object_path_;
129 125
130 // List of observers interested in event notifications from us.
131 ObserverList<device::BluetoothGattService::Observer> observers_;
132
133 // The adapter associated with this service. It's ok to store a raw pointer 126 // The adapter associated with this service. It's ok to store a raw pointer
134 // here since |adapter_| indirectly owns this instance. 127 // here since |adapter_| indirectly owns this instance.
135 BluetoothAdapterChromeOS* adapter_; 128 BluetoothAdapterChromeOS* adapter_;
136 129
137 // The device this GATT service belongs to. It's ok to store a raw pointer 130 // The device this GATT service belongs to. It's ok to store a raw pointer
138 // here since |device_| owns this instance. 131 // here since |device_| owns this instance.
139 BluetoothDeviceChromeOS* device_; 132 BluetoothDeviceChromeOS* device_;
140 133
141 // Mapping from GATT characteristic object paths to characteristic objects. 134 // Mapping from GATT characteristic object paths to characteristic objects.
142 // owned by this service. Since the Chrome OS implementation uses object 135 // owned by this service. Since the Chrome OS implementation uses object
(...skipping 10 matching lines...) Expand all
153 // Note: This should remain the last member so it'll be destroyed and 146 // Note: This should remain the last member so it'll be destroyed and
154 // invalidate its weak pointers before any other members are destroyed. 147 // invalidate its weak pointers before any other members are destroyed.
155 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_; 148 base::WeakPtrFactory<BluetoothRemoteGattServiceChromeOS> weak_ptr_factory_;
156 149
157 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS); 150 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattServiceChromeOS);
158 }; 151 };
159 152
160 } // namespace chromeos 153 } // namespace chromeos
161 154
162 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_ 155 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_SERVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698