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

Side by Side Diff: third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom

Issue 2718583002: Refactor WebBluetoothServiceClient in the web_bluetooth.mojom (Closed)
Patch Set: fix content unit tests Created 3 years, 10 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 module blink.mojom; 5 module blink.mojom;
6 6
7 import "device/bluetooth/public/interfaces/uuid.mojom"; 7 import "device/bluetooth/public/interfaces/uuid.mojom";
8 8
9 // Bluetooth Terminology: 9 // Bluetooth Terminology:
10 // 10 //
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 }; 150 };
151 151
152 struct WebBluetoothRemoteGATTDescriptor { 152 struct WebBluetoothRemoteGATTDescriptor {
153 string instance_id; // See Instance ID Note above. 153 string instance_id; // See Instance ID Note above.
154 bluetooth.mojom.UUID uuid; 154 bluetooth.mojom.UUID uuid;
155 }; 155 };
156 156
157 // Web Bluetooth Interface that Blink can use to perform 157 // Web Bluetooth Interface that Blink can use to perform
158 // Bluetooth GATT Operations on Bluetooth Devices. 158 // Bluetooth GATT Operations on Bluetooth Devices.
159 interface WebBluetoothService { 159 interface WebBluetoothService {
160 // Sets the client for this WebBluetoothService. The service will notify the
161 // client of device events e.g. when a Characteristic's value changes or when
162 // a device disconnects.
163 SetClient(associated WebBluetoothServiceClient client);
164
165 RequestDevice(WebBluetoothRequestDeviceOptions options) 160 RequestDevice(WebBluetoothRequestDeviceOptions options)
166 => (WebBluetoothResult result, WebBluetoothDevice? device); 161 => (WebBluetoothResult result, WebBluetoothDevice? device);
167 162
168 // Creates a GATT Connection to a Bluetooth Device identified by |device_id| 163 // Creates a GATT Connection to a Bluetooth Device identified by |device_id|
169 // if a connection to the device didn't exist already. If a GATT connection 164 // if a connection to the device didn't exist already. If a GATT connection
170 // existed already then this function increases the ref count to keep that 165 // existed already then this function increases the ref count to keep that
171 // connection alive. 166 // connection alive.
172 RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothResult res ult); 167 RemoteServerConnect(WebBluetoothDeviceId device_id) => (
168 WebBluetoothResult result,
169 associated WebBluetoothServerClient&? client_request);
173 170
174 // If a GATT connection exists for Device identified by |device_id| then 171 // If a GATT connection exists for Device identified by |device_id| then
175 // decreases the ref count for that connection. 172 // decreases the ref count for that connection.
176 RemoteServerDisconnect(WebBluetoothDeviceId device_id); 173 RemoteServerDisconnect(WebBluetoothDeviceId device_id);
177 174
178 // Returns the Services of a GATT Device identified by |device_id|. 175 // Returns the Services of a GATT Device identified by |device_id|.
179 // If |services_uuid| is present, filters services by |services_uuid|. 176 // If |services_uuid| is present, filters services by |services_uuid|.
180 // Otherwise returns all non-blocklisted services. 177 // Otherwise returns all non-blocklisted services.
181 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, at most one 178 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, at most one
182 // service will be returned. 179 // service will be returned.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // |characteristic_instance_id|. The callback is run with 211 // |characteristic_instance_id|. The callback is run with
215 // WebBluetoothResult::SUCCESS if the value was successfully 212 // WebBluetoothResult::SUCCESS if the value was successfully
216 // written. 213 // written.
217 RemoteCharacteristicWriteValue( 214 RemoteCharacteristicWriteValue(
218 string characteristic_instance_id, 215 string characteristic_instance_id,
219 array<uint8> value) => (WebBluetoothResult result); 216 array<uint8> value) => (WebBluetoothResult result);
220 217
221 // Starts notifications for the characteristic identified by 218 // Starts notifications for the characteristic identified by
222 // |characteristic_instance_id|. 219 // |characteristic_instance_id|.
223 RemoteCharacteristicStartNotifications( 220 RemoteCharacteristicStartNotifications(
224 string characteristic_instance_id) => (WebBluetoothResult result); 221 string characteristic_instance_id) => (
222 WebBluetoothResult result,
223 associated WebBluetoothCharacteristicClient&? client_request);
ortuno 2017/02/24 03:28:52 As you mentioned now that we no longer have a glob
juncai 2017/03/01 02:04:12 I will do this in a separate CL.
juncai 2017/03/02 03:23:38 I opened an issue at: https://bugs.chromium.org/p/
225 224
226 // Stops notifications for the characteristic identified by 225 // Stops notifications for the characteristic identified by
227 // |characteristic_instance_id|. 226 // |characteristic_instance_id|.
228 RemoteCharacteristicStopNotifications( 227 RemoteCharacteristicStopNotifications(
229 string characteristic_instance_id) => (); 228 string characteristic_instance_id) => ();
230 229
231 // Returns the Descriptors of a GATT Characteristic identified by 230 // Returns the Descriptors of a GATT Characteristic identified by
232 // |characteristics_instance_id|. 231 // |characteristics_instance_id|.
233 // If |descriptor_uuid| is present, filters descriptors by 232 // If |descriptor_uuid| is present, filters descriptors by
234 // |descriptor_uuid|. Otherwise returns all non-blocklisted descriptors. 233 // |descriptor_uuid|. Otherwise returns all non-blocklisted descriptors.
(...skipping 18 matching lines...) Expand all
253 252
254 // Writes a value to the descriptor identified by 253 // Writes a value to the descriptor identified by
255 // |descriptor_instance_id|. The callback is run with 254 // |descriptor_instance_id|. The callback is run with
256 // WebBluetoothResult::SUCCESS if the value was successfully 255 // WebBluetoothResult::SUCCESS if the value was successfully
257 // written. 256 // written.
258 RemoteDescriptorWriteValue( 257 RemoteDescriptorWriteValue(
259 string descriptor_instance_id, 258 string descriptor_instance_id,
260 array<uint8> value) => (WebBluetoothResult result); 259 array<uint8> value) => (WebBluetoothResult result);
261 }; 260 };
262 261
263 // Classes should implement this interface and pass an associated pointer 262 interface WebBluetoothCharacteristicClient {
264 // bound to them to the WebBluetoothService by using SetClient. Classes 263 RemoteCharacteristicValueChanged(array<uint8> value);
265 // that do this will be notified of device events e.g. device disconnection. 264 };
266 interface WebBluetoothServiceClient {
267 // The characteristic identified by |characteristic_instance_id| has received
268 // a notification of value change.
269 RemoteCharacteristicValueChanged(string characteristic_instance_id,
270 array<uint8> value);
271 265
272 // The device identified by |device_id| has been disconnected. 266 interface WebBluetoothServerClient {
273 GattServerDisconnected(WebBluetoothDeviceId device_id); 267 GattServerDisconnected();
274 }; 268 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698