| OLD | NEW |
| 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 Loading... |
| 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. The address format is "XX:XX:XX:XX:XX:XX", |
| 95 // where each XX is a hexadecimal number. |
| 96 const std::string& address() const { return address_; } |
| 97 |
| 94 // Indicates whether the adapter is actually present on the system, for | 98 // Indicates whether the adapter is actually present on the system, for |
| 95 // the default adapter this indicates whether any adapter is present. | 99 // the default adapter this indicates whether any adapter is present. |
| 96 bool IsPresent() const; | 100 bool IsPresent() const; |
| 97 | 101 |
| 98 // Indicates whether the adapter radio is powered. | 102 // Indicates whether the adapter radio is powered. |
| 99 bool IsPowered() const; | 103 bool IsPowered() const; |
| 100 | 104 |
| 101 // Requests a change to the adapter radio power, setting |powered| to | 105 // 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| | 106 // true will turn on the radio and false will turn it off. |callback| |
| 103 // will only be called if the request fails. | 107 // will only be called if the request fails. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // Weak pointer factory for generating 'this' pointers that might live longer | 271 // Weak pointer factory for generating 'this' pointers that might live longer |
| 268 // than we do. | 272 // than we do. |
| 269 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 273 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
| 270 | 274 |
| 271 // Object path of adapter for this instance, this is fixed at creation time | 275 // 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 | 276 // unless |track_default_| is true in which case we update it to always |
| 273 // point at the default adapter. | 277 // point at the default adapter. |
| 274 bool track_default_; | 278 bool track_default_; |
| 275 dbus::ObjectPath object_path_; | 279 dbus::ObjectPath object_path_; |
| 276 | 280 |
| 281 // Address of the adapter. |
| 282 std::string address_; |
| 283 |
| 277 // Tracked adapter state, cached locally so we only send change notifications | 284 // Tracked adapter state, cached locally so we only send change notifications |
| 278 // to observers on a genuine change. | 285 // to observers on a genuine change. |
| 279 bool powered_; | 286 bool powered_; |
| 280 bool discovering_; | 287 bool discovering_; |
| 281 | 288 |
| 282 // Devices paired with, connected to, discovered by, or visible to the | 289 // 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 | 290 // 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 | 291 // is the BluetoothDevice object whose lifetime is managed by the adapter |
| 285 // instance. | 292 // instance. |
| 286 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; | 293 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; |
| 287 DevicesMap devices_; | 294 DevicesMap devices_; |
| 288 | 295 |
| 289 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapter); | 296 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapter); |
| 290 }; | 297 }; |
| 291 | 298 |
| 292 } // namespace chromeos | 299 } // namespace chromeos |
| 293 | 300 |
| 294 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 301 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
| OLD | NEW |