 Chromium Code Reviews
 Chromium Code Reviews Issue 2637343002:
  Implement WebBluetooth descriptor.readValue()  (Closed)
    
  
    Issue 2637343002:
  Implement WebBluetooth descriptor.readValue()  (Closed) 
  | 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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 GATT_NOT_AUTHORIZED, | 96 GATT_NOT_AUTHORIZED, | 
| 97 BLOCKLISTED_DESCRIPTOR_UUID, | 97 BLOCKLISTED_DESCRIPTOR_UUID, | 
| 98 BLOCKLISTED_CHARACTERISTIC_UUID, | 98 BLOCKLISTED_CHARACTERISTIC_UUID, | 
| 99 BLOCKLISTED_READ, | 99 BLOCKLISTED_READ, | 
| 100 BLOCKLISTED_WRITE, | 100 BLOCKLISTED_WRITE, | 
| 101 NOT_ALLOWED_TO_ACCESS_ANY_SERVICE, | 101 NOT_ALLOWED_TO_ACCESS_ANY_SERVICE, | 
| 102 NOT_ALLOWED_TO_ACCESS_SERVICE, | 102 NOT_ALLOWED_TO_ACCESS_SERVICE, | 
| 103 REQUEST_DEVICE_WITH_BLOCKLISTED_UUID, | 103 REQUEST_DEVICE_WITH_BLOCKLISTED_UUID, | 
| 104 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, | 104 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, | 
| 105 REQUEST_DEVICE_WITHOUT_FRAME, | 105 REQUEST_DEVICE_WITHOUT_FRAME, | 
| 106 DESCRIPTOR_NO_LONGER_EXISTS, | |
| 106 }; | 107 }; | 
| 107 | 108 | 
| 108 struct WebBluetoothScanFilter { | 109 struct WebBluetoothScanFilter { | 
| 109 array<bluetooth.mojom.UUID>? services; | 110 array<bluetooth.mojom.UUID>? services; | 
| 110 string? name; | 111 string? name; | 
| 111 string? name_prefix; | 112 string? name_prefix; | 
| 112 }; | 113 }; | 
| 113 | 114 | 
| 114 struct WebBluetoothRequestDeviceOptions { | 115 struct WebBluetoothRequestDeviceOptions { | 
| 115 array<WebBluetoothScanFilter>? filters; | 116 array<WebBluetoothScanFilter>? filters; | 
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 // If |descriptor_uuid| is present, filters descriptors by | 233 // If |descriptor_uuid| is present, filters descriptors by | 
| 233 // |descriptor_uuid|. Otherwise returns all non-blocklisted descriptors. | 234 // |descriptor_uuid|. Otherwise returns all non-blocklisted descriptors. | 
| 234 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, at most one | 235 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, at most one | 
| 235 // characteristic will be returned. | 236 // characteristic will be returned. | 
| 236 RemoteCharacteristicGetDescriptors( | 237 RemoteCharacteristicGetDescriptors( | 
| 237 string characteristics_instance_id, | 238 string characteristics_instance_id, | 
| 238 WebBluetoothGATTQueryQuantity quantity, | 239 WebBluetoothGATTQueryQuantity quantity, | 
| 239 bluetooth.mojom.UUID? descriptor_uuid) => ( | 240 bluetooth.mojom.UUID? descriptor_uuid) => ( | 
| 240 WebBluetoothResult result, | 241 WebBluetoothResult result, | 
| 241 array<WebBluetoothRemoteGATTDescriptor>? descriptors); | 242 array<WebBluetoothRemoteGATTDescriptor>? descriptors); | 
| 243 | |
| 244 // Reads the value for descriptor with |descriptor_instance_id|. | |
| 
ortuno
2017/01/20 04:30:53
I think you wrote this comment twice?
 
dougt
2017/01/23 21:40:37
Done.
 | |
| 245 // If the value is successfully read the callback will be run with | |
| 246 // WebBluetoothResult::SUCCESS and the descriptor's value. If the value is not | |
| 247 // successfully read the callback with be run with the corresponding error and | |
| 248 // nullptr for value. | |
| 249 | |
| 250 // Reads the value for the descriptor identified by | |
| 251 // |descriptor_instance_id|. If the value is successfully read the callback | |
| 252 // will be run with WebBluetoothResult::SUCCESS and the descriptor's value. If | |
| 253 // the value is not successfully read the callback with be run with the | |
| 254 // corresponding error and nullptr for value | |
| 
ortuno
2017/01/20 04:30:53
nit: Shouldn't this be nullopt.
 
dougt
2017/01/23 21:40:37
Not sure.  On the C++ binding side, the callback i
 | |
| 255 RemoteDescriptorReadValue( | |
| 256 string descriptor_instance_id) => ( | |
| 257 WebBluetoothResult result, | |
| 258 array<uint8>? value); | |
| 242 }; | 259 }; | 
| 243 | 260 | 
| 244 // Classes should implement this interface and pass an associated pointer | 261 // Classes should implement this interface and pass an associated pointer | 
| 245 // bound to them to the WebBluetoothService by using SetClient. Classes | 262 // bound to them to the WebBluetoothService by using SetClient. Classes | 
| 246 // that do this will be notified of device events e.g. device disconnection. | 263 // that do this will be notified of device events e.g. device disconnection. | 
| 247 interface WebBluetoothServiceClient { | 264 interface WebBluetoothServiceClient { | 
| 248 // The characteristic identified by |characteristic_instance_id| has received | 265 // The characteristic identified by |characteristic_instance_id| has received | 
| 249 // a notification of value change. | 266 // a notification of value change. | 
| 250 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 267 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 
| 251 array<uint8> value); | 268 array<uint8> value); | 
| 252 | 269 | 
| 253 // The device identified by |device_id| has been disconnected. | 270 // The device identified by |device_id| has been disconnected. | 
| 254 GattServerDisconnected(WebBluetoothDeviceId device_id); | 271 GattServerDisconnected(WebBluetoothDeviceId device_id); | 
| 255 }; | 272 }; | 
| OLD | NEW |