| 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" | |
| 16 #include "components/arc/arc_bridge_service.h" | 15 #include "components/arc/arc_bridge_service.h" |
| 17 #include "components/arc/arc_service.h" | 16 #include "components/arc/arc_service.h" |
| 18 #include "components/arc/common/bluetooth.mojom.h" | 17 #include "components/arc/common/bluetooth.mojom.h" |
| 19 #include "device/bluetooth/bluetooth_adapter.h" | 18 #include "device/bluetooth/bluetooth_adapter.h" |
| 20 #include "device/bluetooth/bluetooth_adapter_factory.h" | 19 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 21 #include "device/bluetooth/bluetooth_device.h" | 20 #include "device/bluetooth/bluetooth_device.h" |
| 22 #include "device/bluetooth/bluetooth_discovery_session.h" | 21 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 23 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 22 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 24 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" | 23 #include "device/bluetooth/bluetooth_remote_gatt_descriptor.h" |
| 25 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 24 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 void DeregisterForGattNotification( | 183 void DeregisterForGattNotification( |
| 185 mojom::BluetoothAddressPtr remote_addr, | 184 mojom::BluetoothAddressPtr remote_addr, |
| 186 mojom::BluetoothGattServiceIDPtr service_id, | 185 mojom::BluetoothGattServiceIDPtr service_id, |
| 187 mojom::BluetoothGattIDPtr char_id, | 186 mojom::BluetoothGattIDPtr char_id, |
| 188 const DeregisterForGattNotificationCallback& callback) override; | 187 const DeregisterForGattNotificationCallback& callback) override; |
| 189 void ReadRemoteRssi(mojom::BluetoothAddressPtr remote_addr, | 188 void ReadRemoteRssi(mojom::BluetoothAddressPtr remote_addr, |
| 190 const ReadRemoteRssiCallback& callback) override; | 189 const ReadRemoteRssiCallback& callback) override; |
| 191 | 190 |
| 192 // Chrome observer callbacks | 191 // Chrome observer callbacks |
| 193 void OnPoweredOn( | 192 void OnPoweredOn( |
| 194 const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const; | 193 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
| 195 void OnPoweredOff( | 194 void OnPoweredOff( |
| 196 const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const; | 195 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
| 197 void OnPoweredError( | 196 void OnPoweredError( |
| 198 const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const; | 197 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
| 199 void OnDiscoveryStarted( | 198 void OnDiscoveryStarted( |
| 200 std::unique_ptr<device::BluetoothDiscoverySession> session); | 199 std::unique_ptr<device::BluetoothDiscoverySession> session); |
| 201 void OnDiscoveryStopped(); | 200 void OnDiscoveryStopped(); |
| 202 void OnDiscoveryError(); | 201 void OnDiscoveryError(); |
| 203 void OnPairing(mojom::BluetoothAddressPtr addr) const; | 202 void OnPairing(mojom::BluetoothAddressPtr addr) const; |
| 204 void OnPairedDone(mojom::BluetoothAddressPtr addr) const; | 203 void OnPairedDone(mojom::BluetoothAddressPtr addr) const; |
| 205 void OnPairedError( | 204 void OnPairedError( |
| 206 mojom::BluetoothAddressPtr addr, | 205 mojom::BluetoothAddressPtr addr, |
| 207 device::BluetoothDevice::ConnectErrorCode error_code) const; | 206 device::BluetoothDevice::ConnectErrorCode error_code) const; |
| 208 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; | 207 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 222 scoped_refptr<device::BluetoothAdvertisement> adv); | 221 scoped_refptr<device::BluetoothAdvertisement> adv); |
| 223 void OnStartLEListenError( | 222 void OnStartLEListenError( |
| 224 const StartLEListenCallback& callback, | 223 const StartLEListenCallback& callback, |
| 225 device::BluetoothAdvertisement::ErrorCode error_code); | 224 device::BluetoothAdvertisement::ErrorCode error_code); |
| 226 | 225 |
| 227 void OnStopLEListenDone(const StopLEListenCallback& callback); | 226 void OnStopLEListenDone(const StopLEListenCallback& callback); |
| 228 void OnStopLEListenError( | 227 void OnStopLEListenError( |
| 229 const StopLEListenCallback& callback, | 228 const StopLEListenCallback& callback, |
| 230 device::BluetoothAdvertisement::ErrorCode error_code); | 229 device::BluetoothAdvertisement::ErrorCode error_code); |
| 231 | 230 |
| 232 using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>; | 231 using GattReadCallback = mojo::Callback<void(mojom::BluetoothGattValuePtr)>; |
| 233 void OnGattReadDone(const GattReadCallback& callback, | 232 void OnGattReadDone(const GattReadCallback& callback, |
| 234 const std::vector<uint8_t>& result) const; | 233 const std::vector<uint8_t>& result) const; |
| 235 void OnGattReadError( | 234 void OnGattReadError( |
| 236 const GattReadCallback& callback, | 235 const GattReadCallback& callback, |
| 237 device::BluetoothGattService::GattErrorCode error_code) const; | 236 device::BluetoothGattService::GattErrorCode error_code) const; |
| 238 | 237 |
| 239 using GattWriteCallback = base::Callback<void(mojom::BluetoothGattStatus)>; | 238 using GattWriteCallback = mojo::Callback<void(mojom::BluetoothGattStatus)>; |
| 240 void OnGattWriteDone(const GattWriteCallback& callback) const; | 239 void OnGattWriteDone(const GattWriteCallback& callback) const; |
| 241 void OnGattWriteError( | 240 void OnGattWriteError( |
| 242 const GattWriteCallback& callback, | 241 const GattWriteCallback& callback, |
| 243 device::BluetoothGattService::GattErrorCode error_code) const; | 242 device::BluetoothGattService::GattErrorCode error_code) const; |
| 244 | 243 |
| 245 void OnGattNotifyStartDone( | 244 void OnGattNotifyStartDone( |
| 246 const RegisterForGattNotificationCallback& callback, | 245 const RegisterForGattNotificationCallback& callback, |
| 247 const std::string char_string_id, | 246 const std::string char_string_id, |
| 248 std::unique_ptr<device::BluetoothGattNotifySession> notify_session); | 247 std::unique_ptr<device::BluetoothGattNotifySession> notify_session); |
| 249 void OnGattNotifyStartError( | 248 void OnGattNotifyStartError( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 290 |
| 292 // WeakPtrFactory to use for callbacks. | 291 // WeakPtrFactory to use for callbacks. |
| 293 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; | 292 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |
| 294 | 293 |
| 295 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); | 294 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); |
| 296 }; | 295 }; |
| 297 | 296 |
| 298 } // namespace arc | 297 } // namespace arc |
| 299 | 298 |
| 300 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 299 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
| OLD | NEW |