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

Side by Side Diff: device/bluetooth/public/interfaces/adapter.mojom

Issue 2448713002: bluetooth: Add Device connection logic and accompanying user interface. (Closed)
Patch Set: Created 4 years, 1 month 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 bluetooth.mojom; 5 module bluetooth.mojom;
6 6
7 import "device/bluetooth/public/interfaces/device.mojom"; 7 import "device/bluetooth/public/interfaces/device.mojom";
8 8
9 // TODO(crbug.com/657632): Remove when numerical values can be optional.
10 struct ConnectError {
ortuno 2016/10/25 10:42:10 http://crbug.com/657632 discourages this approach.
mbrunson 2016/10/25 20:03:04 Done.
11 enum Code {
ortuno 2016/10/25 10:42:09 Add DEVICE_NO_LONGER_IN_RANGE. Also drop the ERRO
mbrunson 2016/10/25 20:03:04 Done.
12 ERROR_ATTRIBUTE_LENGTH_INVALID,
13 ERROR_AUTH_CANCELED,
14 ERROR_AUTH_FAILED,
15 ERROR_AUTH_REJECTED,
16 ERROR_AUTH_TIMEOUT,
17 ERROR_CONNECTION_CONGESTED,
18 ERROR_FAILED,
19 ERROR_INPROGRESS,
20 ERROR_INSUFFICIENT_ENCRYPTION,
21 ERROR_OFFSET_INVALID,
22 ERROR_READ_NOT_PERMITTED,
23 ERROR_REQUEST_NOT_SUPPORTED,
24 ERROR_UNKNOWN,
25 ERROR_UNSUPPORTED_DEVICE,
26 ERROR_WRITE_NOT_PERMITTED,
27 NUM_CONNECT_ERROR_CODES
28 };
29
30 Code code;
31 };
32
9 struct AdapterInfo { 33 struct AdapterInfo {
10 string address; 34 string address;
11 string name; 35 string name;
12 bool initialized; 36 bool initialized;
13 bool present; 37 bool present;
14 bool powered; 38 bool powered;
15 bool discoverable; 39 bool discoverable;
16 bool discovering; 40 bool discovering;
17 }; 41 };
18 42
19 interface Adapter { 43 interface Adapter {
20 // Gets basic information about the adapter. 44 // Gets basic information about the adapter.
21 GetInfo() => (AdapterInfo info); 45 GetInfo() => (AdapterInfo info);
22 46
23 // Gets the Device service for the device at the given address. 47 // Creates a GATT connection to the device with |address| and returns a
ortuno 2016/10/25 10:42:09 Please mention when ConnectError is null and when
mbrunson 2016/10/25 20:03:04 Done.
24 GetDevice(string address) => (Device? device); 48 // Device if the connection was succesful. The GATT connection is tied to the
49 // the lifetime of the Device message pipe.
50 ConnectToDevice(string address) => (ConnectError? error, Device? device);
25 51
26 // Retrieves the list of the devices known by the adapter including Connected 52 // Retrieves the list of the devices known by the adapter including Connected
27 // Devices, GATT Connected Devices, Paired Devices and Devices discovered 53 // Devices, GATT Connected Devices, Paired Devices and Devices discovered
28 // during a classic or low-energy scan. 54 // during a classic or low-energy scan.
29 GetDevices() => (array<DeviceInfo> devices); 55 GetDevices() => (array<DeviceInfo> devices);
30 56
31 // Sets the client that listens for the adapter's events. 57 // Sets the client that listens for the adapter's events.
32 SetClient(AdapterClient client); 58 SetClient(AdapterClient client);
33 }; 59 };
34 60
(...skipping 11 matching lines...) Expand all
46 // Generally called for each advertisement packet recevied, but this is not 72 // Generally called for each advertisement packet recevied, but this is not
47 // guaranteed on ChromeOS or Linux. Because the RSSI is always changing, 73 // guaranteed on ChromeOS or Linux. Because the RSSI is always changing,
48 // it's very likely this will be called for each advertising packet. 74 // it's very likely this will be called for each advertising packet.
49 DeviceChanged(DeviceInfo device); 75 DeviceChanged(DeviceInfo device);
50 }; 76 };
51 77
52 interface AdapterFactory { 78 interface AdapterFactory {
53 // Gets an Adapter interface. Returns null if Bluetooth is not supported. 79 // Gets an Adapter interface. Returns null if Bluetooth is not supported.
54 GetAdapter() => (Adapter? adapter); 80 GetAdapter() => (Adapter? adapter);
55 }; 81 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698