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 DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // Adds and removes observers for events on this bluetooth adapter, | 80 // Adds and removes observers for events on this bluetooth adapter, |
81 // if monitoring multiple adapters check the |adapter| parameter of | 81 // if monitoring multiple adapters check the |adapter| parameter of |
82 // observer methods to determine which adapter is issuing the event. | 82 // observer methods to determine which adapter is issuing the event. |
83 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0; | 83 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0; |
84 virtual void RemoveObserver( | 84 virtual void RemoveObserver( |
85 BluetoothAdapter::Observer* observer) = 0; | 85 BluetoothAdapter::Observer* observer) = 0; |
86 | 86 |
87 // The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX", | 87 // The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX", |
88 // where each XX is a hexadecimal number. | 88 // where each XX is a hexadecimal number. |
89 virtual std::string address() const = 0; | 89 virtual std::string GetAddress() const = 0; |
90 | 90 |
91 // The name of the adapter. | 91 // The name of the adapter. |
92 virtual std::string name() const = 0; | 92 virtual std::string GetName() const = 0; |
93 | 93 |
94 // Indicates whether the adapter is initialized and ready to use. | 94 // Indicates whether the adapter is initialized and ready to use. |
95 virtual bool IsInitialized() const = 0; | 95 virtual bool IsInitialized() const = 0; |
96 | 96 |
97 // Indicates whether the adapter is actually present on the system, for | 97 // Indicates whether the adapter is actually present on the system, for |
98 // the default adapter this indicates whether any adapter is present. An | 98 // the default adapter this indicates whether any adapter is present. An |
99 // adapter is only considered present if the address has been obtained. | 99 // adapter is only considered present if the address has been obtained. |
100 virtual bool IsPresent() const = 0; | 100 virtual bool IsPresent() const = 0; |
101 | 101 |
102 // Indicates whether the adapter radio is powered. | 102 // Indicates whether the adapter radio is powered. |
(...skipping 11 matching lines...) Expand all Loading... |
114 | 114 |
115 // Requests that the adapter begin discovering new devices, code must | 115 // Requests that the adapter begin discovering new devices, code must |
116 // always call this method if they require the adapter be in discovery | 116 // always call this method if they require the adapter be in discovery |
117 // and should not make it conditional on the value of IsDiscovering() | 117 // and should not make it conditional on the value of IsDiscovering() |
118 // as other adapter users may be making the same request. Code must also | 118 // as other adapter users may be making the same request. Code must also |
119 // call StopDiscovering() when done. On success |callback| will be called, | 119 // call StopDiscovering() when done. On success |callback| will be called, |
120 // on failure |error_callback| will be called instead. | 120 // on failure |error_callback| will be called instead. |
121 // | 121 // |
122 // Since discovery may already be in progress when this method is called, | 122 // Since discovery may already be in progress when this method is called, |
123 // callers should retrieve the current set of discovered devices by calling | 123 // callers should retrieve the current set of discovered devices by calling |
124 // GetDevices() and checking for those with IsVisible() as true. | 124 // GetDevices() and checking for those with IsPaired() as false. |
125 virtual void StartDiscovering(const base::Closure& callback, | 125 virtual void StartDiscovering(const base::Closure& callback, |
126 const ErrorCallback& error_callback) = 0; | 126 const ErrorCallback& error_callback) = 0; |
127 | 127 |
128 // Requests that an earlier call to StartDiscovering() be cancelled; the | 128 // Requests that an earlier call to StartDiscovering() be cancelled; the |
129 // adapter may not actually cease discovering devices if other callers | 129 // adapter may not actually cease discovering devices if other callers |
130 // have called StartDiscovering() and not yet called this method. On | 130 // have called StartDiscovering() and not yet called this method. On |
131 // success |callback| will be called, on failure |error_callback| will be | 131 // success |callback| will be called, on failure |error_callback| will be |
132 // called instead. | 132 // called instead. |
133 virtual void StopDiscovering(const base::Closure& callback, | 133 virtual void StopDiscovering(const base::Closure& callback, |
134 const ErrorCallback& error_callback) = 0; | 134 const ErrorCallback& error_callback) = 0; |
(...skipping 26 matching lines...) Expand all Loading... |
161 // adapter. The key is the Bluetooth address of the device and the value | 161 // adapter. The key is the Bluetooth address of the device and the value |
162 // is the BluetoothDevice object whose lifetime is managed by the | 162 // is the BluetoothDevice object whose lifetime is managed by the |
163 // adapter instance. | 163 // adapter instance. |
164 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; | 164 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; |
165 DevicesMap devices_; | 165 DevicesMap devices_; |
166 }; | 166 }; |
167 | 167 |
168 } // namespace device | 168 } // namespace device |
169 | 169 |
170 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 170 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |