Chromium Code Reviews| 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 // Errors that can occur during Web Bluetooth execution, which are transformed | 7 // Errors that can occur during Web Bluetooth execution, which are transformed |
| 8 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. | 8 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. |
| 9 // | 9 // |
| 10 // These errors all produce constant message strings. If a particular message | 10 // These errors all produce constant message strings. If a particular message |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 BLACKLISTED_WRITE, | 61 BLACKLISTED_WRITE, |
| 62 NOT_ALLOWED_TO_ACCESS_SERVICE, | 62 NOT_ALLOWED_TO_ACCESS_SERVICE, |
| 63 REQUEST_DEVICE_WITH_BLACKLISTED_UUID, | 63 REQUEST_DEVICE_WITH_BLACKLISTED_UUID, |
| 64 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, | 64 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, |
| 65 REQUEST_DEVICE_WITHOUT_FRAME, | 65 REQUEST_DEVICE_WITHOUT_FRAME, |
| 66 // SyntaxError: | 66 // SyntaxError: |
| 67 // TODO(ortuno): Remove once we no longer use IPC. | 67 // TODO(ortuno): Remove once we no longer use IPC. |
| 68 ENUM_MAX_VALUE = REQUEST_DEVICE_WITHOUT_FRAME, | 68 ENUM_MAX_VALUE = REQUEST_DEVICE_WITHOUT_FRAME, |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Enum to be used when querying for GATT Objects. | |
| 72 enum WebBluetoothQueryType { | |
|
Jeffrey Yasskin
2016/04/25 17:26:11
Maybe s/Type/Quantity/, but it's not a big deal.
ortuno
2016/04/25 20:37:41
Done.
| |
| 73 SINGLE, | |
| 74 MULTIPLE | |
| 75 }; | |
| 76 | |
| 77 struct WebBluetoothRemoteGATTCharacteristic { | |
| 78 string instance_id; | |
| 79 string? uuid; | |
| 80 uint32 properties; | |
| 81 }; | |
| 82 | |
| 71 // TODO(ortuno): Define Bluetooth Service. | 83 // TODO(ortuno): Define Bluetooth Service. |
| 72 // https://crbug.com/508771 | 84 // https://crbug.com/508771 |
| 73 | 85 |
| 74 // Web Bluetooth Interface that Blink can use to perform | 86 // Web Bluetooth Interface that Blink can use to perform |
| 75 // Bluetooth GATT Operations on Bluetooth Devices. | 87 // Bluetooth GATT Operations on Bluetooth Devices. |
| 76 interface WebBluetoothService { | 88 interface WebBluetoothService { |
| 77 // Sets the client for this WebBluetoothService. The service will notify the | 89 // Sets the client for this WebBluetoothService. The service will notify the |
| 78 // client of device events e.g. when a Characteristic's value changes or when | 90 // client of device events e.g. when a Characteristic's value changes or when |
| 79 // a device disconnects. | 91 // a device disconnects. |
| 80 SetClient(associated WebBluetoothServiceClient client); | 92 SetClient(associated WebBluetoothServiceClient client); |
| 81 | 93 |
| 94 // Returns the Characteristics of a GATT Service with |service_instance_id|. | |
| 95 // If |single_characteristic| is true, only one characteristic will be | |
| 96 // returned. | |
| 97 RemoteServiceGetCharacteristics( | |
| 98 string service_instance_id, | |
| 99 WebBluetoothQueryType type, | |
| 100 string? characteristics_uuid) => ( | |
| 101 WebBluetoothError error, | |
| 102 array<WebBluetoothRemoteGATTCharacteristic>? characteristics); | |
| 103 | |
| 82 // Reads the value for characteristic with | 104 // Reads the value for characteristic with |
| 83 // |characteristic_instance_id|. If the value is successfully read the | 105 // |characteristic_instance_id|. If the value is successfully read the |
| 84 // callback will be run with WebBluetoothError::SUCCESS and the | 106 // callback will be run with WebBluetoothError::SUCCESS and the |
| 85 // characteristic's value. If the value is not successfully read the | 107 // characteristic's value. If the value is not successfully read the |
| 86 // callback with be run with the corresponding error and nullptr for value. | 108 // callback with be run with the corresponding error and nullptr for value. |
| 87 RemoteCharacteristicReadValue( | 109 RemoteCharacteristicReadValue( |
| 88 string characteristic_instance_id) => ( | 110 string characteristic_instance_id) => ( |
| 89 WebBluetoothError error, | 111 WebBluetoothError error, |
| 90 array<uint8>? value); | 112 array<uint8>? value); |
| 91 | 113 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 108 string characteristic_instance_id) => (); | 130 string characteristic_instance_id) => (); |
| 109 }; | 131 }; |
| 110 | 132 |
| 111 // Classes should implement this interface and pass an associated pointer | 133 // Classes should implement this interface and pass an associated pointer |
| 112 // bound to them to the WebBluetoothService by using SetClient. Classes | 134 // bound to them to the WebBluetoothService by using SetClient. Classes |
| 113 // that do this will be notified of device events e.g. device disconnection. | 135 // that do this will be notified of device events e.g. device disconnection. |
| 114 interface WebBluetoothServiceClient { | 136 interface WebBluetoothServiceClient { |
| 115 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 137 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
| 116 array<uint8> value); | 138 array<uint8> value); |
| 117 }; | 139 }; |
| OLD | NEW |