OLD | NEW |
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 Loading... |
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_ |
OLD | NEW |