| 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_ADAPTER_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
| 13 #include "chromeos/dbus/bluetooth_adapter_client.h" | 13 #include "chromeos/dbus/bluetooth_adapter_client.h" |
| 14 #include "chromeos/dbus/bluetooth_agent_service_provider.h" | 14 #include "chromeos/dbus/bluetooth_agent_service_provider.h" |
| 15 #include "chromeos/dbus/bluetooth_device_client.h" | 15 #include "chromeos/dbus/bluetooth_device_client.h" |
| 16 #include "chromeos/dbus/bluetooth_input_client.h" | 16 #include "chromeos/dbus/bluetooth_input_client.h" |
| 17 #include "dbus/object_path.h" | 17 #include "dbus/object_path.h" |
| 18 #include "device/bluetooth/bluetooth_adapter.h" | 18 #include "device/bluetooth/bluetooth_adapter.h" |
| 19 #include "device/bluetooth/bluetooth_device.h" | 19 #include "device/bluetooth/bluetooth_device.h" |
| 20 | 20 |
| 21 namespace device { | 21 namespace device { |
| 22 class BluetoothSocketThread; | 22 class BluetoothSocketThread; |
| 23 } // namespace device | 23 } // namespace device |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 | 26 |
| 27 class BluetoothChromeOSTest; | 27 class BluetoothChromeOSTest; |
| 28 class BluetoothDeviceChromeOS; | 28 class BluetoothDeviceChromeOS; |
| 29 class BluetoothPairingChromeOS; | 29 class BluetoothPairingChromeOS; |
| 30 class BluetoothRemoteGattCharacteristicChromeOS; |
| 31 class BluetoothRemoteGattDescriptorChromeOS; |
| 32 class BluetoothRemoteGattServiceChromeOS; |
| 30 | 33 |
| 31 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the | 34 // The BluetoothAdapterChromeOS class implements BluetoothAdapter for the |
| 32 // Chrome OS platform. | 35 // Chrome OS platform. |
| 33 class BluetoothAdapterChromeOS | 36 class BluetoothAdapterChromeOS |
| 34 : public device::BluetoothAdapter, | 37 : public device::BluetoothAdapter, |
| 35 public chromeos::BluetoothAdapterClient::Observer, | 38 public chromeos::BluetoothAdapterClient::Observer, |
| 36 public chromeos::BluetoothDeviceClient::Observer, | 39 public chromeos::BluetoothDeviceClient::Observer, |
| 37 public chromeos::BluetoothInputClient::Observer, | 40 public chromeos::BluetoothInputClient::Observer, |
| 38 public chromeos::BluetoothAgentServiceProvider::Delegate { | 41 public chromeos::BluetoothAgentServiceProvider::Delegate { |
| 39 public: | 42 public: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 78 |
| 76 // Locates the device object by object path (the devices map and | 79 // Locates the device object by object path (the devices map and |
| 77 // BluetoothDevice methods are by address). | 80 // BluetoothDevice methods are by address). |
| 78 BluetoothDeviceChromeOS* GetDeviceWithPath( | 81 BluetoothDeviceChromeOS* GetDeviceWithPath( |
| 79 const dbus::ObjectPath& object_path); | 82 const dbus::ObjectPath& object_path); |
| 80 | 83 |
| 81 // Announce to observers a change in device state that is not reflected by | 84 // Announce to observers a change in device state that is not reflected by |
| 82 // its D-Bus properties. | 85 // its D-Bus properties. |
| 83 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); | 86 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device); |
| 84 | 87 |
| 88 // The following methods are used to send various GATT observer events to |
| 89 // observers. |
| 90 void NotifyGattServiceAdded(BluetoothRemoteGattServiceChromeOS* service); |
| 91 void NotifyGattServiceRemoved(BluetoothRemoteGattServiceChromeOS* service); |
| 92 void NotifyGattServiceChanged(BluetoothRemoteGattServiceChromeOS* service); |
| 93 void NotifyGattDiscoveryComplete(BluetoothRemoteGattServiceChromeOS* service); |
| 94 void NotifyGattCharacteristicAdded( |
| 95 BluetoothRemoteGattCharacteristicChromeOS* characteristic); |
| 96 void NotifyGattCharacteristicRemoved( |
| 97 BluetoothRemoteGattCharacteristicChromeOS* characteristic); |
| 98 void NotifyGattDescriptorAdded( |
| 99 BluetoothRemoteGattDescriptorChromeOS* descriptor); |
| 100 void NotifyGattDescriptorRemoved( |
| 101 BluetoothRemoteGattDescriptorChromeOS* descriptor); |
| 102 void NotifyGattCharacteristicValueChanged( |
| 103 BluetoothRemoteGattCharacteristicChromeOS* characteristic, |
| 104 const std::vector<uint8>& value); |
| 105 void NotifyGattDescriptorValueChanged( |
| 106 BluetoothRemoteGattDescriptorChromeOS* descriptor, |
| 107 const std::vector<uint8>& value); |
| 108 |
| 85 // Returns the object path of the adapter. | 109 // Returns the object path of the adapter. |
| 86 const dbus::ObjectPath& object_path() const { return object_path_; } | 110 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 87 | 111 |
| 88 protected: | 112 protected: |
| 89 // BluetoothAdapter: | 113 // BluetoothAdapter: |
| 90 virtual void RemovePairingDelegateInternal( | 114 virtual void RemovePairingDelegateInternal( |
| 91 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; | 115 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; |
| 92 | 116 |
| 93 private: | 117 private: |
| 94 friend class BluetoothChromeOSTest; | 118 friend class BluetoothChromeOSTest; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // Note: This should remain the last member so it'll be destroyed and | 272 // Note: This should remain the last member so it'll be destroyed and |
| 249 // invalidate its weak pointers before any other members are destroyed. | 273 // invalidate its weak pointers before any other members are destroyed. |
| 250 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 274 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
| 251 | 275 |
| 252 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 276 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
| 253 }; | 277 }; |
| 254 | 278 |
| 255 } // namespace chromeos | 279 } // namespace chromeos |
| 256 | 280 |
| 257 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 281 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
| OLD | NEW |