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

Side by Side Diff: extensions/common/api/bluetooth_private.idl

Issue 1419023004: Add bluetoothPrivate.connect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_543294_bluetooth_options_2b_props
Patch Set: Rebase Created 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Use the <code>chrome.bluetoothPrivate</code> API to control the Bluetooth 5 // Use the <code>chrome.bluetoothPrivate</code> API to control the Bluetooth
6 // adapter state and handle device pairing. 6 // adapter state and handle device pairing.
7 // NOTE: This IDL is dependent on bluetooth.idl. 7 // NOTE: This IDL is dependent on bluetooth.idl.
8 8
9 [implemented_in = "extensions/browser/api/bluetooth/bluetooth_private_api.h"] 9 [implemented_in = "extensions/browser/api/bluetooth/bluetooth_private_api.h"]
10 10
(...skipping 25 matching lines...) Expand all
36 confirmPasskey, 36 confirmPasskey,
37 37
38 // Requests authorization for a pairing under the just-works model. It is up 38 // Requests authorization for a pairing under the just-works model. It is up
39 // to the app to ask for user confirmation. 39 // to the app to ask for user confirmation.
40 requestAuthorization, 40 requestAuthorization,
41 41
42 // Pairing is completed. 42 // Pairing is completed.
43 complete 43 complete
44 }; 44 };
45 45
46 // Results for connect(). See function declaration for details.
47 enum ConnectResultType {
48 success,
49 unknownError,
50 inProgress,
51 alreadyConnected,
52 failed,
53 authFailed,
54 authCanceled,
55 authRejected,
56 authTimeout,
57 unsupportedDevice
58 };
59
46 // Valid pairing responses. 60 // Valid pairing responses.
47 enum PairingResponse { 61 enum PairingResponse {
48 confirm, reject, cancel 62 confirm, reject, cancel
49 }; 63 };
50 64
51 enum TransportType { 65 enum TransportType {
52 le, bredr, dual 66 le, bredr, dual
53 }; 67 };
54 68
55 // A pairing event received from a Bluetooth device. 69 // A pairing event received from a Bluetooth device.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // RSSI ranging value. Only devices with RSSI higher than this value will be 112 // RSSI ranging value. Only devices with RSSI higher than this value will be
99 // reported. 113 // reported.
100 long? rssi; 114 long? rssi;
101 115
102 // Pathloss ranging value. Only devices with pathloss lower than this value 116 // Pathloss ranging value. Only devices with pathloss lower than this value
103 // will be reported. 117 // will be reported.
104 long? pathloss; 118 long? pathloss;
105 }; 119 };
106 120
107 callback VoidCallback = void(); 121 callback VoidCallback = void();
122 callback ConnectCallback = void(ConnectResultType result);
108 123
109 // These functions all report failures via chrome.runtime.lastError. 124 // These functions all report failures via chrome.runtime.lastError.
110 interface Functions { 125 interface Functions {
111 // Changes the state of the Bluetooth adapter. 126 // Changes the state of the Bluetooth adapter.
112 // |adapterState|: 127 // |adapterState|:
113 static void setAdapterState(NewAdapterState adapterState, 128 static void setAdapterState(NewAdapterState adapterState,
114 optional VoidCallback callback); 129 optional VoidCallback callback);
115 130
116 static void setPairingResponse(SetPairingResponseOptions options, 131 static void setPairingResponse(SetPairingResponseOptions options,
117 optional VoidCallback callback); 132 optional VoidCallback callback);
118 133
119 // Tears down all connections to the given device. 134 // Tears down all connections to the given device.
120 static void disconnectAll(DOMString deviceAddress, 135 static void disconnectAll(DOMString deviceAddress,
121 optional VoidCallback callback); 136 optional VoidCallback callback);
122 137
123 // Set or clear discovery filter. 138 // Set or clear discovery filter.
124 static void setDiscoveryFilter(DiscoveryFilter discoveryFilter, 139 static void setDiscoveryFilter(DiscoveryFilter discoveryFilter,
125 optional VoidCallback callback); 140 optional VoidCallback callback);
126 141
142 // Connects to the given device. This will only throw an error if the
143 // device address is invalid or the device is already connected. Otherwise
144 // this will succeed and invoke |callback| with ConnectResultType.
145 static void connect(DOMString deviceAddress,
146 optional ConnectCallback callback);
147
127 // Pairs the given device. 148 // Pairs the given device.
128 static void pair(DOMString deviceAddress, optional VoidCallback callback); 149 static void pair(DOMString deviceAddress, optional VoidCallback callback);
129 }; 150 };
130 151
131 interface Events { 152 interface Events {
132 // Fired when a pairing event occurs. 153 // Fired when a pairing event occurs.
133 // |pairingEvent|: A pairing event. 154 // |pairingEvent|: A pairing event.
134 [maxListeners=1] static void onPairing(PairingEvent pairingEvent); 155 [maxListeners=1] static void onPairing(PairingEvent pairingEvent);
135 }; 156 };
136 }; 157 };
OLDNEW
« no previous file with comments | « extensions/browser/extension_function_histogram_value.h ('k') | third_party/closure_compiler/externs/bluetooth_private.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698