| 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> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // thread. | 42 // thread. |
| 43 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ | 43 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceBlueZ |
| 44 : public device::BluetoothDevice, | 44 : public device::BluetoothDevice, |
| 45 public bluez::BluetoothGattServiceClient::Observer { | 45 public bluez::BluetoothGattServiceClient::Observer { |
| 46 public: | 46 public: |
| 47 using GetServiceRecordsCallback = | 47 using GetServiceRecordsCallback = |
| 48 base::Callback<void(const std::vector<BluetoothServiceRecordBlueZ>&)>; | 48 base::Callback<void(const std::vector<BluetoothServiceRecordBlueZ>&)>; |
| 49 using GetServiceRecordsErrorCallback = | 49 using GetServiceRecordsErrorCallback = |
| 50 base::Callback<void(BluetoothServiceRecordBlueZ::ErrorCode)>; | 50 base::Callback<void(BluetoothServiceRecordBlueZ::ErrorCode)>; |
| 51 | 51 |
| 52 BluetoothDeviceBlueZ( |
| 53 BluetoothAdapterBlueZ* adapter, |
| 54 const dbus::ObjectPath& object_path, |
| 55 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 56 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
| 57 ~BluetoothDeviceBlueZ() override; |
| 58 |
| 52 // BluetoothDevice override | 59 // BluetoothDevice override |
| 53 uint32_t GetBluetoothClass() const override; | 60 uint32_t GetBluetoothClass() const override; |
| 54 device::BluetoothTransport GetType() const override; | 61 device::BluetoothTransport GetType() const override; |
| 55 std::string GetAddress() const override; | 62 std::string GetAddress() const override; |
| 56 VendorIDSource GetVendorIDSource() const override; | 63 VendorIDSource GetVendorIDSource() const override; |
| 57 uint16_t GetVendorID() const override; | 64 uint16_t GetVendorID() const override; |
| 58 uint16_t GetProductID() const override; | 65 uint16_t GetProductID() const override; |
| 59 uint16_t GetDeviceID() const override; | 66 uint16_t GetDeviceID() const override; |
| 60 uint16_t GetAppearance() const override; | 67 uint16_t GetAppearance() const override; |
| 61 base::Optional<std::string> GetName() const override; | 68 base::Optional<std::string> GetName() const override; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Returns the adapter which owns this device instance. | 158 // Returns the adapter which owns this device instance. |
| 152 BluetoothAdapterBlueZ* adapter() const; | 159 BluetoothAdapterBlueZ* adapter() const; |
| 153 | 160 |
| 154 protected: | 161 protected: |
| 155 // BluetoothDevice override | 162 // BluetoothDevice override |
| 156 void CreateGattConnectionImpl() override; | 163 void CreateGattConnectionImpl() override; |
| 157 void DisconnectGatt() override; | 164 void DisconnectGatt() override; |
| 158 | 165 |
| 159 private: | 166 private: |
| 160 friend class BluetoothAdapterBlueZ; | 167 friend class BluetoothAdapterBlueZ; |
| 161 | |
| 162 BluetoothDeviceBlueZ( | |
| 163 BluetoothAdapterBlueZ* adapter, | |
| 164 const dbus::ObjectPath& object_path, | |
| 165 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | |
| 166 scoped_refptr<device::BluetoothSocketThread> socket_thread); | |
| 167 ~BluetoothDeviceBlueZ() override; | |
| 168 | |
| 169 // bluez::BluetoothGattServiceClient::Observer overrides | 168 // bluez::BluetoothGattServiceClient::Observer overrides |
| 170 void GattServiceAdded(const dbus::ObjectPath& object_path) override; | 169 void GattServiceAdded(const dbus::ObjectPath& object_path) override; |
| 171 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; | 170 void GattServiceRemoved(const dbus::ObjectPath& object_path) override; |
| 172 | 171 |
| 173 // Called once all services have been discovered. Invokes | 172 // Called once all services have been discovered. Invokes |
| 174 // NotifyGattDiscoveryComplete() for services for which we haven't notified | 173 // NotifyGattDiscoveryComplete() for services for which we haven't notified |
| 175 // before e.g. if a services is exposed during construction but services | 174 // before e.g. if a services is exposed during construction but services |
| 176 // haven't been resolved yet.. | 175 // haven't been resolved yet.. |
| 177 void UpdateGattServices(const dbus::ObjectPath& object_path); | 176 void UpdateGattServices(const dbus::ObjectPath& object_path); |
| 178 | 177 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 // Note: This should remain the last member so it'll be destroyed and | 273 // Note: This should remain the last member so it'll be destroyed and |
| 275 // invalidate its weak pointers before any other members are destroyed. | 274 // invalidate its weak pointers before any other members are destroyed. |
| 276 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; | 275 base::WeakPtrFactory<BluetoothDeviceBlueZ> weak_ptr_factory_; |
| 277 | 276 |
| 278 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); | 277 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceBlueZ); |
| 279 }; | 278 }; |
| 280 | 279 |
| 281 } // namespace bluez | 280 } // namespace bluez |
| 282 | 281 |
| 283 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ | 282 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_DEVICE_BLUEZ_H_ |
| OLD | NEW |