Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(). | |
| 47 enum ConnectResultType { | |
|
Devlin
2015/10/29 18:26:45
Results are only given if the function succeeds; o
stevenjb
2015/10/29 19:10:12
You're right, I need to change the implementation
| |
| 48 success, | |
| 49 unknownError, | |
| 50 inProgress, | |
| 51 failed, | |
| 52 authFailed, | |
| 53 authCanceled, | |
| 54 authRejected, | |
| 55 authTimeout, | |
| 56 unsupportedDevice | |
| 57 }; | |
| 58 | |
| 46 // Valid pairing responses. | 59 // Valid pairing responses. |
| 47 enum PairingResponse { | 60 enum PairingResponse { |
| 48 confirm, reject, cancel | 61 confirm, reject, cancel |
| 49 }; | 62 }; |
| 50 | 63 |
| 51 enum TransportType { | 64 enum TransportType { |
| 52 le, bredr, dual | 65 le, bredr, dual |
| 53 }; | 66 }; |
| 54 | 67 |
| 55 // A pairing event received from a Bluetooth device. | 68 // A pairing event received from a Bluetooth device. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 // RSSI ranging value. Only devices with RSSI higher than this value will be | 111 // RSSI ranging value. Only devices with RSSI higher than this value will be |
| 99 // reported. | 112 // reported. |
| 100 long? rssi; | 113 long? rssi; |
| 101 | 114 |
| 102 // Pathloss ranging value. Only devices with pathloss lower than this value | 115 // Pathloss ranging value. Only devices with pathloss lower than this value |
| 103 // will be reported. | 116 // will be reported. |
| 104 long? pathloss; | 117 long? pathloss; |
| 105 }; | 118 }; |
| 106 | 119 |
| 107 callback VoidCallback = void(); | 120 callback VoidCallback = void(); |
| 121 callback ConnectCallback = void(ConnectResultType result); | |
| 108 | 122 |
| 109 // These functions all report failures via chrome.runtime.lastError. | 123 // These functions all report failures via chrome.runtime.lastError. |
| 110 interface Functions { | 124 interface Functions { |
| 111 // Changes the state of the Bluetooth adapter. | 125 // Changes the state of the Bluetooth adapter. |
| 112 // |adapterState|: | 126 // |adapterState|: |
| 113 static void setAdapterState(NewAdapterState adapterState, | 127 static void setAdapterState(NewAdapterState adapterState, |
| 114 optional VoidCallback callback); | 128 optional VoidCallback callback); |
| 115 | 129 |
| 116 static void setPairingResponse(SetPairingResponseOptions options, | 130 static void setPairingResponse(SetPairingResponseOptions options, |
| 117 optional VoidCallback callback); | 131 optional VoidCallback callback); |
| 118 | 132 |
| 119 // Tears down all connections to the given device. | 133 // Tears down all connections to the given device. |
| 120 static void disconnectAll(DOMString deviceAddress, | 134 static void disconnectAll(DOMString deviceAddress, |
| 121 optional VoidCallback callback); | 135 optional VoidCallback callback); |
| 122 | 136 |
| 123 // Set or clear discovery filter. | 137 // Set or clear discovery filter. |
| 124 static void setDiscoveryFilter(DiscoveryFilter discoveryFilter, | 138 static void setDiscoveryFilter(DiscoveryFilter discoveryFilter, |
| 125 optional VoidCallback callback); | 139 optional VoidCallback callback); |
| 126 | 140 |
| 141 // Connects to the given device. | |
| 142 static void connect(DOMString deviceAddress, | |
| 143 optional ConnectCallback callback); | |
| 144 | |
| 127 // Pairs the given device. | 145 // Pairs the given device. |
| 128 static void pair(DOMString deviceAddress, optional VoidCallback callback); | 146 static void pair(DOMString deviceAddress, optional VoidCallback callback); |
| 129 }; | 147 }; |
| 130 | 148 |
| 131 interface Events { | 149 interface Events { |
| 132 // Fired when a pairing event occurs. | 150 // Fired when a pairing event occurs. |
| 133 // |pairingEvent|: A pairing event. | 151 // |pairingEvent|: A pairing event. |
| 134 [maxListeners=1] static void onPairing(PairingEvent pairingEvent); | 152 [maxListeners=1] static void onPairing(PairingEvent pairingEvent); |
| 135 }; | 153 }; |
| 136 }; | 154 }; |
| OLD | NEW |