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(const 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 bool IsPaired() const OVERRIDE; | 28 virtual bool IsPaired() const OVERRIDE; |
28 virtual const ServiceList& GetServices() const OVERRIDE; | 29 virtual bool IsConnected() const OVERRIDE; |
| 30 virtual bool IsConnectable() const OVERRIDE; |
| 31 virtual bool IsConnecting() const OVERRIDE; |
| 32 virtual ServiceList GetServices() const OVERRIDE; |
29 virtual void GetServiceRecords( | 33 virtual void GetServiceRecords( |
30 const ServiceRecordsCallback& callback, | 34 const ServiceRecordsCallback& callback, |
31 const ErrorCallback& error_callback) OVERRIDE; | 35 const ErrorCallback& error_callback) OVERRIDE; |
32 virtual void ProvidesServiceWithName( | 36 virtual void ProvidesServiceWithName( |
33 const std::string& name, | 37 const std::string& name, |
34 const ProvidesServiceCallback& callback) OVERRIDE; | 38 const ProvidesServiceCallback& callback) OVERRIDE; |
35 virtual bool ExpectingPinCode() const OVERRIDE; | 39 virtual bool ExpectingPinCode() const OVERRIDE; |
36 virtual bool ExpectingPasskey() const OVERRIDE; | 40 virtual bool ExpectingPasskey() const OVERRIDE; |
37 virtual bool ExpectingConfirmation() const OVERRIDE; | 41 virtual bool ExpectingConfirmation() const OVERRIDE; |
38 virtual void Connect( | 42 virtual void Connect( |
(...skipping 13 matching lines...) Expand all Loading... |
52 const std::string& service_uuid, | 56 const std::string& service_uuid, |
53 const SocketCallback& callback) OVERRIDE; | 57 const SocketCallback& callback) OVERRIDE; |
54 virtual void SetOutOfBandPairingData( | 58 virtual void SetOutOfBandPairingData( |
55 const BluetoothOutOfBandPairingData& data, | 59 const BluetoothOutOfBandPairingData& data, |
56 const base::Closure& callback, | 60 const base::Closure& callback, |
57 const ErrorCallback& error_callback) OVERRIDE; | 61 const ErrorCallback& error_callback) OVERRIDE; |
58 virtual void ClearOutOfBandPairingData( | 62 virtual void ClearOutOfBandPairingData( |
59 const base::Closure& callback, | 63 const base::Closure& callback, |
60 const ErrorCallback& error_callback) OVERRIDE; | 64 const ErrorCallback& error_callback) OVERRIDE; |
61 | 65 |
| 66 protected: |
| 67 // BluetoothDevice override |
| 68 virtual uint32 GetBluetoothClass() const OVERRIDE; |
| 69 virtual std::string GetDeviceName() const OVERRIDE; |
| 70 |
62 private: | 71 private: |
63 friend class BluetoothAdapterMac; | 72 friend class BluetoothAdapterMac; |
64 | 73 |
65 // Computes the fingerprint that can be used to compare the devices. | 74 // Computes the fingerprint that can be used to compare the devices. |
66 static uint32 ComputeDeviceFingerprint(const IOBluetoothDevice* device); | 75 static uint32 ComputeDeviceFingerprint(const IOBluetoothDevice* device); |
67 | 76 |
68 uint32 device_fingerprint() const { | 77 uint32 device_fingerprint() const { |
69 return device_fingerprint_; | 78 return device_fingerprint_; |
70 } | 79 } |
71 | 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 |
72 // Used to compare the devices. | 99 // Used to compare the devices. |
73 const uint32 device_fingerprint_; | 100 const uint32 device_fingerprint_; |
74 ServiceRecordList service_record_list_; | 101 ServiceRecordList service_record_list_; |
75 | 102 |
76 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); | 103 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); |
77 }; | 104 }; |
78 | 105 |
79 } // namespace device | 106 } // namespace device |
80 | 107 |
81 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ | 108 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ |
OLD | NEW |