Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Bluetooth API. | 5 // Bluetooth API. |
| 6 // TODO(bryeung): mark this API as ChromeOS only (see crbug.com/119398). | 6 // TODO(bryeung): mark this API as ChromeOS only (see crbug.com/119398). |
| 7 | 7 |
| 8 [nodoc] namespace experimental.bluetooth { | 8 [nodoc] namespace experimental.bluetooth { |
| 9 dictionary Device { | 9 dictionary Device { |
| 10 // The address of the device, in the format "XX:XX:XX:XX:XX:XX". | 10 // The address of the device, in the format "XX:XX:XX:XX:XX:XX". |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 ArrayBuffer hash; | 37 ArrayBuffer hash; |
| 38 | 38 |
| 39 // Simple Pairing Randomizer R. | 39 // Simple Pairing Randomizer R. |
| 40 // Always 16 octets long. | 40 // Always 16 octets long. |
| 41 ArrayBuffer randomizer; | 41 ArrayBuffer randomizer; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 callback AddressCallback = void (DOMString result); | 44 callback AddressCallback = void (DOMString result); |
| 45 callback BooleanCallback = void (boolean result); | 45 callback BooleanCallback = void (boolean result); |
| 46 callback DataCallback = void (ArrayBuffer result); | 46 callback DataCallback = void (ArrayBuffer result); |
| 47 callback DeviceCallback = void (Device device); | |
| 47 callback DevicesCallback = void (Device[] result); | 48 callback DevicesCallback = void (Device[] result); |
| 48 callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data); | 49 callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data); |
| 49 callback ResultCallback = void (); | 50 callback ResultCallback = void (); |
| 50 callback SizeCallback = void (long result); | 51 callback SizeCallback = void (long result); |
| 51 callback SocketCallback = void (Socket result); | 52 callback SocketCallback = void (Socket result); |
| 52 | 53 |
| 53 // Options for the getDevices function. If neither |uuid| or |name| are | 54 // Options for the getDevices function. If neither |uuid| or |name| are |
| 54 // provided, all devices known to the system are returned. | 55 // provided, all devices known to the system are returned. |
| 55 dictionary GetDevicesOptions { | 56 dictionary GetDevicesOptions { |
| 56 // Only devices providing a service with a UUID that matches |uuid| will be | 57 // Only devices providing a service with a UUID that matches |uuid| will be |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 dictionary SetOutOfBandPairingDataOptions { | 98 dictionary SetOutOfBandPairingDataOptions { |
| 98 // The address of the remote device that the data should be associated | 99 // The address of the remote device that the data should be associated |
| 99 // with. |device_address| should be in the format "XX:XX:XX:XX:XX:XX". | 100 // with. |device_address| should be in the format "XX:XX:XX:XX:XX:XX". |
| 100 DOMString address; | 101 DOMString address; |
| 101 | 102 |
| 102 // The Out Of Band Pairing Data. If this omitted, the data for the device | 103 // The Out Of Band Pairing Data. If this omitted, the data for the device |
| 103 // is cleared instead. | 104 // is cleared instead. |
| 104 OutOfBandPairingData? data; | 105 OutOfBandPairingData? data; |
| 105 }; | 106 }; |
| 106 | 107 |
| 108 // Options for the startDiscovery function. | |
| 109 dictionary StartDiscoveryOptions { | |
| 110 // Called for each device that is discovered. | |
| 111 DeviceCallback device_callback; | |
| 112 }; | |
| 113 | |
| 107 // These functions all report failures via chrome.extension.lastError. | 114 // These functions all report failures via chrome.extension.lastError. |
| 108 interface Functions { | 115 interface Functions { |
| 109 // Checks if the system has bluetooth support. | 116 // Checks if the system has bluetooth support. |
| 110 // |callback| : Called with the boolean result. | 117 // |callback| : Called with the boolean result. |
| 111 static void isAvailable(BooleanCallback callback); | 118 static void isAvailable(BooleanCallback callback); |
| 112 | 119 |
| 113 // Checks if the system's bluetooth module has power. | 120 // Checks if the system's bluetooth module has power. |
| 114 // |callback| : Called with the boolean result. | 121 // |callback| : Called with the boolean result. |
| 115 static void isPowered(BooleanCallback callback); | 122 static void isPowered(BooleanCallback callback); |
| 116 | 123 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 // |callback| : Called with the data. | 160 // |callback| : Called with the data. |
| 154 static void getLocalOutOfBandPairingData( | 161 static void getLocalOutOfBandPairingData( |
| 155 OutOfBandPairingDataCallback callback); | 162 OutOfBandPairingDataCallback callback); |
| 156 | 163 |
| 157 // Set the Out of Band Pairing data for a remote device. | 164 // Set the Out of Band Pairing data for a remote device. |
| 158 // Any previous Out Of Band Pairing Data for this device is overwritten. | 165 // Any previous Out Of Band Pairing Data for this device is overwritten. |
| 159 // |options| : The options for this function. | 166 // |options| : The options for this function. |
| 160 // |callback| : Called to indicate success or failure. | 167 // |callback| : Called to indicate success or failure. |
| 161 static void setOutOfBandPairingData(SetOutOfBandPairingDataOptions options, | 168 static void setOutOfBandPairingData(SetOutOfBandPairingDataOptions options, |
| 162 optional ResultCallback callback); | 169 optional ResultCallback callback); |
| 170 | |
| 171 // Start discovery. Discovered devices will be returned via the | |
| 172 // |onDeviceDiscovered| callback. Note that discovery can be resource | |
| 173 // intensive. stopDiscovery should be called as soon as is convenient. | |
| 174 // |options| : The options for this function. | |
| 175 // |callback| : Called to indicate success or failure. | |
| 176 static void startDiscovery( | |
| 177 StartDiscoveryOptions options, | |
| 178 optional ResultCallback callback); | |
| 179 | |
| 180 // Stop discovery. | |
| 181 // |callback| : Called to indicate success or failure. | |
| 182 static void stopDiscovery( | |
| 183 optional ResultCallback callback); | |
| 163 }; | 184 }; |
| 164 | 185 |
| 165 interface Events { | 186 interface Events { |
| 166 // Fired when the availability of bluetooth on the system changes. | 187 // Fired when the availability of bluetooth on the system changes. |
| 167 // |available| : True if bluetooth is available, false otherwise. | 188 // |available| : True if bluetooth is available, false otherwise. |
| 168 static void onAvailabilityChanged(boolean available); | 189 static void onAvailabilityChanged(boolean available); |
| 169 | 190 |
| 170 // Fired when the power state of bluetooth on the system changes. | 191 // Fired when the power state of bluetooth on the system changes. |
| 171 // |powered| : True if bluetooth is powered, false otherwise. | 192 // |powered| : True if bluetooth is powered, false otherwise. |
| 172 static void onPowerChanged(boolean has_power); | 193 static void onPowerChanged(boolean has_power); |
| 194 | |
| 195 // Used to return discovered devices to the extension. Users should not | |
| 196 // add listeners to this event directly. | |
| 197 static void onDeviceDiscovered_(Device device); | |
|
asargent_no_longer_on_chrome
2012/06/15 19:59:08
I think that since this doesn't need to be visible
| |
| 173 }; | 198 }; |
| 174 }; | 199 }; |
| OLD | NEW |