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 struct WebBluetoothScanFilter { | |
72 array<string>? services; | |
73 string? name; | |
74 string? name_prefix; | |
75 }; | |
76 | |
77 struct WebBluetoothRequestDeviceOptions { | |
78 array<WebBluetoothScanFilter> filters; | |
Jeffrey Yasskin
2016/05/13 04:41:59
I don't suppose there's a way to say that the elem
ortuno
2016/05/13 20:11:18
There is! It's the way it's written now haha. If w
| |
79 array<string> optional_services; | |
80 }; | |
81 | |
71 // Indicates if the function will return a single or multiple | 82 // Indicates if the function will return a single or multiple |
72 // GATT objects. | 83 // GATT objects. |
73 enum WebBluetoothGATTQueryQuantity { | 84 enum WebBluetoothGATTQueryQuantity { |
74 SINGLE, | 85 SINGLE, |
75 MULTIPLE | 86 MULTIPLE |
76 }; | 87 }; |
77 | 88 |
89 struct WebBluetoothDevice { | |
90 string id; | |
91 string name; | |
92 array<string> uuids; | |
93 }; | |
94 | |
78 struct WebBluetoothRemoteGATTService { | 95 struct WebBluetoothRemoteGATTService { |
79 string instance_id; | 96 string instance_id; |
80 string uuid; | 97 string uuid; |
81 }; | 98 }; |
82 | 99 |
83 struct WebBluetoothRemoteGATTCharacteristic { | 100 struct WebBluetoothRemoteGATTCharacteristic { |
84 string instance_id; | 101 string instance_id; |
85 string uuid; | 102 string uuid; |
86 uint32 properties; | 103 uint32 properties; |
87 }; | 104 }; |
88 | 105 |
89 // TODO(ortuno): Define Bluetooth Service. | 106 // TODO(ortuno): Define Bluetooth Service. |
90 // https://crbug.com/508771 | 107 // https://crbug.com/508771 |
91 | 108 |
92 // Web Bluetooth Interface that Blink can use to perform | 109 // Web Bluetooth Interface that Blink can use to perform |
93 // Bluetooth GATT Operations on Bluetooth Devices. | 110 // Bluetooth GATT Operations on Bluetooth Devices. |
94 interface WebBluetoothService { | 111 interface WebBluetoothService { |
95 // Sets the client for this WebBluetoothService. The service will notify the | 112 // Sets the client for this WebBluetoothService. The service will notify the |
96 // client of device events e.g. when a Characteristic's value changes or when | 113 // client of device events e.g. when a Characteristic's value changes or when |
97 // a device disconnects. | 114 // a device disconnects. |
98 SetClient(associated WebBluetoothServiceClient client); | 115 SetClient(associated WebBluetoothServiceClient client); |
99 | 116 |
117 RequestDevice(WebBluetoothRequestDeviceOptions options) | |
118 => (WebBluetoothError error, WebBluetoothDevice? device); | |
119 | |
100 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a | 120 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a |
101 // connection to the device didn't exist already. If a GATT connection existed | 121 // connection to the device didn't exist already. If a GATT connection existed |
102 // already then this function increases the ref count to keep that connection | 122 // already then this function increases the ref count to keep that connection |
103 // alive. | 123 // alive. |
104 RemoteServerConnect(string device_id) => (WebBluetoothError error); | 124 RemoteServerConnect(string device_id) => (WebBluetoothError error); |
105 | 125 |
106 // If a GATT connection exists for Device with |device_id| then decreases | 126 // If a GATT connection exists for Device with |device_id| then decreases |
107 // the ref count for that connection. | 127 // the ref count for that connection. |
108 RemoteServerDisconnect(string device_id); | 128 RemoteServerDisconnect(string device_id); |
109 | 129 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 string characteristic_instance_id) => (); | 174 string characteristic_instance_id) => (); |
155 }; | 175 }; |
156 | 176 |
157 // Classes should implement this interface and pass an associated pointer | 177 // Classes should implement this interface and pass an associated pointer |
158 // bound to them to the WebBluetoothService by using SetClient. Classes | 178 // bound to them to the WebBluetoothService by using SetClient. Classes |
159 // that do this will be notified of device events e.g. device disconnection. | 179 // that do this will be notified of device events e.g. device disconnection. |
160 interface WebBluetoothServiceClient { | 180 interface WebBluetoothServiceClient { |
161 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 181 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
162 array<uint8> value); | 182 array<uint8> value); |
163 }; | 183 }; |
OLD | NEW |