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 "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 Loading... |
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 | |
97 struct WebBluetoothDevice { | 93 struct WebBluetoothDevice { |
98 WebBluetoothDeviceId id; | 94 string id; |
99 string name; | 95 string name; |
100 array<string> uuids; | 96 array<string> uuids; |
101 }; | 97 }; |
102 | 98 |
103 struct WebBluetoothRemoteGATTService { | 99 struct WebBluetoothRemoteGATTService { |
104 string instance_id; | 100 string instance_id; |
105 string uuid; | 101 string uuid; |
106 }; | 102 }; |
107 | 103 |
108 struct WebBluetoothRemoteGATTCharacteristic { | 104 struct WebBluetoothRemoteGATTCharacteristic { |
(...skipping 10 matching lines...) Expand all Loading... |
119 // a device disconnects. | 115 // a device disconnects. |
120 SetClient(associated WebBluetoothServiceClient client); | 116 SetClient(associated WebBluetoothServiceClient client); |
121 | 117 |
122 RequestDevice(WebBluetoothRequestDeviceOptions options) | 118 RequestDevice(WebBluetoothRequestDeviceOptions options) |
123 => (WebBluetoothError error, WebBluetoothDevice? device); | 119 => (WebBluetoothError error, WebBluetoothDevice? device); |
124 | 120 |
125 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a | 121 // Creates a GATT Connection to a Bluetooth Device with |device_id| if a |
126 // connection to the device didn't exist already. If a GATT connection existed | 122 // connection to the device didn't exist already. If a GATT connection existed |
127 // already then this function increases the ref count to keep that connection | 123 // already then this function increases the ref count to keep that connection |
128 // alive. | 124 // alive. |
129 RemoteServerConnect(WebBluetoothDeviceId device_id) => (WebBluetoothError erro
r); | 125 RemoteServerConnect(string device_id) => (WebBluetoothError error); |
130 | 126 |
131 // If a GATT connection exists for Device with |device_id| then decreases | 127 // If a GATT connection exists for Device with |device_id| then decreases |
132 // the ref count for that connection. | 128 // the ref count for that connection. |
133 RemoteServerDisconnect(WebBluetoothDeviceId device_id); | 129 RemoteServerDisconnect(string device_id); |
134 | 130 |
135 // If |services_uuid| is present, returns services with |services_uuid|. | 131 // If |services_uuid| is present, returns services with |services_uuid|. |
136 // Otherwise returns all non-blacklisted services. | 132 // Otherwise returns all non-blacklisted services. |
137 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one | 133 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one |
138 // service will be returned. | 134 // service will be returned. |
139 RemoteServerGetPrimaryServices( | 135 RemoteServerGetPrimaryServices( |
140 WebBluetoothDeviceId device_id, | 136 string device_id, |
141 WebBluetoothGATTQueryQuantity quantity, | 137 WebBluetoothGATTQueryQuantity quantity, |
142 device.mojom.BluetoothUUID? services_uuid) => ( | 138 device.mojom.BluetoothUUID? services_uuid) => ( |
143 WebBluetoothError error, | 139 WebBluetoothError error, |
144 array<WebBluetoothRemoteGATTService>? services); | 140 array<WebBluetoothRemoteGATTService>? services); |
145 | 141 |
146 // Returns the Characteristics of a GATT Service with |service_instance_id|. | 142 // Returns the Characteristics of a GATT Service with |service_instance_id|. |
147 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one | 143 // If |quantity| == WebBluetoothGATTQueryQuantity::SINGLE, only one |
148 // characteristic will be returned. | 144 // characteristic will be returned. |
149 RemoteServiceGetCharacteristics( | 145 RemoteServiceGetCharacteristics( |
150 string service_instance_id, | 146 string service_instance_id, |
(...skipping 30 matching lines...) Expand all Loading... |
181 RemoteCharacteristicStopNotifications( | 177 RemoteCharacteristicStopNotifications( |
182 string characteristic_instance_id) => (); | 178 string characteristic_instance_id) => (); |
183 }; | 179 }; |
184 | 180 |
185 // Classes should implement this interface and pass an associated pointer | 181 // Classes should implement this interface and pass an associated pointer |
186 // bound to them to the WebBluetoothService by using SetClient. Classes | 182 // bound to them to the WebBluetoothService by using SetClient. Classes |
187 // that do this will be notified of device events e.g. device disconnection. | 183 // that do this will be notified of device events e.g. device disconnection. |
188 interface WebBluetoothServiceClient { | 184 interface WebBluetoothServiceClient { |
189 RemoteCharacteristicValueChanged(string characteristic_instance_id, | 185 RemoteCharacteristicValueChanged(string characteristic_instance_id, |
190 array<uint8> value); | 186 array<uint8> value); |
191 GattServerDisconnected(WebBluetoothDeviceId device_id); | 187 GattServerDisconnected(string device_id); |
192 }; | 188 }; |
OLD | NEW |