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

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: address more comments Created 3 years, 9 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 }; 153 };
154 154
155 struct WebBluetoothRemoteGATTDescriptor { 155 struct WebBluetoothRemoteGATTDescriptor {
156 string instance_id; // See Instance ID Note above. 156 string instance_id; // See Instance ID Note above.
157 bluetooth.mojom.UUID uuid; 157 bluetooth.mojom.UUID uuid;
158 }; 158 };
159 159
160 // Web Bluetooth Interface that Blink can use to perform 160 // Web Bluetooth Interface that Blink can use to perform
161 // Bluetooth GATT Operations on Bluetooth Devices. 161 // Bluetooth GATT Operations on Bluetooth Devices.
162 interface WebBluetoothService { 162 interface WebBluetoothService {
163 // Sets the client for this WebBluetoothService. The service will notify the
164 // client of device events e.g. when a Characteristic's value changes or when
165 // a device disconnects.
166 SetClient(associated WebBluetoothServiceClient client);
167
168 RequestDevice(WebBluetoothRequestDeviceOptions options) 163 RequestDevice(WebBluetoothRequestDeviceOptions options)
169 => (WebBluetoothResult result, WebBluetoothDevice? device); 164 => (WebBluetoothResult result, WebBluetoothDevice? device);
170 165
171 // Creates a GATT Connection to a Bluetooth Device identified by |device_id| 166 // Creates a GATT Connection to a Bluetooth Device identified by |device_id|
172 // if a connection to the device didn't exist already. If a GATT connection 167 // if a connection to the device didn't exist already. If a GATT connection
173 // existed already then this function increases the ref count to keep that 168 // existed already then this function increases the ref count to keep that
174 // connection alive. 169 // connection alive.
ortuno 2017/03/06 11:31:20 // Returns the result of the connection request an
juncai 2017/03/09 07:30:57 Done.
175 RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothResult res ult); 170 RemoteServerConnect(WebBluetoothDeviceId device_id) => (
171 WebBluetoothResult result,
172 associated WebBluetoothServerClient&? client_request);
176 173
177 // If a GATT connection exists for Device identified by |device_id| then 174 // If a GATT connection exists for Device identified by |device_id| then
178 // decreases the ref count for that connection. 175 // decreases the ref count for that connection.
179 RemoteServerDisconnect(WebBluetoothDeviceId device_id); 176 RemoteServerDisconnect(WebBluetoothDeviceId device_id);
180 177
181 // Returns the Services of a GATT Device identified by |device_id|. 178 // Returns the Services of a GATT Device identified by |device_id|.
182 // If |services_uuid| is present, filters services by |services_uuid|. 179 // If |services_uuid| is present, filters services by |services_uuid|.
183 // Otherwise returns all non-blocklisted services. 180 // Otherwise returns all non-blocklisted services.
184 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, at most one 181 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, at most one
185 // service will be returned. 182 // service will be returned.
(...skipping 29 matching lines...) Expand all
215 212
216 // Writes a value to the characteristic identified by 213 // Writes a value to the characteristic identified by
217 // |characteristic_instance_id|. The callback is run with 214 // |characteristic_instance_id|. The callback is run with
218 // WebBluetoothResult::SUCCESS if the value was successfully 215 // WebBluetoothResult::SUCCESS if the value was successfully
219 // written. 216 // written.
220 RemoteCharacteristicWriteValue( 217 RemoteCharacteristicWriteValue(
221 string characteristic_instance_id, 218 string characteristic_instance_id,
222 array<uint8> value) => (WebBluetoothResult result); 219 array<uint8> value) => (WebBluetoothResult result);
223 220
224 // Starts notifications for the characteristic identified by 221 // Starts notifications for the characteristic identified by
225 // |characteristic_instance_id|. 222 // |characteristic_instance_id|.
ortuno 2017/03/06 11:31:20 // Returns the result of the start notifications r
juncai 2017/03/09 07:30:57 Done.
226 RemoteCharacteristicStartNotifications( 223 RemoteCharacteristicStartNotifications(
227 string characteristic_instance_id) => (WebBluetoothResult result); 224 string characteristic_instance_id) => (
225 WebBluetoothResult result,
226 associated WebBluetoothCharacteristicClient&? client_request);
228 227
229 // Stops notifications for the characteristic identified by 228 // Stops notifications for the characteristic identified by
230 // |characteristic_instance_id|. 229 // |characteristic_instance_id|.
231 RemoteCharacteristicStopNotifications( 230 RemoteCharacteristicStopNotifications(
232 string characteristic_instance_id) => (); 231 string characteristic_instance_id) => ();
233 232
234 // Returns the Descriptors of a GATT Characteristic identified by 233 // Returns the Descriptors of a GATT Characteristic identified by
235 // |characteristics_instance_id|. 234 // |characteristics_instance_id|.
236 // If |descriptor_uuid| is present, filters descriptors by 235 // If |descriptor_uuid| is present, filters descriptors by
237 // |descriptor_uuid|. Otherwise returns all non-blocklisted descriptors. 236 // |descriptor_uuid|. Otherwise returns all non-blocklisted descriptors.
(...skipping 18 matching lines...) Expand all
256 255
257 // Writes a value to the descriptor identified by 256 // Writes a value to the descriptor identified by
258 // |descriptor_instance_id|. The callback is run with 257 // |descriptor_instance_id|. The callback is run with
259 // WebBluetoothResult::SUCCESS if the value was successfully 258 // WebBluetoothResult::SUCCESS if the value was successfully
260 // written. 259 // written.
261 RemoteDescriptorWriteValue( 260 RemoteDescriptorWriteValue(
262 string descriptor_instance_id, 261 string descriptor_instance_id,
263 array<uint8> value) => (WebBluetoothResult result); 262 array<uint8> value) => (WebBluetoothResult result);
264 }; 263 };
265 264
266 // Classes should implement this interface and pass an associated pointer 265 // Classes should implement this interface and will be notified of device
ortuno 2017/03/06 11:31:20 // Classes that implement this interface will be n
juncai 2017/03/09 07:30:57 Done.
267 // bound to them to the WebBluetoothService by using SetClient. Classes 266 // events.
268 // that do this will be notified of device events e.g. device disconnection. 267 interface WebBluetoothCharacteristicClient {
269 interface WebBluetoothServiceClient { 268 // Device has received a notification of value change.
270 // The characteristic identified by |characteristic_instance_id| has received 269 RemoteCharacteristicValueChanged(array<uint8> value);
ortuno 2017/03/06 11:31:20 Called when we receive a notification for the char
juncai 2017/03/09 07:30:57 Done.
271 // a notification of value change. 270 };
272 RemoteCharacteristicValueChanged(string characteristic_instance_id,
273 array<uint8> value);
274 271
275 // The device identified by |device_id| has been disconnected. 272 // Classes should implement this interface and will be notified of device
ortuno 2017/03/06 11:31:20 Classes that implement this interface will be noti
juncai 2017/03/09 07:30:57 Done.
276 GattServerDisconnected(WebBluetoothDeviceId device_id); 273 // events.
274 interface WebBluetoothServerClient {
275 // Device has been disconnected.
ortuno 2017/03/06 11:31:20 Called when a device disconnects.
juncai 2017/03/09 07:30:57 Done.
276 GATTServerDisconnected();
277 }; 277 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698