Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: content/browser/bluetooth/web_bluetooth_service_impl.h

Issue 2637343002: Implement WebBluetooth descriptor.readValue() (Closed)
Patch Set: run bad_message_reasons Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const std::string& characteristic_instance_id, 126 const std::string& characteristic_instance_id,
127 const RemoteCharacteristicStartNotificationsCallback& callback) override; 127 const RemoteCharacteristicStartNotificationsCallback& callback) override;
128 void RemoteCharacteristicStopNotifications( 128 void RemoteCharacteristicStopNotifications(
129 const std::string& characteristic_instance_id, 129 const std::string& characteristic_instance_id,
130 const RemoteCharacteristicStopNotificationsCallback& callback) override; 130 const RemoteCharacteristicStopNotificationsCallback& callback) override;
131 void RemoteCharacteristicGetDescriptors( 131 void RemoteCharacteristicGetDescriptors(
132 const std::string& service_instance_id, 132 const std::string& service_instance_id,
133 blink::mojom::WebBluetoothGATTQueryQuantity quantity, 133 blink::mojom::WebBluetoothGATTQueryQuantity quantity,
134 const base::Optional<device::BluetoothUUID>& characteristics_uuid, 134 const base::Optional<device::BluetoothUUID>& characteristics_uuid,
135 const RemoteCharacteristicGetDescriptorsCallback& callback) override; 135 const RemoteCharacteristicGetDescriptorsCallback& callback) override;
136 void RemoteDescriptorReadValue(
137 const std::string& characteristic_instance_id,
138 const RemoteDescriptorReadValueCallback& callback) override;
136 139
137 void RequestDeviceImpl( 140 void RequestDeviceImpl(
138 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, 141 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
139 const RequestDeviceCallback& callback, 142 const RequestDeviceCallback& callback,
140 device::BluetoothAdapter* adapter); 143 device::BluetoothAdapter* adapter);
141 144
142 // Should only be run after the services have been discovered for 145 // Should only be run after the services have been discovered for
143 // |device_address|. 146 // |device_address|.
144 void RemoteServerGetPrimaryServicesImpl( 147 void RemoteServerGetPrimaryServicesImpl(
145 const WebBluetoothDeviceId& device_id, 148 const WebBluetoothDeviceId& device_id,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 std::unique_ptr<device::BluetoothGattNotifySession> notify_session); 191 std::unique_ptr<device::BluetoothGattNotifySession> notify_session);
189 void OnStartNotifySessionFailed( 192 void OnStartNotifySessionFailed(
190 const RemoteCharacteristicStartNotificationsCallback& callback, 193 const RemoteCharacteristicStartNotificationsCallback& callback,
191 device::BluetoothRemoteGattService::GattErrorCode error_code); 194 device::BluetoothRemoteGattService::GattErrorCode error_code);
192 195
193 // Callback for BluetoothGattNotifySession::Stop. 196 // Callback for BluetoothGattNotifySession::Stop.
194 void OnStopNotifySessionComplete( 197 void OnStopNotifySessionComplete(
195 const std::string& characteristic_instance_id, 198 const std::string& characteristic_instance_id,
196 const RemoteCharacteristicStopNotificationsCallback& callback); 199 const RemoteCharacteristicStopNotificationsCallback& callback);
197 200
201 // Callbacks for BluetoothRemoteGattDescriptor::ReadRemoteDescriptor.
202 void OnDescriptorReadValueSuccess(
203 const RemoteDescriptorReadValueCallback& callback,
204 const std::vector<uint8_t>& value);
205 void OnDescriptorReadValueFailed(
206 const RemoteDescriptorReadValueCallback& callback,
207 device::BluetoothRemoteGattService::GattErrorCode error_code);
208
198 // Functions to query the platform cache for the bluetooth object. 209 // Functions to query the platform cache for the bluetooth object.
199 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the 210 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the
200 // cache. Otherwise result.outcome that can used to record the outcome and 211 // cache. Otherwise result.outcome that can used to record the outcome and
201 // result.error will contain the error that should be sent to the renderer. 212 // result.error will contain the error that should be sent to the renderer.
202 // One of the possible outcomes is BAD_RENDERER. In this case we crash the 213 // One of the possible outcomes is BAD_RENDERER. In this case we crash the
203 // renderer, record the reason and close the pipe, so it's safe to drop 214 // renderer, record the reason and close the pipe, so it's safe to drop
204 // any callbacks. 215 // any callbacks.
205 216
206 // Queries the platform cache for a Device with |device_id| for |origin|. 217 // Queries the platform cache for a Device with |device_id| for |origin|.
207 // Fills in the |outcome| field and the |device| field if successful. 218 // Fills in the |outcome| field and the |device| field if successful.
208 CacheQueryResult QueryCacheForDevice(const WebBluetoothDeviceId& device_id); 219 CacheQueryResult QueryCacheForDevice(const WebBluetoothDeviceId& device_id);
209 220
210 // Queries the platform cache for a Service with |service_instance_id|. Fills 221 // Queries the platform cache for a Service with |service_instance_id|. Fills
211 // in the |outcome| field, and |device| and |service| fields if successful. 222 // in the |outcome| field, and |device| and |service| fields if successful.
212 CacheQueryResult QueryCacheForService(const std::string& service_instance_id); 223 CacheQueryResult QueryCacheForService(const std::string& service_instance_id);
213 224
214 // Queries the platform cache for a characteristic with 225 // Queries the platform cache for a characteristic with
215 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, 226 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|,
216 // |service| and |characteristic| fields if successful. 227 // |service| and |characteristic| fields if successful.
217 CacheQueryResult QueryCacheForCharacteristic( 228 CacheQueryResult QueryCacheForCharacteristic(
218 const std::string& characteristic_instance_id); 229 const std::string& characteristic_instance_id);
219 230
231 // Queries the platform cache for a descriptor with |descriptor_instance_id|.
232 // Fills in the |outcome| field, and |device|, |service|, |characteristic|,
233 // |descriptor| fields if successful.
234 CacheQueryResult QueryCacheForDescriptor(
235 const std::string& descriptor_instance_id);
236
220 RenderProcessHost* GetRenderProcessHost(); 237 RenderProcessHost* GetRenderProcessHost();
221 device::BluetoothAdapter* GetAdapter(); 238 device::BluetoothAdapter* GetAdapter();
222 url::Origin GetOrigin(); 239 url::Origin GetOrigin();
223 240
224 // Clears all state (maps, sets, etc). 241 // Clears all state (maps, sets, etc).
225 void ClearState(); 242 void ClearState();
226 243
227 // Used to open a BluetoothChooser and start a device discovery session. 244 // Used to open a BluetoothChooser and start a device discovery session.
228 std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_; 245 std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_;
229 246
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 mojo::Binding<blink::mojom::WebBluetoothService> binding_; 278 mojo::Binding<blink::mojom::WebBluetoothService> binding_;
262 279
263 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; 280 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_;
264 281
265 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); 282 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl);
266 }; 283 };
267 284
268 } // namespace content 285 } // namespace content
269 286
270 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 287 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_metrics.cc ('k') | content/browser/bluetooth/web_bluetooth_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698