Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom

Issue 2394423002: bluetooth: Rename blink::mojom::WebBluetoothError (Closed)
Patch Set: bluetooth: Rename blink::mojom::WebBluetoothError Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Errors that can occur during Web Bluetooth execution, which are transformed 9 // Result codes that can occur during Web Bluetooth execution, which are
10 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. 10 // transformed to a DOMException in Source/modules/bluetooth/BluetoothError.cpp.
11 // 11 //
12 // These errors all produce constant message strings. If a particular message 12 // These errors all produce constant message strings. If a particular message
13 // 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
14 // IPC ensures the dynamic component is passed. 14 // IPC ensures the dynamic component is passed.
15 enum WebBluetoothError { 15 enum WebBluetoothResult {
16 SUCCESS, 16 SUCCESS,
17 // AbortError: 17 // AbortError:
18 // InvalidModificationError: 18 // InvalidModificationError:
19 GATT_INVALID_ATTRIBUTE_LENGTH, 19 GATT_INVALID_ATTRIBUTE_LENGTH,
20 // InvalidStateError: 20 // InvalidStateError:
21 SERVICE_NO_LONGER_EXISTS, 21 SERVICE_NO_LONGER_EXISTS,
22 CHARACTERISTIC_NO_LONGER_EXISTS, 22 CHARACTERISTIC_NO_LONGER_EXISTS,
23 // NetworkError: 23 // NetworkError:
24 CONNECT_ALREADY_IN_PROGRESS, 24 CONNECT_ALREADY_IN_PROGRESS,
25 CONNECT_ATTRIBUTE_LENGTH_INVALID, 25 CONNECT_ATTRIBUTE_LENGTH_INVALID,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // Web Bluetooth Interface that Blink can use to perform 112 // Web Bluetooth Interface that Blink can use to perform
113 // Bluetooth GATT Operations on Bluetooth Devices. 113 // Bluetooth GATT Operations on Bluetooth Devices.
114 interface WebBluetoothService { 114 interface WebBluetoothService {
115 // Sets the client for this WebBluetoothService. The service will notify the 115 // Sets the client for this WebBluetoothService. The service will notify the
116 // client of device events e.g. when a Characteristic's value changes or when 116 // client of device events e.g. when a Characteristic's value changes or when
117 // a device disconnects. 117 // a device disconnects.
118 SetClient(associated WebBluetoothServiceClient client); 118 SetClient(associated WebBluetoothServiceClient client);
119 119
120 RequestDevice(WebBluetoothRequestDeviceOptions options) 120 RequestDevice(WebBluetoothRequestDeviceOptions options)
121 => (WebBluetoothError error, WebBluetoothDevice? device); 121 => (WebBluetoothResult result, WebBluetoothDevice? device);
122 122
123 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a 123 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a
124 // connection to the device didn't exist already. If a GATT connection existed 124 // connection to the device didn't exist already. If a GATT connection existed
125 // already then this function increases the ref count to keep that connection 125 // already then this function increases the ref count to keep that connection
126 // alive. 126 // alive.
127 RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothError erro r); 127 RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothResult res ult);
128 128
129 // If a GATT connection exists for Device with |device_id| then decreases 129 // If a GATT connection exists for Device with |device_id| then decreases
130 // the ref count for that connection. 130 // the ref count for that connection.
131 RemoteServerDisconnect(WebBluetoothDeviceId device_id); 131 RemoteServerDisconnect(WebBluetoothDeviceId device_id);
132 132
133 // If |services_uuid| is present, returns services with |services_uuid|. 133 // If |services_uuid| is present, returns services with |services_uuid|.
134 // Otherwise returns all non-blacklisted services. 134 // Otherwise returns all non-blacklisted services.
135 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one 135 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one
136 // service will be returned. 136 // service will be returned.
137 RemoteServerGetPrimaryServices( 137 RemoteServerGetPrimaryServices(
138 WebBluetoothDeviceId device_id, 138 WebBluetoothDeviceId device_id,
139 WebBluetoothGATTQueryQuantity quantity, 139 WebBluetoothGATTQueryQuantity quantity,
140 bluetooth.mojom.UUID? services_uuid) => ( 140 bluetooth.mojom.UUID? services_uuid) => (
141 WebBluetoothError error, 141 WebBluetoothResult result,
142 array<WebBluetoothRemoteGATTService>? services); 142 array<WebBluetoothRemoteGATTService>? services);
143 143
144 // Returns the Characteristics of a GATT Service with |service_instance_id|. 144 // Returns the Characteristics of a GATT Service with |service_instance_id|.
145 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one 145 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one
146 // characteristic will be returned. 146 // characteristic will be returned.
147 RemoteServiceGetCharacteristics( 147 RemoteServiceGetCharacteristics(
148 string service_instance_id, 148 string service_instance_id,
149 WebBluetoothGATTQueryQuantity quantity, 149 WebBluetoothGATTQueryQuantity quantity,
150 bluetooth.mojom.UUID? characteristics_uuid) => ( 150 bluetooth.mojom.UUID? characteristics_uuid) => (
151 WebBluetoothError error, 151 WebBluetoothResult result,
152 array<WebBluetoothRemoteGATTCharacteristic>? characteristics); 152 array<WebBluetoothRemoteGATTCharacteristic>? characteristics);
153 153
154 // Reads the value for characteristic with 154 // Reads the value for characteristic with
155 // |characteristic_instance_id|. If the value is successfully read the 155 // |characteristic_instance_id|. If the value is successfully read the
156 // callback will be run with WebBluetoothError::SUCCESS and the 156 // callback will be run with WebBluetoothResult::SUCCESS and the
157 // characteristic's value. If the value is not successfully read the 157 // characteristic's value. If the value is not successfully read the
158 // callback with be run with the corresponding error and nullptr for value. 158 // callback with be run with the corresponding error and nullptr for value.
159 RemoteCharacteristicReadValue( 159 RemoteCharacteristicReadValue(
160 string characteristic_instance_id) => ( 160 string characteristic_instance_id) => (
161 WebBluetoothError error, 161 WebBluetoothResult result,
162 array<uint8>? value); 162 array<uint8>? value);
163 163
164 // Writes a value to the characteristic with 164 // Writes a value to the characteristic with
165 // |characteristic_instance_id|. The callback is run with 165 // |characteristic_instance_id|. The callback is run with
166 // WebBluetoothError::SUCCESS if the value was successfully 166 // WebBluetoothResult::SUCCESS if the value was successfully
167 // written. 167 // written.
168 RemoteCharacteristicWriteValue( 168 RemoteCharacteristicWriteValue(
169 string characteristic_instance_id, 169 string characteristic_instance_id,
170 array<uint8> value) => (WebBluetoothError error); 170 array<uint8> value) => (WebBluetoothResult result);
171 171
172 // Starts notifications for the characteristic with 172 // Starts notifications for the characteristic with
173 // |characteristic_instance_id|. 173 // |characteristic_instance_id|.
174 RemoteCharacteristicStartNotifications( 174 RemoteCharacteristicStartNotifications(
175 string characteristic_instance_id) => (WebBluetoothError error); 175 string characteristic_instance_id) => (WebBluetoothResult result);
176 176
177 // Stops notifications for the characteristic with 177 // Stops notifications for the characteristic with
178 // |characteristic_instance_id|. 178 // |characteristic_instance_id|.
179 RemoteCharacteristicStopNotifications( 179 RemoteCharacteristicStopNotifications(
180 string characteristic_instance_id) => (); 180 string characteristic_instance_id) => ();
181 }; 181 };
182 182
183 // Classes should implement this interface and pass an associated pointer 183 // Classes should implement this interface and pass an associated pointer
184 // bound to them to the WebBluetoothService by using SetClient. Classes 184 // bound to them to the WebBluetoothService by using SetClient. Classes
185 // that do this will be notified of device events e.g. device disconnection. 185 // that do this will be notified of device events e.g. device disconnection.
186 interface WebBluetoothServiceClient { 186 interface WebBluetoothServiceClient {
187 RemoteCharacteristicValueChanged(string characteristic_instance_id, 187 RemoteCharacteristicValueChanged(string characteristic_instance_id,
188 array<uint8> value); 188 array<uint8> value);
189 GattServerDisconnected(WebBluetoothDeviceId device_id); 189 GattServerDisconnected(WebBluetoothDeviceId device_id);
190 }; 190 };
OLDNEW
« no previous file with comments | « third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698