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 DEVICE_BLUETOOTH_ADAPTER_H_ | 5 #ifndef DEVICE_BLUETOOTH_ADAPTER_H_ |
6 #define DEVICE_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_ADAPTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 // device/bluetooth/public/interfaces/adapter.mojom. | 21 // device/bluetooth/public/interfaces/adapter.mojom. |
22 // It handles requests for Bluetooth adapter capabilities | 22 // It handles requests for Bluetooth adapter capabilities |
23 // and devices and uses the platform abstraction of device/bluetooth. | 23 // and devices and uses the platform abstraction of device/bluetooth. |
24 class Adapter : public mojom::Adapter, | 24 class Adapter : public mojom::Adapter, |
25 public device::BluetoothAdapter::Observer { | 25 public device::BluetoothAdapter::Observer { |
26 public: | 26 public: |
27 explicit Adapter(scoped_refptr<device::BluetoothAdapter> adapter); | 27 explicit Adapter(scoped_refptr<device::BluetoothAdapter> adapter); |
28 ~Adapter() override; | 28 ~Adapter() override; |
29 | 29 |
30 // mojom::Adapter overrides: | 30 // mojom::Adapter overrides: |
31 void GetInfo(const GetInfoCallback& callback) override; | |
32 void ConnectToDevice(const std::string& address, | 31 void ConnectToDevice(const std::string& address, |
33 const ConnectToDeviceCallback& callback) override; | 32 const ConnectToDeviceCallback& callback) override; |
34 void GetDevices(const GetDevicesCallback& callback) override; | 33 void GetDevices(const GetDevicesCallback& callback) override; |
| 34 void GetInfo(const GetInfoCallback& callback) override; |
35 void SetClient(mojom::AdapterClientPtr client) override; | 35 void SetClient(mojom::AdapterClientPtr client) override; |
| 36 void StartDiscoverySession( |
| 37 const StartDiscoverySessionCallback& callback) override; |
36 | 38 |
37 // device::BluetoothAdapter::Observer overrides: | 39 // device::BluetoothAdapter::Observer overrides: |
| 40 void AdapterDiscoveringChanged(device::BluetoothAdapter* adapter, |
| 41 bool discovering) override; |
38 void DeviceAdded(device::BluetoothAdapter* adapter, | 42 void DeviceAdded(device::BluetoothAdapter* adapter, |
39 device::BluetoothDevice* device) override; | 43 device::BluetoothDevice* device) override; |
| 44 void DeviceChanged(device::BluetoothAdapter* adapter, |
| 45 device::BluetoothDevice* device) override; |
40 void DeviceRemoved(device::BluetoothAdapter* adapter, | 46 void DeviceRemoved(device::BluetoothAdapter* adapter, |
41 device::BluetoothDevice* device) override; | 47 device::BluetoothDevice* device) override; |
42 void DeviceChanged(device::BluetoothAdapter* adapter, | |
43 device::BluetoothDevice* device) override; | |
44 | 48 |
45 private: | 49 private: |
46 void OnGattConnected( | 50 void OnGattConnected( |
47 const ConnectToDeviceCallback& callback, | 51 const ConnectToDeviceCallback& callback, |
48 std::unique_ptr<device::BluetoothGattConnection> connection); | 52 std::unique_ptr<device::BluetoothGattConnection> connection); |
49 | 53 |
50 void OnConnectError(const ConnectToDeviceCallback& callback, | 54 void OnConnectError(const ConnectToDeviceCallback& callback, |
51 device::BluetoothDevice::ConnectErrorCode error_code); | 55 device::BluetoothDevice::ConnectErrorCode error_code); |
52 | 56 |
| 57 void OnStartDiscoverySession( |
| 58 const StartDiscoverySessionCallback& callback, |
| 59 std::unique_ptr<device::BluetoothDiscoverySession> session); |
| 60 |
| 61 void OnDiscoverySessionError(const StartDiscoverySessionCallback& callback); |
| 62 |
53 // The current Bluetooth adapter. | 63 // The current Bluetooth adapter. |
54 scoped_refptr<device::BluetoothAdapter> adapter_; | 64 scoped_refptr<device::BluetoothAdapter> adapter_; |
55 | 65 |
56 // The adapter client that listens to this service. | 66 // The adapter client that listens to this service. |
57 mojom::AdapterClientPtr client_; | 67 mojom::AdapterClientPtr client_; |
58 | 68 |
59 base::WeakPtrFactory<Adapter> weak_ptr_factory_; | 69 base::WeakPtrFactory<Adapter> weak_ptr_factory_; |
60 | 70 |
61 DISALLOW_COPY_AND_ASSIGN(Adapter); | 71 DISALLOW_COPY_AND_ASSIGN(Adapter); |
62 }; | 72 }; |
63 | 73 |
64 } // namespace bluetooth | 74 } // namespace bluetooth |
65 | 75 |
66 #endif // DEVICE_BLUETOOTH_ADAPTER_H_ | 76 #endif // DEVICE_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |