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 <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace arc { | 25 namespace arc { |
26 | 26 |
27 class ArcBridgeService; | 27 class ArcBridgeService; |
28 | 28 |
29 class ArcBluetoothBridge | 29 class ArcBluetoothBridge |
30 : public ArcService, | 30 : public ArcService, |
31 public ArcBridgeService::Observer, | 31 public ArcBridgeService::Observer, |
32 public device::BluetoothAdapter::Observer, | 32 public device::BluetoothAdapter::Observer, |
33 public device::BluetoothAdapterFactory::AdapterCallback, | 33 public device::BluetoothAdapterFactory::AdapterCallback, |
34 public BluetoothHost { | 34 public mojom::BluetoothHost { |
35 public: | 35 public: |
36 explicit ArcBluetoothBridge(ArcBridgeService* bridge_service); | 36 explicit ArcBluetoothBridge(ArcBridgeService* bridge_service); |
37 ~ArcBluetoothBridge() override; | 37 ~ArcBluetoothBridge() override; |
38 | 38 |
39 // Overridden from ArcBridgeService::Observer: | 39 // Overridden from ArcBridgeService::Observer: |
40 void OnBluetoothInstanceReady() override; | 40 void OnBluetoothInstanceReady() override; |
41 | 41 |
42 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter); | 42 void OnAdapterInitialized(scoped_refptr<device::BluetoothAdapter> adapter); |
43 | 43 |
44 // Overridden from device::BluetoothAdadpter::Observer | 44 // Overridden from device::BluetoothAdadpter::Observer |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const std::vector<uint8_t>& value) override; | 105 const std::vector<uint8_t>& value) override; |
106 | 106 |
107 void GattDescriptorValueChanged(device::BluetoothAdapter* adapter, | 107 void GattDescriptorValueChanged(device::BluetoothAdapter* adapter, |
108 device::BluetoothGattDescriptor* descriptor, | 108 device::BluetoothGattDescriptor* descriptor, |
109 const std::vector<uint8_t>& value) override; | 109 const std::vector<uint8_t>& value) override; |
110 | 110 |
111 // Bluetooth Mojo host interface | 111 // Bluetooth Mojo host interface |
112 void EnableAdapter(const EnableAdapterCallback& callback) override; | 112 void EnableAdapter(const EnableAdapterCallback& callback) override; |
113 void DisableAdapter(const DisableAdapterCallback& callback) override; | 113 void DisableAdapter(const DisableAdapterCallback& callback) override; |
114 | 114 |
115 void GetAdapterProperty(BluetoothPropertyType type) override; | 115 void GetAdapterProperty(mojom::BluetoothPropertyType type) override; |
116 void SetAdapterProperty(BluetoothPropertyPtr property) override; | 116 void SetAdapterProperty(mojom::BluetoothPropertyPtr property) override; |
117 | 117 |
118 void GetRemoteDeviceProperty(BluetoothAddressPtr remote_addr, | 118 void GetRemoteDeviceProperty(mojom::BluetoothAddressPtr remote_addr, |
119 BluetoothPropertyType type) override; | 119 mojom::BluetoothPropertyType type) override; |
120 void SetRemoteDeviceProperty(BluetoothAddressPtr remote_addr, | 120 void SetRemoteDeviceProperty(mojom::BluetoothAddressPtr remote_addr, |
121 BluetoothPropertyPtr property) override; | 121 mojom::BluetoothPropertyPtr property) override; |
122 void GetRemoteServiceRecord(BluetoothAddressPtr remote_addr, | 122 void GetRemoteServiceRecord(mojom::BluetoothAddressPtr remote_addr, |
123 BluetoothUUIDPtr uuid) override; | 123 mojom::BluetoothUUIDPtr uuid) override; |
124 | 124 |
125 void GetRemoteServices(BluetoothAddressPtr remote_addr) override; | 125 void GetRemoteServices(mojom::BluetoothAddressPtr remote_addr) override; |
126 | 126 |
127 void StartDiscovery() override; | 127 void StartDiscovery() override; |
128 void CancelDiscovery() override; | 128 void CancelDiscovery() override; |
129 | 129 |
130 void CreateBond(BluetoothAddressPtr addr, int32_t transport) override; | 130 void CreateBond(mojom::BluetoothAddressPtr addr, int32_t transport) override; |
131 void RemoveBond(BluetoothAddressPtr addr) override; | 131 void RemoveBond(mojom::BluetoothAddressPtr addr) override; |
132 void CancelBond(BluetoothAddressPtr addr) override; | 132 void CancelBond(mojom::BluetoothAddressPtr addr) override; |
133 | 133 |
134 void GetConnectionState(BluetoothAddressPtr addr, | 134 void GetConnectionState(mojom::BluetoothAddressPtr addr, |
135 const GetConnectionStateCallback& callback) override; | 135 const GetConnectionStateCallback& callback) override; |
136 | 136 |
137 // Chrome observer callbacks | 137 // Chrome observer callbacks |
138 void OnPoweredOn( | 138 void OnPoweredOn( |
139 const mojo::Callback<void(BluetoothAdapterState)>& callback) const; | 139 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
140 void OnPoweredOff( | 140 void OnPoweredOff( |
141 const mojo::Callback<void(BluetoothAdapterState)>& callback) const; | 141 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
142 void OnPoweredError( | 142 void OnPoweredError( |
143 const mojo::Callback<void(BluetoothAdapterState)>& callback) const; | 143 const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; |
144 void OnDiscoveryStarted( | 144 void OnDiscoveryStarted( |
145 scoped_ptr<device::BluetoothDiscoverySession> session); | 145 scoped_ptr<device::BluetoothDiscoverySession> session); |
146 void OnDiscoveryStopped(); | 146 void OnDiscoveryStopped(); |
147 void OnDiscoveryError(); | 147 void OnDiscoveryError(); |
148 void OnPairing(BluetoothAddressPtr addr) const; | 148 void OnPairing(mojom::BluetoothAddressPtr addr) const; |
149 void OnPairedDone(BluetoothAddressPtr addr) const; | 149 void OnPairedDone(mojom::BluetoothAddressPtr addr) const; |
150 void OnPairedError( | 150 void OnPairedError( |
151 BluetoothAddressPtr addr, | 151 mojom::BluetoothAddressPtr addr, |
152 device::BluetoothDevice::ConnectErrorCode error_code) const; | 152 device::BluetoothDevice::ConnectErrorCode error_code) const; |
153 void OnForgetDone(BluetoothAddressPtr addr) const; | 153 void OnForgetDone(mojom::BluetoothAddressPtr addr) const; |
154 void OnForgetError(BluetoothAddressPtr addr) const; | 154 void OnForgetError(mojom::BluetoothAddressPtr addr) const; |
155 | 155 |
156 private: | 156 private: |
157 mojo::Array<BluetoothPropertyPtr> GetDeviceProperties( | 157 mojo::Array<mojom::BluetoothPropertyPtr> GetDeviceProperties( |
158 BluetoothPropertyType type, | 158 mojom::BluetoothPropertyType type, |
159 device::BluetoothDevice* device) const; | 159 device::BluetoothDevice* device) const; |
160 mojo::Array<BluetoothPropertyPtr> GetAdapterProperties( | 160 mojo::Array<mojom::BluetoothPropertyPtr> GetAdapterProperties( |
161 BluetoothPropertyType type) const; | 161 mojom::BluetoothPropertyType type) const; |
162 | 162 |
163 void SendCachedDevicesFound() const; | 163 void SendCachedDevicesFound() const; |
164 bool HasBluetoothInstance() const; | 164 bool HasBluetoothInstance() const; |
165 | 165 |
166 // Propagates the list of paired device to Android. | 166 // Propagates the list of paired device to Android. |
167 void SendCachedPairedDevices() const; | 167 void SendCachedPairedDevices() const; |
168 | 168 |
169 mojo::Binding<BluetoothHost> binding_; | 169 mojo::Binding<mojom::BluetoothHost> binding_; |
170 | 170 |
171 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; | 171 scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_; |
172 scoped_ptr<device::BluetoothDiscoverySession> discovery_session_; | 172 scoped_ptr<device::BluetoothDiscoverySession> discovery_session_; |
173 | 173 |
174 // WeakPtrFactory to use for callbacks. | 174 // WeakPtrFactory to use for callbacks. |
175 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; | 175 base::WeakPtrFactory<ArcBluetoothBridge> weak_factory_; |
176 | 176 |
177 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); | 177 DISALLOW_COPY_AND_ASSIGN(ArcBluetoothBridge); |
178 }; | 178 }; |
179 | 179 |
180 } // namespace arc | 180 } // namespace arc |
181 | 181 |
182 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ | 182 #endif // COMPONENTS_ARC_BLUETOOTH_ARC_BLUETOOTH_BRIDGE_H_ |
OLD | NEW |