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

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

Issue 13416005: Bluetooth: clean up BluetoothDevice (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make GetServices return a copy of the list Created 7 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_WIN_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "device/bluetooth/bluetooth_device.h" 12 #include "device/bluetooth/bluetooth_device.h"
13 #include "device/bluetooth/bluetooth_task_manager_win.h" 13 #include "device/bluetooth/bluetooth_task_manager_win.h"
14 14
15 namespace device { 15 namespace device {
16 16
17 class BluetoothAdapterWin; 17 class BluetoothAdapterWin;
18 18
19 class BluetoothDeviceWin : public BluetoothDevice { 19 class BluetoothDeviceWin : public BluetoothDevice {
20 public: 20 public:
21 explicit BluetoothDeviceWin( 21 explicit BluetoothDeviceWin(
22 const BluetoothTaskManagerWin::DeviceState& state); 22 const BluetoothTaskManagerWin::DeviceState& state);
23 virtual ~BluetoothDeviceWin(); 23 virtual ~BluetoothDeviceWin();
24 24
25 void SetVisible(bool visible);
26
27 // BluetoothDevice override 25 // BluetoothDevice override
26 virtual uint32 bluetooth_class() const OVERRIDE;
27 virtual std::string name() const OVERRIDE;
28 virtual std::string address() const OVERRIDE;
28 virtual bool IsPaired() const OVERRIDE; 29 virtual bool IsPaired() const OVERRIDE;
29 virtual const ServiceList& GetServices() const OVERRIDE; 30 virtual bool IsConnected() const OVERRIDE;
31 virtual bool IsConnectable() const OVERRIDE;
32 virtual bool IsConnecting() const OVERRIDE;
33 virtual ServiceList GetServices() const OVERRIDE;
30 virtual void GetServiceRecords( 34 virtual void GetServiceRecords(
31 const ServiceRecordsCallback& callback, 35 const ServiceRecordsCallback& callback,
32 const ErrorCallback& error_callback) OVERRIDE; 36 const ErrorCallback& error_callback) OVERRIDE;
33 virtual void ProvidesServiceWithName( 37 virtual void ProvidesServiceWithName(
34 const std::string& name, 38 const std::string& name,
35 const ProvidesServiceCallback& callback) OVERRIDE; 39 const ProvidesServiceCallback& callback) OVERRIDE;
36 virtual bool ExpectingPinCode() const OVERRIDE; 40 virtual bool ExpectingPinCode() const OVERRIDE;
37 virtual bool ExpectingPasskey() const OVERRIDE; 41 virtual bool ExpectingPasskey() const OVERRIDE;
38 virtual bool ExpectingConfirmation() const OVERRIDE; 42 virtual bool ExpectingConfirmation() const OVERRIDE;
39 virtual void Connect( 43 virtual void Connect(
(...skipping 24 matching lines...) Expand all
64 friend class BluetoothAdapterWin; 68 friend class BluetoothAdapterWin;
65 69
66 // Computes the fingerprint that can be used to compare the devices. 70 // Computes the fingerprint that can be used to compare the devices.
67 static uint32 ComputeDeviceFingerprint( 71 static uint32 ComputeDeviceFingerprint(
68 const BluetoothTaskManagerWin::DeviceState& state); 72 const BluetoothTaskManagerWin::DeviceState& state);
69 73
70 uint32 device_fingerprint() const { 74 uint32 device_fingerprint() const {
71 return device_fingerprint_; 75 return device_fingerprint_;
72 } 76 }
73 77
78 // The Bluetooth class of the device, a bitmask that may be decoded using
79 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
80 uint32 bluetooth_class_;
81
82 // The name of the device, as supplied by the remote device.
83 std::string name_;
84
85 // The Bluetooth address of the device.
86 std::string address_;
87
88 // Tracked device state, updated by the adapter managing the lifecyle of
89 // the device.
90 bool paired_;
91 bool connected_;
92
93 // The services (identified by UUIDs) that this device provides.
94 ServiceList service_uuids_;
95
74 // Used to compare the devices. 96 // Used to compare the devices.
75 uint32 device_fingerprint_; 97 uint32 device_fingerprint_;
76 ServiceRecordList service_record_list_; 98 ServiceRecordList service_record_list_;
77 99
78 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); 100 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin);
79 }; 101 };
80 102
81 } // namespace device 103 } // namespace device
82 104
83 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ 105 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698