OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
jbroman
2016/06/08 21:08:08
I assume the plan is ultimately for Blink to direc
ortuno
2016/06/09 16:15:59
Yup. There is so much code that we decided to do i
| |
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/bluetooth_uuid.mojom"; | |
8 | |
7 // Errors that can occur during Web Bluetooth execution, which are transformed | 9 // Errors that can occur during Web Bluetooth execution, which are transformed |
8 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. | 10 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. |
9 // | 11 // |
10 // These errors all produce constant message strings. If a particular message | 12 // These errors all produce constant message strings. If a particular message |
11 // needs a dynamic component, we should add a separate enum so type-checking the | 13 // needs a dynamic component, we should add a separate enum so type-checking the |
12 // IPC ensures the dynamic component is passed. | 14 // IPC ensures the dynamic component is passed. |
13 enum WebBluetoothError { | 15 enum WebBluetoothError { |
14 SUCCESS, | 16 SUCCESS, |
15 // AbortError: | 17 // AbortError: |
16 // InvalidModificationError: | 18 // InvalidModificationError: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 NOT_ALLOWED_TO_ACCESS_SERVICE, | 64 NOT_ALLOWED_TO_ACCESS_SERVICE, |
63 REQUEST_DEVICE_WITH_BLACKLISTED_UUID, | 65 REQUEST_DEVICE_WITH_BLACKLISTED_UUID, |
64 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, | 66 REQUEST_DEVICE_FROM_CROSS_ORIGIN_IFRAME, |
65 REQUEST_DEVICE_WITHOUT_FRAME, | 67 REQUEST_DEVICE_WITHOUT_FRAME, |
66 // SyntaxError: | 68 // SyntaxError: |
67 // TODO(ortuno): Remove once we no longer use IPC. | 69 // TODO(ortuno): Remove once we no longer use IPC. |
68 ENUM_MAX_VALUE = REQUEST_DEVICE_WITHOUT_FRAME, | 70 ENUM_MAX_VALUE = REQUEST_DEVICE_WITHOUT_FRAME, |
69 }; | 71 }; |
70 | 72 |
71 struct WebBluetoothScanFilter { | 73 struct WebBluetoothScanFilter { |
72 array<string>? services; | 74 array<device.mojom.BluetoothUUID>? services; |
73 string? name; | 75 string? name; |
74 string? name_prefix; | 76 string? name_prefix; |
75 }; | 77 }; |
76 | 78 |
77 struct WebBluetoothRequestDeviceOptions { | 79 struct WebBluetoothRequestDeviceOptions { |
78 array<WebBluetoothScanFilter> filters; | 80 array<WebBluetoothScanFilter> filters; |
79 array<string> optional_services; | 81 array<device.mojom.BluetoothUUID> optional_services; |
80 }; | 82 }; |
81 | 83 |
82 // Indicates if the function will return a single or multiple | 84 // Indicates if the function will return a single or multiple |
83 // GATT objects. | 85 // GATT objects. |
84 enum WebBluetoothGATTQueryQuantity { | 86 enum WebBluetoothGATTQueryQuantity { |
85 SINGLE, | 87 SINGLE, |
86 MULTIPLE | 88 MULTIPLE |
87 }; | 89 }; |
88 | 90 |
89 struct WebBluetoothDevice { | 91 struct WebBluetoothDevice { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 RemoteServerConnect(string device_id) => (WebBluetoothError error); | 126 RemoteServerConnect(string device_id) => (WebBluetoothError error); |
125 | 127 |
126 // If a GATT connection exists for Device with |device_id| then decreases | 128 // If a GATT connection exists for Device with |device_id| then decreases |
127 // the ref count for that connection. | 129 // the ref count for that connection. |
128 RemoteServerDisconnect(string device_id); | 130 RemoteServerDisconnect(string device_id); |
129 | 131 |
130 // Returns the first GATT Service with |service_uuid| of a Bluetooth Device | 132 // Returns the first GATT Service with |service_uuid| of a Bluetooth Device |
131 // with |device_id|. | 133 // with |device_id|. |
132 RemoteServerGetPrimaryService( | 134 RemoteServerGetPrimaryService( |
133 string device_id, | 135 string device_id, |
134 string service_uuid) => ( | 136 device.mojom.BluetoothUUID service_uuid) => ( |
135 WebBluetoothError error, | 137 WebBluetoothError error, |
136 WebBluetoothRemoteGATTService? service); | 138 WebBluetoothRemoteGATTService? service); |
137 | 139 |
138 // Returns the Characteristics of a GATT Service with |service_instance_id|. | 140 // Returns the Characteristics of a GATT Service with |service_instance_id|. |
139 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one | 141 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one |
140 // characteristic will be returned. | 142 // characteristic will be returned. |
141 RemoteServiceGetCharacteristics( | 143 RemoteServiceGetCharacteristics( |
142 string service_instance_id, | 144 string service_instance_id, |
143 WebBluetoothGATTQueryQuantity quantity, | 145 WebBluetoothGATTQueryQuantity quantity, |
144 string? characteristics_uuid) => ( | 146 device.mojom.BluetoothUUID? characteristics_uuid) => ( |
145 WebBluetoothError error, | 147 WebBluetoothError error, |
146 array<WebBluetoothRemoteGATTCharacteristic>? characteristics); | 148 array<WebBluetoothRemoteGATTCharacteristic>? characteristics); |
147 | 149 |
148 // Reads the value for characteristic with | 150 // Reads the value for characteristic with |
149 // |characteristic_instance_id|. If the value is successfully read the | 151 // |characteristic_instance_id|. If the value is successfully read the |
150 // callback will be run with WebBluetoothError::SUCCESS and the | 152 // callback will be run with WebBluetoothError::SUCCESS and the |
151 // characteristic's value. If the value is not successfully read the | 153 // characteristic's value. If the value is not successfully read the |
152 // callback with be run with the corresponding error and nullptr for value. | 154 // callback with be run with the corresponding error and nullptr for value. |
153 RemoteCharacteristicReadValue( | 155 RemoteCharacteristicReadValue( |
154 string characteristic_instance_id) => ( | 156 string characteristic_instance_id) => ( |
(...skipping 20 matching lines...) Expand all Loading... | |
175 }; | 177 }; |
176 | 178 |
177 // Classes should implement this interface and pass an associated pointer | 179 // Classes should implement this interface and pass an associated pointer |
178 // bound to them to the WebBluetoothService by using SetClient. Classes | 180 // bound to them to the WebBluetoothService by using SetClient. Classes |
179 // that do this will be notified of device events e.g. device disconnection. | 181 // that do this will be notified of device events e.g. device disconnection. |
180 interface WebBluetoothServiceClient { | 182 interface WebBluetoothServiceClient { |
181 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 183 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
182 array<uint8> value); | 184 array<uint8> value); |
183 GattServerDisconnected(string device_id); | 185 GattServerDisconnected(string device_id); |
184 }; | 186 }; |
OLD | NEW |