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

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

Issue 13983004: Simplified BluetoothDeviceMac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments. 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_
6 #define DEVICE_BLUETOOTH_BlUETOOTH_DEVICE_MAC_H_ 6 #define DEVICE_BLUETOOTH_BlUETOOTH_DEVICE_MAC_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "device/bluetooth/bluetooth_device.h" 11 #include "device/bluetooth/bluetooth_device.h"
12 12
13 #ifdef __OBJC__ 13 #ifdef __OBJC__
14 @class IOBluetoothDevice; 14 @class IOBluetoothDevice;
15 #else 15 #else
16 class IOBluetoothDevice; 16 class IOBluetoothDevice;
17 #endif 17 #endif
18 18
19 namespace device { 19 namespace device {
20 20
21 class BluetoothDeviceMac : public BluetoothDevice { 21 class BluetoothDeviceMac : public BluetoothDevice {
22 public: 22 public:
23 explicit BluetoothDeviceMac(const IOBluetoothDevice* device); 23 explicit BluetoothDeviceMac(IOBluetoothDevice* device);
24 virtual ~BluetoothDeviceMac(); 24 virtual ~BluetoothDeviceMac();
25 25
26 // BluetoothDevice override 26 // BluetoothDevice override
27 virtual std::string GetAddress() const OVERRIDE; 27 virtual std::string GetAddress() const OVERRIDE;
28 virtual bool IsPaired() const OVERRIDE; 28 virtual bool IsPaired() const OVERRIDE;
29 virtual bool IsConnected() const OVERRIDE; 29 virtual bool IsConnected() const OVERRIDE;
30 virtual bool IsConnectable() const OVERRIDE; 30 virtual bool IsConnectable() const OVERRIDE;
31 virtual bool IsConnecting() const OVERRIDE; 31 virtual bool IsConnecting() const OVERRIDE;
32 virtual ServiceList GetServices() const OVERRIDE; 32 virtual ServiceList GetServices() const OVERRIDE;
33 virtual void GetServiceRecords( 33 virtual void GetServiceRecords(
(...skipping 30 matching lines...) Expand all
64 const ErrorCallback& error_callback) OVERRIDE; 64 const ErrorCallback& error_callback) OVERRIDE;
65 65
66 protected: 66 protected:
67 // BluetoothDevice override 67 // BluetoothDevice override
68 virtual uint32 GetBluetoothClass() const OVERRIDE; 68 virtual uint32 GetBluetoothClass() const OVERRIDE;
69 virtual std::string GetDeviceName() const OVERRIDE; 69 virtual std::string GetDeviceName() const OVERRIDE;
70 70
71 private: 71 private:
72 friend class BluetoothAdapterMac; 72 friend class BluetoothAdapterMac;
73 73
74 // Computes the fingerprint that can be used to compare the devices. 74 IOBluetoothDevice* device_;
75 static uint32 ComputeDeviceFingerprint(const IOBluetoothDevice* device);
76
77 uint32 device_fingerprint() const {
78 return device_fingerprint_;
79 }
80
81 // The Bluetooth class of the device, a bitmask that may be decoded using
82 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
83 uint32 bluetooth_class_;
84
85 // The name of the device, as supplied by the remote device.
86 std::string name_;
87
88 // The Bluetooth address of the device.
89 std::string address_;
90
91 // Tracked device state, updated by the adapter managing the lifecyle of
92 // the device.
93 bool paired_;
94 bool connected_;
95
96 // The services (identified by UUIDs) that this device provides.
97 ServiceList service_uuids_;
98
99 // Used to compare the devices.
100 const uint32 device_fingerprint_;
101 ServiceRecordList service_record_list_;
102 75
103 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); 76 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac);
104 }; 77 };
105 78
106 } // namespace device 79 } // namespace device
107 80
108 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ 81 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_device_mac.mm » ('j') | device/bluetooth/bluetooth_device_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698