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

Side by Side Diff: device/bluetooth/bluetooth_device_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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DEVICE_CHROMEOS_H 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h"
14 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
15 #include "chromeos/dbus/bluetooth_device_client.h" 14 #include "chromeos/dbus/bluetooth_device_client.h"
16 #include "chromeos/dbus/bluetooth_gatt_service_client.h" 15 #include "chromeos/dbus/bluetooth_gatt_service_client.h"
17 #include "dbus/object_path.h" 16 #include "dbus/object_path.h"
18 #include "device/bluetooth/bluetooth_device.h" 17 #include "device/bluetooth/bluetooth_device.h"
19 18
20 namespace device { 19 namespace device {
21 class BluetoothSocketThread; 20 class BluetoothSocketThread;
22 } // namespace device 21 } // namespace device
23 22
24 namespace chromeos { 23 namespace chromeos {
25 24
26 class BluetoothAdapterChromeOS; 25 class BluetoothAdapterChromeOS;
27 class BluetoothPairingChromeOS; 26 class BluetoothPairingChromeOS;
28 27
29 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the 28 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the
30 // Chrome OS platform. 29 // Chrome OS platform.
31 class BluetoothDeviceChromeOS 30 class BluetoothDeviceChromeOS
32 : public device::BluetoothDevice, 31 : public device::BluetoothDevice,
33 public BluetoothGattServiceClient::Observer { 32 public BluetoothGattServiceClient::Observer {
34 public: 33 public:
35 // BluetoothDevice override 34 // BluetoothDevice override
36 virtual void AddObserver(
37 device::BluetoothDevice::Observer* observer) OVERRIDE;
38 virtual void RemoveObserver(
39 device::BluetoothDevice::Observer* observer) OVERRIDE;
40 virtual uint32 GetBluetoothClass() const OVERRIDE; 35 virtual uint32 GetBluetoothClass() const OVERRIDE;
41 virtual std::string GetAddress() const OVERRIDE; 36 virtual std::string GetAddress() const OVERRIDE;
42 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; 37 virtual VendorIDSource GetVendorIDSource() const OVERRIDE;
43 virtual uint16 GetVendorID() const OVERRIDE; 38 virtual uint16 GetVendorID() const OVERRIDE;
44 virtual uint16 GetProductID() const OVERRIDE; 39 virtual uint16 GetProductID() const OVERRIDE;
45 virtual uint16 GetDeviceID() const OVERRIDE; 40 virtual uint16 GetDeviceID() const OVERRIDE;
46 virtual int GetRSSI() const OVERRIDE; 41 virtual int GetRSSI() const OVERRIDE;
47 virtual int GetCurrentHostTransmitPower() const OVERRIDE; 42 virtual int GetCurrentHostTransmitPower() const OVERRIDE;
48 virtual int GetMaximumHostTransmitPower() const OVERRIDE; 43 virtual int GetMaximumHostTransmitPower() const OVERRIDE;
49 virtual bool IsPaired() const OVERRIDE; 44 virtual bool IsPaired() const OVERRIDE;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void OnStartConnectionMonitorError(const ErrorCallback& error_callback, 160 void OnStartConnectionMonitorError(const ErrorCallback& error_callback,
166 const std::string& error_name, 161 const std::string& error_name,
167 const std::string& error_message); 162 const std::string& error_message);
168 163
169 // The adapter that owns this device instance. 164 // The adapter that owns this device instance.
170 BluetoothAdapterChromeOS* adapter_; 165 BluetoothAdapterChromeOS* adapter_;
171 166
172 // The dbus object path of the device object. 167 // The dbus object path of the device object.
173 dbus::ObjectPath object_path_; 168 dbus::ObjectPath object_path_;
174 169
175 // List of observers interested in event notifications from us.
176 ObserverList<device::BluetoothDevice::Observer> observers_;
177
178 // Number of ongoing calls to Connect(). 170 // Number of ongoing calls to Connect().
179 int num_connecting_calls_; 171 int num_connecting_calls_;
180 172
181 // True if the connection monitor has been started, tracking the connection 173 // True if the connection monitor has been started, tracking the connection
182 // RSSI and TX power. 174 // RSSI and TX power.
183 bool connection_monitor_started_; 175 bool connection_monitor_started_;
184 176
185 // UI thread task runner and socket thread object used to create sockets. 177 // UI thread task runner and socket thread object used to create sockets.
186 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; 178 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
187 scoped_refptr<device::BluetoothSocketThread> socket_thread_; 179 scoped_refptr<device::BluetoothSocketThread> socket_thread_;
188 180
189 // During pairing this is set to an object that we don't own, but on which 181 // During pairing this is set to an object that we don't own, but on which
190 // we can make method calls to request, display or confirm PIN Codes and 182 // we can make method calls to request, display or confirm PIN Codes and
191 // Passkeys. Generally it is the object that owns this one. 183 // Passkeys. Generally it is the object that owns this one.
192 scoped_ptr<BluetoothPairingChromeOS> pairing_; 184 scoped_ptr<BluetoothPairingChromeOS> pairing_;
193 185
194 // Note: This should remain the last member so it'll be destroyed and 186 // Note: This should remain the last member so it'll be destroyed and
195 // invalidate its weak pointers before any other members are destroyed. 187 // invalidate its weak pointers before any other members are destroyed.
196 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; 188 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_;
197 189
198 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); 190 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS);
199 }; 191 };
200 192
201 } // namespace chromeos 193 } // namespace chromeos
202 194
203 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H 195 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.h ('k') | device/bluetooth/bluetooth_device_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698