| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 5 #ifndef COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 6 #define COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "components/arc/arc_bridge_service.h" | 16 #include "components/arc/arc_bridge_service.h" |
| 17 #include "components/arc/arc_service.h" | 17 #include "components/arc/arc_service.h" |
| 18 #include "components/arc/common/bluetooth.mojom.h" | 18 #include "components/arc/common/bluetooth.mojom.h" |
| 19 #include "components/arc/instance_holder.h" |
| 19 #include "device/bluetooth/bluetooth_adapter.h" | 20 #include "device/bluetooth/bluetooth_adapter.h" |
| 20 #include "device/bluetooth/bluetooth_adapter_factory.h" | 21 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 21 #include "device/bluetooth/bluetooth_device.h" | 22 #include "device/bluetooth/bluetooth_device.h" |
| 22 #include "device/bluetooth/bluetooth_discovery_session.h" | 23 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 23 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 24 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 24 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 25 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 25 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 26 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 26 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" | 27 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" |
| 27 #include "mojo/public/cpp/bindings/binding.h" | 28 #include "mojo/public/cpp/bindings/binding.h" |
| 28 | 29 |
| 29 namespace arc { | 30 namespace arc { |
| 30 | 31 |
| 31 class ArcBridgeService; | 32 class ArcBridgeService; |
| 32 | 33 |
| 33 class ArcBluetoothBridge | 34 class ArcBluetoothBridge |
| 34 : public ArcService, | 35 : public ArcService, |
| 35 public ArcBridgeService::Observer, | 36 public InstanceHolder<mojom::BluetoothInstance>::Observer, |
| 36 public device::BluetoothAdapter::Observer, | 37 public device::BluetoothAdapter::Observer, |
| 37 public device::BluetoothAdapterFactory::AdapterCallback, | 38 public device::BluetoothAdapterFactory::AdapterCallback, |
| 38 public mojom::BluetoothHost { | 39 public mojom::BluetoothHost { |
| 39 public: | 40 public: |
| 40 explicit ArcBluetoothBridge(ArcBridgeService* bridge_service); | 41 explicit ArcBluetoothBridge(ArcBridgeService* bridge_service); |
| 41 ~ArcBluetoothBridge() override; | 42 ~ArcBluetoothBridge() override; |
| 42 | 43 |
| 43 // Overridden from ArcBridgeService::Observer: | 44 // Overridden from |
| 44 void OnBluetoothInstanceReady() override; | 45 // InstanceHolder<mojom::BluetoothInstance>::Observer: |
| 46 void OnInstanceReady() override; |
| 45 | 47 |
| 46 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter); | 48 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter); |
| 47 | 49 |
| 48 // Overridden from device::BluetoothAdadpter::Observer | 50 // Overridden from device::BluetoothAdadpter::Observer |
| 49 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, | 51 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
| 50 bool powered) override; | 52 bool powered) override; |
| 51 | 53 |
| 52 void DeviceAdded(device::BluetoothAdapter* adapter, | 54 void DeviceAdded(device::BluetoothAdapter* adapter, |
| 53 device::BluetoothDevice* device) override; | 55 device::BluetoothDevice* device) override; |
| 54 | 56 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( | 256 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( |
| 255 mojom::BluetoothPropertyType type, | 257 mojom::BluetoothPropertyType type, |
| 256 device::BluetoothDevice* device) const; | 258 device::BluetoothDevice* device) const; |
| 257 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( | 259 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( |
| 258 mojom::BluetoothPropertyType type) const; | 260 mojom::BluetoothPropertyType type) const; |
| 259 mojo::Array<mojom::BluetoothAdvertisingDataPtr> GetAdvertisingData( | 261 mojo::Array<mojom::BluetoothAdvertisingDataPtr> GetAdvertisingData( |
| 260 device::BluetoothDevice* device) const; | 262 device::BluetoothDevice* device) const; |
| 261 | 263 |
| 262 void SendCachedDevicesFound() const; | 264 void SendCachedDevicesFound() const; |
| 263 bool HasBluetoothInstance() const; | 265 bool HasBluetoothInstance() const; |
| 264 bool CheckBluetoothInstanceVersion(int32_t version_need) const; | 266 bool CheckBluetoothInstanceVersion(uint32_t version_need) const; |
| 265 | 267 |
| 266 template <class T> | 268 template <class T> |
| 267 T* FindGattObjectFromUuid(const std::vector<T*> objs, | 269 T* FindGattObjectFromUuid(const std::vector<T*> objs, |
| 268 const device::BluetoothUUID uuid) const; | 270 const device::BluetoothUUID uuid) const; |
| 269 device::BluetoothRemoteGattCharacteristic* FindGattCharacteristic( | 271 device::BluetoothRemoteGattCharacteristic* FindGattCharacteristic( |
| 270 mojom::BluetoothAddressPtr remote_addr, | 272 mojom::BluetoothAddressPtr remote_addr, |
| 271 mojom::BluetoothGattServiceIDPtr service_id, | 273 mojom::BluetoothGattServiceIDPtr service_id, |
| 272 mojom::BluetoothGattIDPtr char_id) const; | 274 mojom::BluetoothGattIDPtr char_id) const; |
| 273 | 275 |
| 274 device::BluetoothRemoteGattDescriptor* FindGattDescriptor( | 276 device::BluetoothRemoteGattDescriptor* FindGattDescriptor( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 290 | 292 |
| 291 // WeakPtrFactory to use for callbacks. | 293 // WeakPtrFactory to use for callbacks. |
| 292 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; | 294 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |
| 293 | 295 |
| 294 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); | 296 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); |
| 295 }; | 297 }; |
| 296 | 298 |
| 297 } // namespace arc | 299 } // namespace arc |
| 298 | 300 |
| 299 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 301 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| OLD | NEW |