| 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_set> |
| 13 #include <vector> |
| 12 | 14 |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 16 #include "base/sequenced_task_runner.h" | 18 #include "base/sequenced_task_runner.h" |
| 17 #include "dbus/object_path.h" | 19 #include "dbus/object_path.h" |
| 18 #include "device/bluetooth/bluetooth_common.h" | 20 #include "device/bluetooth/bluetooth_common.h" |
| 19 #include "device/bluetooth/bluetooth_device.h" | 21 #include "device/bluetooth/bluetooth_device.h" |
| 20 #include "device/bluetooth/bluetooth_export.h" | 22 #include "device/bluetooth/bluetooth_export.h" |
| 21 #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h" | 23 #include "device/bluetooth/bluez/bluetooth_service_record_bluez.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void Pair(device::BluetoothDevice::PairingDelegate* pairing_delegate, | 98 void Pair(device::BluetoothDevice::PairingDelegate* pairing_delegate, |
| 97 const base::Closure& callback, | 99 const base::Closure& callback, |
| 98 const ConnectErrorCallback& error_callback) override; | 100 const ConnectErrorCallback& error_callback) override; |
| 99 | 101 |
| 100 // Returns the complete list of service records discovered for on this | 102 // Returns the complete list of service records discovered for on this |
| 101 // device via SDP. If called before discovery is complete, it may return | 103 // device via SDP. If called before discovery is complete, it may return |
| 102 // an incomplete list and/or stale cached records. | 104 // an incomplete list and/or stale cached records. |
| 103 void GetServiceRecords(const GetServiceRecordsCallback& callback, | 105 void GetServiceRecords(const GetServiceRecordsCallback& callback, |
| 104 const GetServiceRecordsErrorCallback& error_callback); | 106 const GetServiceRecordsErrorCallback& error_callback); |
| 105 | 107 |
| 108 // Called by BluetoothAdapterBlueZ to update BluetoothDevice->service_data_ |
| 109 // when receive DevicePropertyChanged event for the service data property. |
| 110 // Note that |
| 111 // 1) BlueZ persists all service data meaning that BlueZ won't remove service |
| 112 // data even when a device stops advertising service data. |
| 113 // 2) BlueZ sends DevicePropertyChanged event separately for each UUID that |
| 114 // service data changed. Meaning that UpdateServiceData() might get called |
| 115 // 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 |
| 117 // 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 |
| 119 // advertising service data for a UUID. |
| 120 void UpdateServiceData(); |
| 121 |
| 106 // Creates a pairing object with the given delegate |pairing_delegate| and | 122 // Creates a pairing object with the given delegate |pairing_delegate| and |
| 107 // establishes it as the pairing context for this device. All pairing-related | 123 // establishes it as the pairing context for this device. All pairing-related |
| 108 // method calls will be forwarded to this object until it is released. | 124 // method calls will be forwarded to this object until it is released. |
| 109 BluetoothPairingBlueZ* BeginPairing( | 125 BluetoothPairingBlueZ* BeginPairing( |
| 110 BluetoothDevice::PairingDelegate* pairing_delegate); | 126 BluetoothDevice::PairingDelegate* pairing_delegate); |
| 111 | 127 |
| 112 // Releases the current pairing object, any pairing-related method calls will | 128 // Releases the current pairing object, any pairing-related method calls will |
| 113 // be ignored. | 129 // be ignored. |
| 114 void EndPairing(); | 130 void EndPairing(); |
| 115 | 131 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // Note: This should remain the last member so it'll be destroyed and | 261 // Note: This should remain the last member so it'll be destroyed and |
| 246 // invalidate its weak pointers before any other members are destroyed. | 262 // invalidate its weak pointers before any other members are destroyed. |
| 247 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; | 263 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; |
| 248 | 264 |
| 249 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); | 265 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); |
| 250 }; | 266 }; |
| 251 | 267 |
| 252 } // namespace bluez | 268 } // namespace bluez |
| 253 | 269 |
| 254 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 270 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
| OLD | NEW |