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 // Result codes that can occur during Web Bluetooth execution, which are | 9 // Result codes that can occur during Web Bluetooth execution, which are |
10 // transformed to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. | 10 // transformed to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 NO_BLUETOOTH_ADAPTER, | 44 NO_BLUETOOTH_ADAPTER, |
45 CHOSEN_DEVICE_VANISHED, | 45 CHOSEN_DEVICE_VANISHED, |
46 CHOOSER_CANCELLED, | 46 CHOOSER_CANCELLED, |
47 CHOOSER_NOT_SHOWN_API_GLOBALLY_DISABLED, | 47 CHOOSER_NOT_SHOWN_API_GLOBALLY_DISABLED, |
48 CHOOSER_NOT_SHOWN_API_LOCALLY_DISABLED, | 48 CHOOSER_NOT_SHOWN_API_LOCALLY_DISABLED, |
49 CHOOSER_NOT_SHOWN_USER_DENIED_PERMISSION_TO_SCAN, | 49 CHOOSER_NOT_SHOWN_USER_DENIED_PERMISSION_TO_SCAN, |
50 SERVICE_NOT_FOUND, | 50 SERVICE_NOT_FOUND, |
51 NO_SERVICES_FOUND, | 51 NO_SERVICES_FOUND, |
52 CHARACTERISTIC_NOT_FOUND, | 52 CHARACTERISTIC_NOT_FOUND, |
53 NO_CHARACTERISTICS_FOUND, | 53 NO_CHARACTERISTICS_FOUND, |
54 DESCRIPTOR_NOT_FOUND, | |
55 NO_DESCRIPTORS_FOUND, | |
54 WEB_BLUETOOTH_NOT_SUPPORTED, | 56 WEB_BLUETOOTH_NOT_SUPPORTED, |
55 BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE, | 57 BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE, |
56 // NotSupportedError: | 58 // NotSupportedError: |
57 GATT_UNKNOWN_ERROR, | 59 GATT_UNKNOWN_ERROR, |
58 GATT_UNKNOWN_FAILURE, | 60 GATT_UNKNOWN_FAILURE, |
59 GATT_NOT_PERMITTED, | 61 GATT_NOT_PERMITTED, |
60 GATT_NOT_SUPPORTED, | 62 GATT_NOT_SUPPORTED, |
61 GATT_UNTRANSLATED_ERROR_CODE, | 63 GATT_UNTRANSLATED_ERROR_CODE, |
62 // SecurityError: | 64 // SecurityError: |
63 GATT_NOT_AUTHORIZED, | 65 GATT_NOT_AUTHORIZED, |
66 BLOCKLISTED_DESCRIPTOR_UUID, | |
64 BLOCKLISTED_CHARACTERISTIC_UUID, | 67 BLOCKLISTED_CHARACTERISTIC_UUID, |
65 BLOCKLISTED_READ, | 68 BLOCKLISTED_READ, |
66 BLOCKLISTED_WRITE, | 69 BLOCKLISTED_WRITE, |
67 NOT_ALLOWED_TO_ACCESS_ANY_SERVICE, | 70 NOT_ALLOWED_TO_ACCESS_ANY_SERVICE, |
68 NOT_ALLOWED_TO_ACCESS_SERVICE, | 71 NOT_ALLOWED_TO_ACCESS_SERVICE, |
69 REQUEST_DEVICE_WITH_BLOCKLISTED_UUID, | 72 REQUEST_DEVICE_WITH_BLOCKLISTED_UUID, |
70 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, | 73 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, |
71 REQUEST_DEVICE_WITHOUT_FRAME, | 74 REQUEST_DEVICE_WITHOUT_FRAME, |
72 }; | 75 }; |
73 | 76 |
(...skipping 29 matching lines...) Expand all Loading... | |
103 string instance_id; | 106 string instance_id; |
104 string uuid; | 107 string uuid; |
105 }; | 108 }; |
106 | 109 |
107 struct WebBluetoothRemoteGATTCharacteristic { | 110 struct WebBluetoothRemoteGATTCharacteristic { |
108 string instance_id; | 111 string instance_id; |
109 string uuid; | 112 string uuid; |
110 uint32 properties; | 113 uint32 properties; |
111 }; | 114 }; |
112 | 115 |
116 struct WebBluetoothRemoteGATTDescriptor { | |
117 string instance_id; | |
118 string uuid; | |
119 }; | |
120 | |
113 // Web Bluetooth Interface that Blink can use to perform | 121 // Web Bluetooth Interface that Blink can use to perform |
114 // Bluetooth GATT Operations on Bluetooth Devices. | 122 // Bluetooth GATT Operations on Bluetooth Devices. |
115 interface WebBluetoothService { | 123 interface WebBluetoothService { |
116 // Sets the client for this WebBluetoothService. The service will notify the | 124 // Sets the client for this WebBluetoothService. The service will notify the |
117 // client of device events e.g. when a Characteristic's value changes or when | 125 // client of device events e.g. when a Characteristic's value changes or when |
118 // a device disconnects. | 126 // a device disconnects. |
119 SetClient(associated WebBluetoothServiceClient client); | 127 SetClient(associated WebBluetoothServiceClient client); |
120 | 128 |
121 RequestDevice(WebBluetoothRequestDeviceOptions options) | 129 RequestDevice(WebBluetoothRequestDeviceOptions options) |
122 => (WebBluetoothResult result, WebBluetoothDevice? device); | 130 => (WebBluetoothResult result, WebBluetoothDevice? device); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 | 180 |
173 // Starts notifications for the characteristic with | 181 // Starts notifications for the characteristic with |
174 // |characteristic_instance_id|. | 182 // |characteristic_instance_id|. |
175 RemoteCharacteristicStartNotifications( | 183 RemoteCharacteristicStartNotifications( |
176 string characteristic_instance_id) => (WebBluetoothResult result); | 184 string characteristic_instance_id) => (WebBluetoothResult result); |
177 | 185 |
178 // Stops notifications for the characteristic with | 186 // Stops notifications for the characteristic with |
179 // |characteristic_instance_id|. | 187 // |characteristic_instance_id|. |
180 RemoteCharacteristicStopNotifications( | 188 RemoteCharacteristicStopNotifications( |
181 string characteristic_instance_id) => (); | 189 string characteristic_instance_id) => (); |
190 | |
191 // Returns the Descriptors of a GATT Characteristic with |service_instance_id| . | |
ortuno
2016/12/08 05:42:52
Ah sorry I missed it on the first go:
s/service_i
dougt
2016/12/08 08:35:59
Done.
| |
192 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one | |
193 // descriptor will be returned. | |
194 RemoteCharacteristicGetDescriptors( | |
195 string characteristics_instance_id, | |
196 WebBluetoothGATTQueryQuantity quantity, | |
197 bluetooth.mojom.UUID? descriptor_uuid) => ( | |
198 WebBluetoothResult result, | |
199 array<WebBluetoothRemoteGATTDescriptor>? descriptors); | |
182 }; | 200 }; |
183 | 201 |
184 // Classes should implement this interface and pass an associated pointer | 202 // Classes should implement this interface and pass an associated pointer |
185 // bound to them to the WebBluetoothService by using SetClient. Classes | 203 // bound to them to the WebBluetoothService by using SetClient. Classes |
186 // that do this will be notified of device events e.g. device disconnection. | 204 // that do this will be notified of device events e.g. device disconnection. |
187 interface WebBluetoothServiceClient { | 205 interface WebBluetoothServiceClient { |
188 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 206 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
189 array<uint8> value); | 207 array<uint8> value); |
190 GattServerDisconnected(WebBluetoothDeviceId device_id); | 208 GattServerDisconnected(WebBluetoothDeviceId device_id); |
191 }; | 209 }; |
OLD | NEW |