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 uint32 bluetooth_class() const OVERRIDE; |
| 28 virtual std::string name() const OVERRIDE; |
| 29 virtual std::string address() const OVERRIDE; |
27 virtual bool IsPaired() const OVERRIDE; | 30 virtual bool IsPaired() const OVERRIDE; |
28 virtual const ServiceList& GetServices() const OVERRIDE; | 31 virtual bool IsConnected() const OVERRIDE; |
| 32 virtual bool IsConnectable() const OVERRIDE; |
| 33 virtual bool IsConnecting() const OVERRIDE; |
| 34 virtual ServiceList GetServices() const OVERRIDE; |
29 virtual void GetServiceRecords( | 35 virtual void GetServiceRecords( |
30 const ServiceRecordsCallback& callback, | 36 const ServiceRecordsCallback& callback, |
31 const ErrorCallback& error_callback) OVERRIDE; | 37 const ErrorCallback& error_callback) OVERRIDE; |
32 virtual void ProvidesServiceWithName( | 38 virtual void ProvidesServiceWithName( |
33 const std::string& name, | 39 const std::string& name, |
34 const ProvidesServiceCallback& callback) OVERRIDE; | 40 const ProvidesServiceCallback& callback) OVERRIDE; |
35 virtual bool ExpectingPinCode() const OVERRIDE; | 41 virtual bool ExpectingPinCode() const OVERRIDE; |
36 virtual bool ExpectingPasskey() const OVERRIDE; | 42 virtual bool ExpectingPasskey() const OVERRIDE; |
37 virtual bool ExpectingConfirmation() const OVERRIDE; | 43 virtual bool ExpectingConfirmation() const OVERRIDE; |
38 virtual void Connect( | 44 virtual void Connect( |
(...skipping 23 matching lines...) Expand all Loading... |
62 private: | 68 private: |
63 friend class BluetoothAdapterMac; | 69 friend class BluetoothAdapterMac; |
64 | 70 |
65 // Computes the fingerprint that can be used to compare the devices. | 71 // Computes the fingerprint that can be used to compare the devices. |
66 static uint32 ComputeDeviceFingerprint(const IOBluetoothDevice* device); | 72 static uint32 ComputeDeviceFingerprint(const IOBluetoothDevice* device); |
67 | 73 |
68 uint32 device_fingerprint() const { | 74 uint32 device_fingerprint() const { |
69 return device_fingerprint_; | 75 return device_fingerprint_; |
70 } | 76 } |
71 | 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 |
72 // Used to compare the devices. | 96 // Used to compare the devices. |
73 const uint32 device_fingerprint_; | 97 const uint32 device_fingerprint_; |
74 ServiceRecordList service_record_list_; | 98 ServiceRecordList service_record_list_; |
75 | 99 |
76 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); | 100 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); |
77 }; | 101 }; |
78 | 102 |
79 } // namespace device | 103 } // namespace device |
80 | 104 |
81 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ | 105 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ |
OLD | NEW |