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

Side by Side Diff: components/arc/common/bluetooth.mojom

Issue 1927803002: arc: bluetooth: Add gatt client functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change uuid to uint16 in BluetoothServiceData Created 4 years, 6 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
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 arc.mojom; 5 module arc.mojom;
6 6
7 [Extensible] 7 [Extensible]
8 enum BluetoothAdapterState { 8 enum BluetoothAdapterState {
9 OFF = 0, 9 OFF = 0,
10 ON 10 ON
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 BluetoothServiceRecord service_record; 121 BluetoothServiceRecord service_record;
122 BluetoothScanMode adapter_scan_mode; 122 BluetoothScanMode adapter_scan_mode;
123 array<BluetoothAddress> bonded_devices; 123 array<BluetoothAddress> bonded_devices;
124 uint32 discovery_timeout; 124 uint32 discovery_timeout;
125 string remote_friendly_name; 125 string remote_friendly_name;
126 int32 remote_rssi; 126 int32 remote_rssi;
127 BluetoothRemoteVersion remote_version; 127 BluetoothRemoteVersion remote_version;
128 BluetoothLocalLEFeatures local_le_features; 128 BluetoothLocalLEFeatures local_le_features;
129 }; 129 };
130 130
131 // Bluetooth GATT types
132 [Extensible]
133 enum BluetoothGattStatus {
rkc 2016/06/07 02:34:31 Document where the values that we're assigning to
puthik_chromium 2016/06/08 23:59:51 Done.
134 GATT_SUCCESS = 0,
135 GATT_READ_NOT_PERMITTED = 0x2,
136 GATT_WRITE_NOT_PERMITTED = 0x3,
137 GATT_INSUFFICIENT_AUTHENTICATION = 0x5,
138 GATT_REQUEST_NOT_SUPPORTED = 0x6,
139 GATT_INVALID_OFFSET = 0x7,
140 GATT_INVALID_ATTRIBUTE_LENGTH = 0xd,
141 GATT_INSUFFICIENT_ENCRYPTION = 0xf,
142 GATT_CONNECTION_CONGESTED = 0x8f,
143 GATT_FAILURE = 0x101,
144 };
145
146 struct BluetoothGattID {
147 BluetoothUUID uuid;
148 uint8 inst_id;
149 };
150
151 struct BluetoothGattServiceID {
152 BluetoothGattID id;
153 uint8 is_primary;
154 };
155
156 struct BluetoothGattValue {
157 BluetoothGattStatus status;
158 uint32 len;
159 uint32 type;
160 array<uint8> value;
161 };
162
163 // Copy from Bluetooth Assigned Numbers Document, Generic Access Profile
164 // https://www.bluetooth.com/specifications/assigned-numbers/generic-access-prof ile
165 [Extensible]
166 enum BluetoothAdvertisingDataType {
167 DATA_TYPE_FLAGS = 0x01,
168 DATA_TYPE_SERVICE_UUIDS_128_BIT_COMPLETE = 0x07,
169 DATA_TYPE_LOCAL_NAME_COMPLETE = 0x09,
170 DATA_TYPE_TX_POWER_LEVEL = 0x0A,
171 DATA_TYPE_SERVICE_DATA = 0x16,
172 DATA_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xff,
173 };
174
175 // Copy from Bluetooth Core v4.2 Volume 3 Part C Chapter 11
176 // and Bluetooth Core Specification Supplement v6 Part A Chapter 1
177 // https://www.bluetooth.com/specifications/adopted-specifications
178 union BluetoothAdvertisingData {
179 uint8 flags;
180 array<BluetoothUUID> service_uuids;
181 string local_name;
182 uint8 tx_power_level;
183 BluetoothServiceData service_data;
184 array<uint8> manufacture_data;
185 array<uint8> other_data;
186 };
187
188 struct BluetoothServiceData {
189 uint16 uuid_16bit;
190 array<uint8> data;
191 };
192
193 [Extensible]
194 enum BluetoothGattDBAttributeType {
195 BTGATT_DB_PRIMARY_SERVICE = 0,
196 BTGATT_DB_SECONDARY_SERVICE,
197 BTGATT_DB_INCLUDED_SERVICE,
198 BTGATT_DB_CHARACTERISTIC,
199 BTGATT_DB_DESCRIPTOR,
200 };
201
202 struct BluetoothGattDBElement {
203 uint8 id;
204 BluetoothUUID uuid;
205 BluetoothGattDBAttributeType type;
206 uint16 attribute_handle;
207
208 /*
209 * If |type| is |BTGATT_DB_PRIMARY_SERVICE|, or
210 * |BTGATT_DB_SECONDARY_SERVICE|, this contains the start and end attribute
211 * handles.
rkc 2016/06/07 02:34:31 Here you're saying that they contain the starting
puthik_chromium 2016/06/08 00:56:19 The comment is correct because I copy from Android
212 */
213 uint16 start_handle;
214 uint16 end_handle;
215
216 /*
217 * If |type| is |BTGATT_DB_CHARACTERISTIC|, this contains the properties of
218 * the characteristic.
219 */
220 uint8 properties;
221 };
222
131 interface BluetoothHost { 223 interface BluetoothHost {
132 EnableAdapter() => (BluetoothAdapterState state); 224 EnableAdapter() => (BluetoothAdapterState state);
133 DisableAdapter() => (BluetoothAdapterState state); 225 DisableAdapter() => (BluetoothAdapterState state);
134 GetAdapterProperty(BluetoothPropertyType type); 226 GetAdapterProperty(BluetoothPropertyType type);
135 SetAdapterProperty(BluetoothProperty property); 227 SetAdapterProperty(BluetoothProperty property);
136 GetRemoteDeviceProperty(BluetoothAddress remote_addr, 228 GetRemoteDeviceProperty(BluetoothAddress remote_addr,
137 BluetoothPropertyType type); 229 BluetoothPropertyType type);
138 SetRemoteDeviceProperty(BluetoothAddress remote_addr, 230 SetRemoteDeviceProperty(BluetoothAddress remote_addr,
139 BluetoothProperty property); 231 BluetoothProperty property);
140 GetRemoteServiceRecord(BluetoothAddress remote_addr, 232 GetRemoteServiceRecord(BluetoothAddress remote_addr,
141 BluetoothUUID uuid); 233 BluetoothUUID uuid);
142 GetRemoteServices(BluetoothAddress remote_addr); 234 GetRemoteServices(BluetoothAddress remote_addr);
143 StartDiscovery(); 235 StartDiscovery();
144 CancelDiscovery(); 236 CancelDiscovery();
145 CreateBond(BluetoothAddress addr, int32 transport); 237 CreateBond(BluetoothAddress addr, int32 transport);
146 RemoveBond(BluetoothAddress addr); 238 RemoveBond(BluetoothAddress addr);
147 CancelBond(BluetoothAddress addr); 239 CancelBond(BluetoothAddress addr);
148 240
149 GetConnectionState(BluetoothAddress addr) => (bool connected); 241 GetConnectionState(BluetoothAddress addr) => (bool connected);
242
243 // Bluetooth Gatt Client functions
244 [MinVersion=1] StartLEScan();
245 [MinVersion=1] StopLEScan();
246 [MinVersion=1] ConnectLEDevice(BluetoothAddress remote_addr);
247 [MinVersion=1] DisconnectLEDevice(BluetoothAddress remote_addr);
248 [MinVersion=1] SearchService(BluetoothAddress remote_addr);
249 [MinVersion=1] GetGattDB(BluetoothAddress remote_addr);
250 [MinVersion=1] StartLEListen() => (BluetoothGattStatus status);
251 [MinVersion=1] StopLEListen() => (BluetoothGattStatus status);
252 [MinVersion=1] ReadGattCharacteristic(BluetoothAddress remote_addr,
253 BluetoothGattServiceID service_id,
254 BluetoothGattID char_id)
255 => (BluetoothGattValue value);
256 [MinVersion=1] WriteGattCharacteristic(BluetoothAddress remote_addr,
257 BluetoothGattServiceID service_id,
258 BluetoothGattID char_id,
259 BluetoothGattValue value)
260 => (BluetoothGattStatus status);
261 [MinVersion=1] ReadGattDescriptor(BluetoothAddress remote_addr,
262 BluetoothGattServiceID service_id,
263 BluetoothGattID char_id,
264 BluetoothGattID desc_id)
265 => (BluetoothGattValue value);
266 [MinVersion=1] WriteGattDescriptor(BluetoothAddress remote_addr,
267 BluetoothGattServiceID service_id,
268 BluetoothGattID char_id,
269 BluetoothGattID desc_id,
270 BluetoothGattValue value)
271 => (BluetoothGattStatus status);
272 [MinVersion=1] RegisterForGattNotification(BluetoothAddress remote_addr,
273 BluetoothGattServiceID service_id,
274 BluetoothGattID char_id)
275 => (BluetoothGattStatus status);
276 [MinVersion=1] DeregisterForGattNotification(BluetoothAddress remote_addr,
277 BluetoothGattServiceID service_id ,
278 BluetoothGattID char_id)
279 => (BluetoothGattStatus status);
280 [MinVersion=1] ReadRemoteRssi(BluetoothAddress remote_addr)
281 => (int32 rssi);
282
150 }; 283 };
151 284
152 interface BluetoothInstance { 285 interface BluetoothInstance {
153 Init(BluetoothHost host_ptr); 286 Init(BluetoothHost host_ptr);
154 287
155 OnAdapterProperties(BluetoothStatus status, 288 OnAdapterProperties(BluetoothStatus status,
156 array<BluetoothProperty> properties); 289 array<BluetoothProperty> properties);
157 OnRemoteDeviceProperties(BluetoothStatus status, 290 OnRemoteDeviceProperties(BluetoothStatus status,
158 BluetoothAddress address, 291 BluetoothAddress address,
159 array<BluetoothProperty> properties); 292 array<BluetoothProperty> properties);
160 OnDeviceFound(array<BluetoothProperty> properties); 293 OnDeviceFound(array<BluetoothProperty> properties);
161 OnDiscoveryStateChanged(BluetoothDiscoveryState state); 294 OnDiscoveryStateChanged(BluetoothDiscoveryState state);
162 OnBondStateChanged(BluetoothStatus status, 295 OnBondStateChanged(BluetoothStatus status,
163 BluetoothAddress remote_addr, 296 BluetoothAddress remote_addr,
164 BluetoothBondState state); 297 BluetoothBondState state);
165 OnAclStateChanged(BluetoothStatus status, 298 OnAclStateChanged(BluetoothStatus status,
166 BluetoothAddress remote_addr, 299 BluetoothAddress remote_addr,
167 BluetoothAclState state); 300 BluetoothAclState state);
301
302 // Bluetooth Gatt Client callbacks
303 [MinVersion=1] OnLEDeviceFound(BluetoothAddress addr,
304 int32 rssi,
305 array<BluetoothAdvertisingData> adv_data);
306 [MinVersion=1] OnLEConnectionStateChange(BluetoothAddress remote_addr,
307 bool connected);
308 [MinVersion=1] OnSearchComplete(BluetoothAddress remote_addr,
309 BluetoothGattStatus status);
310 [MinVersion=1] OnGetGattDB(BluetoothAddress remote_addr,
311 array<BluetoothGattDBElement> db);
312 [MinVersion=1] OnServicesRemoved(BluetoothAddress remote_addr,
313 uint16 start_handle,
314 uint16 end_handle);
315 [MinVersion=1] OnServicesAdded(BluetoothAddress remote_addr,
316 array<BluetoothGattDBElement> db);
168 }; 317 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698