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

Side by Side Diff: chrome/browser/chromeos/bluetooth/bluetooth_adapter.h

Issue 9826018: Expose the bluetooth address of the adapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 8 years, 9 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 | « no previous file | chrome/browser/chromeos/bluetooth/bluetooth_adapter.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Adds and removes observers for events on this bluetooth adapter, 84 // Adds and removes observers for events on this bluetooth adapter,
85 // if monitoring multiple adapters check the |adapter| parameter of 85 // if monitoring multiple adapters check the |adapter| parameter of
86 // observer methods to determine which adapter is issuing the event. 86 // observer methods to determine which adapter is issuing the event.
87 void AddObserver(Observer* observer); 87 void AddObserver(Observer* observer);
88 void RemoveObserver(Observer* observer); 88 void RemoveObserver(Observer* observer);
89 89
90 // The ErrorCallback is used for methods that can fail in which case it 90 // The ErrorCallback is used for methods that can fail in which case it
91 // is called, in the success case the callback is simply not called. 91 // is called, in the success case the callback is simply not called.
92 typedef base::Callback<void()> ErrorCallback; 92 typedef base::Callback<void()> ErrorCallback;
93 93
94 // The address of this adapter.
satorux1 2012/03/22 17:35:31 nit: might want to document how this looks like wi
95 const std::string& address() const { return address_; }
96
94 // Indicates whether the adapter is actually present on the system, for 97 // Indicates whether the adapter is actually present on the system, for
95 // the default adapter this indicates whether any adapter is present. 98 // the default adapter this indicates whether any adapter is present.
96 bool IsPresent() const; 99 bool IsPresent() const;
97 100
98 // Indicates whether the adapter radio is powered. 101 // Indicates whether the adapter radio is powered.
99 bool IsPowered() const; 102 bool IsPowered() const;
100 103
101 // Requests a change to the adapter radio power, setting |powered| to 104 // Requests a change to the adapter radio power, setting |powered| to
102 // true will turn on the radio and false will turn it off. |callback| 105 // true will turn on the radio and false will turn it off. |callback|
103 // will only be called if the request fails. 106 // will only be called if the request fails.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // Weak pointer factory for generating 'this' pointers that might live longer 270 // Weak pointer factory for generating 'this' pointers that might live longer
268 // than we do. 271 // than we do.
269 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; 272 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_;
270 273
271 // Object path of adapter for this instance, this is fixed at creation time 274 // Object path of adapter for this instance, this is fixed at creation time
272 // unless |track_default_| is true in which case we update it to always 275 // unless |track_default_| is true in which case we update it to always
273 // point at the default adapter. 276 // point at the default adapter.
274 bool track_default_; 277 bool track_default_;
275 dbus::ObjectPath object_path_; 278 dbus::ObjectPath object_path_;
276 279
280 // Address of the adapter.
281 std::string address_;
282
277 // Tracked adapter state, cached locally so we only send change notifications 283 // Tracked adapter state, cached locally so we only send change notifications
278 // to observers on a genuine change. 284 // to observers on a genuine change.
279 bool powered_; 285 bool powered_;
280 bool discovering_; 286 bool discovering_;
281 287
282 // Devices paired with, connected to, discovered by, or visible to the 288 // Devices paired with, connected to, discovered by, or visible to the
283 // adapter. The key is the Bluetooth address of the device and the value 289 // adapter. The key is the Bluetooth address of the device and the value
284 // is the BluetoothDevice object whose lifetime is managed by the adapter 290 // is the BluetoothDevice object whose lifetime is managed by the adapter
285 // instance. 291 // instance.
286 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; 292 typedef std::map<const std::string, BluetoothDevice*> DevicesMap;
287 DevicesMap devices_; 293 DevicesMap devices_;
288 294
289 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapter); 295 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapter);
290 }; 296 };
291 297
292 } // namespace chromeos 298 } // namespace chromeos
293 299
294 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 300 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698