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