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

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

Issue 2019853002: bluetooth: Use WebBluetoothDeviceId instead of string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uuid-typemap
Patch Set: Rebase Created 4 years, 4 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/blink.gyp ('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/bluetooth_uuid.mojom"; 7 import "device/bluetooth/public/interfaces/bluetooth_uuid.mojom";
8 8
9 // Errors that can occur during Web Bluetooth execution, which are transformed 9 // Errors that can occur during Web Bluetooth execution, which are transformed
10 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. 10 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 array<device.mojom.BluetoothUUID> optional_services; 83 array<device.mojom.BluetoothUUID> optional_services;
84 }; 84 };
85 85
86 // Indicates if the function will return a single or multiple 86 // Indicates if the function will return a single or multiple
87 // GATT objects. 87 // GATT objects.
88 enum WebBluetoothGATTQueryQuantity { 88 enum WebBluetoothGATTQueryQuantity {
89 SINGLE, 89 SINGLE,
90 MULTIPLE 90 MULTIPLE
91 }; 91 };
92 92
93 struct WebBluetoothDeviceId {
94 string device_id;
95 };
96
93 struct WebBluetoothDevice { 97 struct WebBluetoothDevice {
94 string id; 98 WebBluetoothDeviceId id;
95 string? name; 99 string? name;
96 array<string> uuids; 100 array<string> uuids;
97 }; 101 };
98 102
99 struct WebBluetoothRemoteGATTService { 103 struct WebBluetoothRemoteGATTService {
100 string instance_id; 104 string instance_id;
101 string uuid; 105 string uuid;
102 }; 106 };
103 107
104 struct WebBluetoothRemoteGATTCharacteristic { 108 struct WebBluetoothRemoteGATTCharacteristic {
(...skipping 10 matching lines...) Expand all
115 // a device disconnects. 119 // a device disconnects.
116 SetClient(associated WebBluetoothServiceClient client); 120 SetClient(associated WebBluetoothServiceClient client);
117 121
118 RequestDevice(WebBluetoothRequestDeviceOptions options) 122 RequestDevice(WebBluetoothRequestDeviceOptions options)
119 => (WebBluetoothError error, WebBluetoothDevice? device); 123 => (WebBluetoothError error, WebBluetoothDevice? device);
120 124
121 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a 125 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a
122 // connection to the device didn't exist already. If a GATT connection existed 126 // connection to the device didn't exist already. If a GATT connection existed
123 // already then this function increases the ref count to keep that connection 127 // already then this function increases the ref count to keep that connection
124 // alive. 128 // alive.
125 RemoteServerConnect(string device_id) => (WebBluetoothError error); 129 RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothError erro r);
126 130
127 // If a GATT connection exists for Device with |device_id| then decreases 131 // If a GATT connection exists for Device with |device_id| then decreases
128 // the ref count for that connection. 132 // the ref count for that connection.
129 RemoteServerDisconnect(string device_id); 133 RemoteServerDisconnect(WebBluetoothDeviceId device_id);
130 134
131 // If |services_uuid| is present, returns services with |services_uuid|. 135 // If |services_uuid| is present, returns services with |services_uuid|.
132 // Otherwise returns all non-blacklisted services. 136 // Otherwise returns all non-blacklisted services.
133 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one 137 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one
134 // service will be returned. 138 // service will be returned.
135 RemoteServerGetPrimaryServices( 139 RemoteServerGetPrimaryServices(
136 string device_id, 140 WebBluetoothDeviceId device_id,
137 WebBluetoothGATTQueryQuantity quantity, 141 WebBluetoothGATTQueryQuantity quantity,
138 device.mojom.BluetoothUUID? services_uuid) => ( 142 device.mojom.BluetoothUUID? services_uuid) => (
139 WebBluetoothError error, 143 WebBluetoothError error,
140 array<WebBluetoothRemoteGATTService>? services); 144 array<WebBluetoothRemoteGATTService>? services);
141 145
142 // Returns the Characteristics of a GATT Service with |service_instance_id|. 146 // Returns the Characteristics of a GATT Service with |service_instance_id|.
143 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one 147 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one
144 // characteristic will be returned. 148 // characteristic will be returned.
145 RemoteServiceGetCharacteristics( 149 RemoteServiceGetCharacteristics(
146 string service_instance_id, 150 string service_instance_id,
(...skipping 30 matching lines...) Expand all
177 RemoteCharacteristicStopNotifications( 181 RemoteCharacteristicStopNotifications(
178 string characteristic_instance_id) => (); 182 string characteristic_instance_id) => ();
179 }; 183 };
180 184
181 // Classes should implement this interface and pass an associated pointer 185 // Classes should implement this interface and pass an associated pointer
182 // bound to them to the WebBluetoothService by using SetClient. Classes 186 // bound to them to the WebBluetoothService by using SetClient. Classes
183 // that do this will be notified of device events e.g. device disconnection. 187 // that do this will be notified of device events e.g. device disconnection.
184 interface WebBluetoothServiceClient { 188 interface WebBluetoothServiceClient {
185 RemoteCharacteristicValueChanged(string characteristic_instance_id, 189 RemoteCharacteristicValueChanged(string characteristic_instance_id,
186 array<uint8> value); 190 array<uint8> value);
187 GattServerDisconnected(string device_id); 191 GattServerDisconnected(WebBluetoothDeviceId device_id);
188 }; 192 };
OLDNEW
« no previous file with comments | « third_party/WebKit/public/blink.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698