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 "components/web_bluetooth/public/interfaces/web_bluetooth_device_id.mojom
"; |
7 import "device/bluetooth/public/interfaces/bluetooth_uuid.mojom"; | 8 import "device/bluetooth/public/interfaces/bluetooth_uuid.mojom"; |
8 | 9 |
9 // Errors that can occur during Web Bluetooth execution, which are transformed | 10 // Errors that can occur during Web Bluetooth execution, which are transformed |
10 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. | 11 // to a DOMException in Source/modules/bluetooth/BluetoothError.cpp. |
11 // | 12 // |
12 // These errors all produce constant message strings. If a particular message | 13 // 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 | 14 // needs a dynamic component, we should add a separate enum so type-checking the |
14 // IPC ensures the dynamic component is passed. | 15 // IPC ensures the dynamic component is passed. |
15 enum WebBluetoothError { | 16 enum WebBluetoothError { |
16 SUCCESS, | 17 SUCCESS, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 }; | 85 }; |
85 | 86 |
86 // Indicates if the function will return a single or multiple | 87 // Indicates if the function will return a single or multiple |
87 // GATT objects. | 88 // GATT objects. |
88 enum WebBluetoothGATTQueryQuantity { | 89 enum WebBluetoothGATTQueryQuantity { |
89 SINGLE, | 90 SINGLE, |
90 MULTIPLE | 91 MULTIPLE |
91 }; | 92 }; |
92 | 93 |
93 struct WebBluetoothDevice { | 94 struct WebBluetoothDevice { |
94 string id; | 95 web_bluetooth.mojom.WebBluetoothDeviceId id; |
95 string name; | 96 string name; |
96 array<string> uuids; | 97 array<string> uuids; |
97 }; | 98 }; |
98 | 99 |
99 struct WebBluetoothRemoteGATTService { | 100 struct WebBluetoothRemoteGATTService { |
100 string instance_id; | 101 string instance_id; |
101 string uuid; | 102 string uuid; |
102 }; | 103 }; |
103 | 104 |
104 struct WebBluetoothRemoteGATTCharacteristic { | 105 struct WebBluetoothRemoteGATTCharacteristic { |
(...skipping 10 matching lines...) Expand all Loading... |
115 // a device disconnects. | 116 // a device disconnects. |
116 SetClient(associated WebBluetoothServiceClient client); | 117 SetClient(associated WebBluetoothServiceClient client); |
117 | 118 |
118 RequestDevice(WebBluetoothRequestDeviceOptions options) | 119 RequestDevice(WebBluetoothRequestDeviceOptions options) |
119 => (WebBluetoothError error, WebBluetoothDevice? device); | 120 => (WebBluetoothError error, WebBluetoothDevice? device); |
120 | 121 |
121 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a | 122 // 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 | 123 // 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 | 124 // already then this function increases the ref count to keep that connection |
124 // alive. | 125 // alive. |
125 RemoteServerConnect(string device_id) => (WebBluetoothError error); | 126 RemoteServerConnect(web_bluetooth.mojom.WebBluetoothDeviceId device_id) => (We
bBluetoothError error); |
126 | 127 |
127 // 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 |
128 // the ref count for that connection. | 129 // the ref count for that connection. |
129 RemoteServerDisconnect(string device_id); | 130 RemoteServerDisconnect(web_bluetooth.mojom.WebBluetoothDeviceId device_id); |
130 | 131 |
131 // If |services_uuid| is present, returns services with |services_uuid|. | 132 // If |services_uuid| is present, returns services with |services_uuid|. |
132 // Otherwise returns all non-blacklisted services. | 133 // Otherwise returns all non-blacklisted services. |
133 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one | 134 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one |
134 // service will be returned. | 135 // service will be returned. |
135 RemoteServerGetPrimaryServices( | 136 RemoteServerGetPrimaryServices( |
136 string device_id, | 137 web_bluetooth.mojom.WebBluetoothDeviceId device_id, |
137 WebBluetoothGATTQueryQuantity quantity, | 138 WebBluetoothGATTQueryQuantity quantity, |
138 device.mojom.BluetoothUUID? services_uuid) => ( | 139 device.mojom.BluetoothUUID? services_uuid) => ( |
139 WebBluetoothError error, | 140 WebBluetoothError error, |
140 array<WebBluetoothRemoteGATTService>? services); | 141 array<WebBluetoothRemoteGATTService>? services); |
141 | 142 |
142 // Returns the Characteristics of a GATT Service with |service_instance_id|. | 143 // Returns the Characteristics of a GATT Service with |service_instance_id|. |
143 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one | 144 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one |
144 // characteristic will be returned. | 145 // characteristic will be returned. |
145 RemoteServiceGetCharacteristics( | 146 RemoteServiceGetCharacteristics( |
146 string service_instance_id, | 147 string service_instance_id, |
(...skipping 30 matching lines...) Expand all Loading... |
177 RemoteCharacteristicStopNotifications( | 178 RemoteCharacteristicStopNotifications( |
178 string characteristic_instance_id) => (); | 179 string characteristic_instance_id) => (); |
179 }; | 180 }; |
180 | 181 |
181 // Classes should implement this interface and pass an associated pointer | 182 // Classes should implement this interface and pass an associated pointer |
182 // bound to them to the WebBluetoothService by using SetClient. Classes | 183 // bound to them to the WebBluetoothService by using SetClient. Classes |
183 // that do this will be notified of device events e.g. device disconnection. | 184 // that do this will be notified of device events e.g. device disconnection. |
184 interface WebBluetoothServiceClient { | 185 interface WebBluetoothServiceClient { |
185 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 186 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
186 array<uint8> value); | 187 array<uint8> value); |
187 GattServerDisconnected(string device_id); | 188 GattServerDisconnected(web_bluetooth.mojom.WebBluetoothDeviceId device_id); |
188 }; | 189 }; |
OLD | NEW |