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

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

Issue 220323004: device/bluetooth: Rename device::bluetooth_utils::UUID to device::BluetoothUUID (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on top of recent change by tengs@. 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
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
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

Powered by Google App Engine
This is Rietveld 408576698