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_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
| 12 #include <unordered_map> |
12 #include <unordered_set> | 13 #include <unordered_set> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
19 #include "dbus/object_path.h" | 20 #include "dbus/object_path.h" |
20 #include "device/bluetooth/bluetooth_common.h" | 21 #include "device/bluetooth/bluetooth_common.h" |
21 #include "device/bluetooth/bluetooth_device.h" | 22 #include "device/bluetooth/bluetooth_device.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 uint16_t GetAppearance() const override; | 60 uint16_t GetAppearance() const override; |
60 base::Optional<std::string> GetName() const override; | 61 base::Optional<std::string> GetName() const override; |
61 bool IsPaired() const override; | 62 bool IsPaired() const override; |
62 bool IsConnected() const override; | 63 bool IsConnected() const override; |
63 bool IsGattConnected() const override; | 64 bool IsGattConnected() const override; |
64 bool IsConnectable() const override; | 65 bool IsConnectable() const override; |
65 bool IsConnecting() const override; | 66 bool IsConnecting() const override; |
66 UUIDSet GetUUIDs() const override; | 67 UUIDSet GetUUIDs() const override; |
67 base::Optional<int8_t> GetInquiryRSSI() const override; | 68 base::Optional<int8_t> GetInquiryRSSI() const override; |
68 base::Optional<int8_t> GetInquiryTxPower() const override; | 69 base::Optional<int8_t> GetInquiryTxPower() const override; |
| 70 base::Optional<uint8_t> GetAdvertisingDataFlags() const override; |
69 bool ExpectingPinCode() const override; | 71 bool ExpectingPinCode() const override; |
70 bool ExpectingPasskey() const override; | 72 bool ExpectingPasskey() const override; |
71 bool ExpectingConfirmation() const override; | 73 bool ExpectingConfirmation() const override; |
72 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; | 74 void GetConnectionInfo(const ConnectionInfoCallback& callback) override; |
73 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, | 75 void Connect(device::BluetoothDevice::PairingDelegate* pairing_delegate, |
74 const base::Closure& callback, | 76 const base::Closure& callback, |
75 const ConnectErrorCallback& error_callback) override; | 77 const ConnectErrorCallback& error_callback) override; |
76 void SetPinCode(const std::string& pincode) override; | 78 void SetPinCode(const std::string& pincode) override; |
77 void SetPasskey(uint32_t passkey) override; | 79 void SetPasskey(uint32_t passkey) override; |
78 void ConfirmPairing() override; | 80 void ConfirmPairing() override; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // data even when a device stops advertising service data. | 114 // data even when a device stops advertising service data. |
113 // 2) BlueZ sends DevicePropertyChanged event separately for each UUID that | 115 // 2) BlueZ sends DevicePropertyChanged event separately for each UUID that |
114 // service data changed. Meaning that UpdateServiceData() might get called | 116 // service data changed. Meaning that UpdateServiceData() might get called |
115 // multiple times when there are multiple UUIDs that service data changed. | 117 // multiple times when there are multiple UUIDs that service data changed. |
116 // 3) When a device update service data for a UUID, BlueZ update data for that | 118 // 3) When a device update service data for a UUID, BlueZ update data for that |
117 // UUID if it is already exist. If not BlueZ adds that data for UUID. | 119 // UUID if it is already exist. If not BlueZ adds that data for UUID. |
118 // This means BlueZ won't remove service data even when a device stops | 120 // This means BlueZ won't remove service data even when a device stops |
119 // advertising service data for a UUID. | 121 // advertising service data for a UUID. |
120 void UpdateServiceData(); | 122 void UpdateServiceData(); |
121 | 123 |
| 124 // Called by BluetoothAdapterBlueZ to update manufacturer_data_ defined in |
| 125 // BluetoothDevice when receive DevicePropertyChanged event for the |
| 126 // manufacturer data property. Note that same BlueZ implementation detail from |
| 127 // UpdateServiceData() also applies here. |
| 128 void UpdateManufacturerData(); |
| 129 |
122 // Creates a pairing object with the given delegate |pairing_delegate| and | 130 // Creates a pairing object with the given delegate |pairing_delegate| and |
123 // establishes it as the pairing context for this device. All pairing-related | 131 // establishes it as the pairing context for this device. All pairing-related |
124 // method calls will be forwarded to this object until it is released. | 132 // method calls will be forwarded to this object until it is released. |
125 BluetoothPairingBlueZ* BeginPairing( | 133 BluetoothPairingBlueZ* BeginPairing( |
126 BluetoothDevice::PairingDelegate* pairing_delegate); | 134 BluetoothDevice::PairingDelegate* pairing_delegate); |
127 | 135 |
128 // Releases the current pairing object, any pairing-related method calls will | 136 // Releases the current pairing object, any pairing-related method calls will |
129 // be ignored. | 137 // be ignored. |
130 void EndPairing(); | 138 void EndPairing(); |
131 | 139 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // Note: This should remain the last member so it'll be destroyed and | 269 // Note: This should remain the last member so it'll be destroyed and |
262 // invalidate its weak pointers before any other members are destroyed. | 270 // invalidate its weak pointers before any other members are destroyed. |
263 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; | 271 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; |
264 | 272 |
265 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); | 273 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); |
266 }; | 274 }; |
267 | 275 |
268 } // namespace bluez | 276 } // namespace bluez |
269 | 277 |
270 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 278 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
OLD | NEW |