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

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: More win visible fixes 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
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.mm ('k') | device/bluetooth/bluetooth_device_win.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_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 std::string GetAddress() const OVERRIDE;
28 virtual bool IsPaired() const OVERRIDE; 27 virtual bool IsPaired() const OVERRIDE;
29 virtual const ServiceList& GetServices() const OVERRIDE; 28 virtual bool IsConnected() const OVERRIDE;
29 virtual bool IsConnectable() const OVERRIDE;
30 virtual bool IsConnecting() const OVERRIDE;
31 virtual ServiceList GetServices() const OVERRIDE;
30 virtual void GetServiceRecords( 32 virtual void GetServiceRecords(
31 const ServiceRecordsCallback& callback, 33 const ServiceRecordsCallback& callback,
32 const ErrorCallback& error_callback) OVERRIDE; 34 const ErrorCallback& error_callback) OVERRIDE;
33 virtual void ProvidesServiceWithName( 35 virtual void ProvidesServiceWithName(
34 const std::string& name, 36 const std::string& name,
35 const ProvidesServiceCallback& callback) OVERRIDE; 37 const ProvidesServiceCallback& callback) OVERRIDE;
36 virtual bool ExpectingPinCode() const OVERRIDE; 38 virtual bool ExpectingPinCode() const OVERRIDE;
37 virtual bool ExpectingPasskey() const OVERRIDE; 39 virtual bool ExpectingPasskey() const OVERRIDE;
38 virtual bool ExpectingConfirmation() const OVERRIDE; 40 virtual bool ExpectingConfirmation() const OVERRIDE;
39 virtual void Connect( 41 virtual void Connect(
(...skipping 13 matching lines...) Expand all
53 const std::string& service_uuid, 55 const std::string& service_uuid,
54 const SocketCallback& callback) OVERRIDE; 56 const SocketCallback& callback) OVERRIDE;
55 virtual void SetOutOfBandPairingData( 57 virtual void SetOutOfBandPairingData(
56 const BluetoothOutOfBandPairingData& data, 58 const BluetoothOutOfBandPairingData& data,
57 const base::Closure& callback, 59 const base::Closure& callback,
58 const ErrorCallback& error_callback) OVERRIDE; 60 const ErrorCallback& error_callback) OVERRIDE;
59 virtual void ClearOutOfBandPairingData( 61 virtual void ClearOutOfBandPairingData(
60 const base::Closure& callback, 62 const base::Closure& callback,
61 const ErrorCallback& error_callback) OVERRIDE; 63 const ErrorCallback& error_callback) OVERRIDE;
62 64
65 protected:
66 // BluetoothDevice override
67 virtual uint32 GetBluetoothClass() const OVERRIDE;
68 virtual std::string GetDeviceName() const OVERRIDE;
69
63 private: 70 private:
64 friend class BluetoothAdapterWin; 71 friend class BluetoothAdapterWin;
65 72
73 // Used by BluetoothAdapterWin to update the visible state during
74 // discovery.
75 void SetVisible(bool visible);
76
66 // Computes the fingerprint that can be used to compare the devices. 77 // Computes the fingerprint that can be used to compare the devices.
67 static uint32 ComputeDeviceFingerprint( 78 static uint32 ComputeDeviceFingerprint(
68 const BluetoothTaskManagerWin::DeviceState& state); 79 const BluetoothTaskManagerWin::DeviceState& state);
69 80
70 uint32 device_fingerprint() const { 81 uint32 device_fingerprint() const {
71 return device_fingerprint_; 82 return device_fingerprint_;
72 } 83 }
73 84
85 // The Bluetooth class of the device, a bitmask that may be decoded using
86 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
87 uint32 bluetooth_class_;
88
89 // The name of the device, as supplied by the remote device.
90 std::string name_;
91
92 // The Bluetooth address of the device.
93 std::string address_;
94
95 // Tracked device state, updated by the adapter managing the lifecyle of
96 // the device.
97 bool paired_;
98 bool connected_;
99
100 // Used to send change notifications when a device disappears during
101 // discovery.
102 bool visible_;
103
104 // The services (identified by UUIDs) that this device provides.
105 ServiceList service_uuids_;
106
74 // Used to compare the devices. 107 // Used to compare the devices.
75 uint32 device_fingerprint_; 108 uint32 device_fingerprint_;
76 ServiceRecordList service_record_list_; 109 ServiceRecordList service_record_list_;
77 110
78 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin); 111 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin);
79 }; 112 };
80 113
81 } // namespace device 114 } // namespace device
82 115
83 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_ 116 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_mac.mm ('k') | device/bluetooth/bluetooth_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698