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

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

Issue 224893002: device/bluetooth: Rename device::bluetooth_utils::UUID to device::BluetoothUUID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_device.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 DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "device/bluetooth/bluetooth_uuid.h"
14 15
15 namespace device { 16 namespace device {
16 17
17 class BluetoothProfile; 18 class BluetoothProfile;
18 class BluetoothSocket; 19 class BluetoothSocket;
19 20
20 struct BluetoothOutOfBandPairingData; 21 struct BluetoothOutOfBandPairingData;
21 22
22 // BluetoothDevice represents a remote Bluetooth device, both its properties and 23 // BluetoothDevice represents a remote Bluetooth device, both its properties and
23 // capabilities as discovered by a local adapter and actions that may be 24 // capabilities as discovered by a local adapter and actions that may be
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // This method will be called when the Bluetooth daemon requires that a 163 // This method will be called when the Bluetooth daemon requires that a
163 // pairing request, usually only incoming, using the just-works model is 164 // pairing request, usually only incoming, using the just-works model is
164 // authorized. The delegate should decide whether the user should confirm 165 // authorized. The delegate should decide whether the user should confirm
165 // or not, then call ConfirmPairing() on the device to confirm the pairing 166 // or not, then call ConfirmPairing() on the device to confirm the pairing
166 // (whether by user action or by default), RejectPairing() on the device to 167 // (whether by user action or by default), RejectPairing() on the device to
167 // reject or CancelPairing() on the device to cancel authorization for 168 // reject or CancelPairing() on the device to cancel authorization for
168 // any other reason. 169 // any other reason.
169 virtual void AuthorizePairing(BluetoothDevice* device) = 0; 170 virtual void AuthorizePairing(BluetoothDevice* device) = 0;
170 }; 171 };
171 172
172 // Returns true if uuid is in a a valid canonical format
173 // (see utils::CanonicalUuid).
174 static bool IsUUIDValid(const std::string& uuid);
175
176 virtual ~BluetoothDevice(); 173 virtual ~BluetoothDevice();
177 174
178 // Returns the Bluetooth class of the device, used by GetDeviceType() 175 // Returns the Bluetooth class of the device, used by GetDeviceType()
179 // and metrics logging, 176 // and metrics logging,
180 virtual uint32 GetBluetoothClass() const = 0; 177 virtual uint32 GetBluetoothClass() const = 0;
181 178
182 // Returns the Bluetooth of address the device. This should be used as 179 // Returns the Bluetooth of address the device. This should be used as
183 // a unique key to identify the device and copied where needed. 180 // a unique key to identify the device and copied where needed.
184 virtual std::string GetAddress() const = 0; 181 virtual std::string GetAddress() const = 0;
185 182
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 226
230 // Indicates whether there is a call to Connect() ongoing. For this attribute, 227 // Indicates whether there is a call to Connect() ongoing. For this attribute,
231 // we consider a call is ongoing if none of the callbacks passed to Connect() 228 // we consider a call is ongoing if none of the callbacks passed to Connect()
232 // were called after the corresponding call to Connect(). 229 // were called after the corresponding call to Connect().
233 virtual bool IsConnecting() const = 0; 230 virtual bool IsConnecting() const = 0;
234 231
235 // Returns the set of UUIDs that this device supports. For classic Bluetooth 232 // Returns the set of UUIDs that this device supports. For classic Bluetooth
236 // devices this data is collected from both the EIR data and SDP tables, 233 // devices this data is collected from both the EIR data and SDP tables,
237 // for Low Energy devices this data is collected from AD and GATT primary 234 // for Low Energy devices this data is collected from AD and GATT primary
238 // services, for dual mode devices this may be collected from both./ 235 // services, for dual mode devices this may be collected from both./
239 // 236 typedef std::vector<BluetoothUUID> UUIDList;
240 // All UUIDs are returned in the canonical 128-bit format.
241 typedef std::vector<std::string> UUIDList;
242 virtual UUIDList GetUUIDs() const = 0; 237 virtual UUIDList GetUUIDs() const = 0;
243 238
244 // The ErrorCallback is used for methods that can fail in which case it 239 // The ErrorCallback is used for methods that can fail in which case it
245 // is called, in the success case the callback is simply not called. 240 // is called, in the success case the callback is simply not called.
246 typedef base::Callback<void()> ErrorCallback; 241 typedef base::Callback<void()> ErrorCallback;
247 242
248 // The ConnectErrorCallback is used for methods that can fail with an error, 243 // The ConnectErrorCallback is used for methods that can fail with an error,
249 // passed back as an error code argument to this callback. 244 // passed back as an error code argument to this callback.
250 // In the success case this callback is not called. 245 // In the success case this callback is not called.
251 typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback; 246 typedef base::Callback<void(enum ConnectErrorCode)> ConnectErrorCallback;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // There is no callback for success because this object is often deleted 321 // There is no callback for success because this object is often deleted
327 // before that callback would be called. 322 // before that callback would be called.
328 virtual void Forget(const ErrorCallback& error_callback) = 0; 323 virtual void Forget(const ErrorCallback& error_callback) = 0;
329 324
330 // Attempts to open a socket to a service matching |uuid| on this device. If 325 // Attempts to open a socket to a service matching |uuid| on this device. If
331 // the connection is successful, |callback| is called with a BluetoothSocket. 326 // the connection is successful, |callback| is called with a BluetoothSocket.
332 // Otherwise |callback| is called with NULL. The socket is closed as soon as 327 // Otherwise |callback| is called with NULL. The socket is closed as soon as
333 // all references to the BluetoothSocket are released. Note that the 328 // all references to the BluetoothSocket are released. Note that the
334 // BluetoothSocket object can outlive both this BluetoothDevice and the 329 // BluetoothSocket object can outlive both this BluetoothDevice and the
335 // BluetoothAdapter for this device. 330 // BluetoothAdapter for this device.
336 virtual void ConnectToService(const std::string& service_uuid, 331 virtual void ConnectToService(const BluetoothUUID& service_uuid,
337 const SocketCallback& callback) = 0; 332 const SocketCallback& callback) = 0;
338 333
339 // Attempts to initiate an outgoing connection to this device for the profile 334 // Attempts to initiate an outgoing connection to this device for the profile
340 // identified by |profile|, on success the profile's connection callback 335 // identified by |profile|, on success the profile's connection callback
341 // will be called as well as |callback|; on failure |error_callback| will be 336 // will be called as well as |callback|; on failure |error_callback| will be
342 // called. 337 // called.
343 virtual void ConnectToProfile(BluetoothProfile* profile, 338 virtual void ConnectToProfile(BluetoothProfile* profile,
344 const base::Closure& callback, 339 const base::Closure& callback,
345 const ErrorCallback& error_callback) = 0; 340 const ErrorCallback& error_callback) = 0;
346 341
(...skipping 18 matching lines...) Expand all
365 360
366 private: 361 private:
367 // Returns a localized string containing the device's bluetooth address and 362 // Returns a localized string containing the device's bluetooth address and
368 // a device type for display when |name_| is empty. 363 // a device type for display when |name_| is empty.
369 base::string16 GetAddressWithLocalizedDeviceTypeName() const; 364 base::string16 GetAddressWithLocalizedDeviceTypeName() const;
370 }; 365 };
371 366
372 } // namespace device 367 } // namespace device
373 368
374 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 369 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698