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

Unified Diff: chrome/common/extensions/api/experimental.bluetooth.idl

Issue 9822001: Basic infrastructure for the Bluetooth API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix non-chromeos builds Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/experimental.bluetooth.idl
diff --git a/chrome/common/extensions/api/experimental.bluetooth.idl b/chrome/common/extensions/api/experimental.bluetooth.idl
new file mode 100644
index 0000000000000000000000000000000000000000..31dd5a43aeb76b4002e470efc91c12953de071f7
--- /dev/null
+++ b/chrome/common/extensions/api/experimental.bluetooth.idl
@@ -0,0 +1,107 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Bluetooth API.
+
+[nodoc] namespace experimental.bluetooth {
Mihai Parparita -not on Chrome 2012/03/21 21:48:52 Antony: Is there an IDL equivalent to the "platfor
bryeung 2012/03/22 00:37:04 I believe I've set this up to NIY for now. Are yo
+ dictionary Device {
+ DOMString address;
+ DOMString name;
+ };
+
+ dictionary Socket {
+ long id;
+ };
+
+ // TODO(bryeung): This is a temporary hack until Blobs are supported
+ dictionary Blob {
+ DOMString data;
+ };
+
+ dictionary OutOfBandPairingData {
+ // Simple Pairing Hash C
+ // Always 16 octets long.
+ // TODO(bryeung): this should really be an octet[]
+ DOMString hash;
+
+ // Simple Pairing Randomizer R
+ // Always 16 octets long.
+ // TODO(bryeung): this should really be an octet[]
+ DOMString randomizer;
+ };
+
+ callback ResultCallback = void (boolean success);
+ callback BooleanCallback = void (boolean result);
asargent_no_longer_on_chrome 2012/03/21 21:19:58 On an email thread I think Mihai had made the sugg
bryeung 2012/03/21 21:34:14 Oops! Thanks for the reminder: I had meant to do
+ callback AddressCallback = void (DOMString result);
+ callback DevicesCallback = void (Device[] result);
+ callback SocketCallback = void (Socket result);
+ callback DataCallback = void (Blob result);
+ callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data);
+
+ interface Functions {
+ // Checks if the system has bluetooth support.
+ // |callback| : Called with the boolean result.
+ static void isAvailable(BooleanCallback callback);
+
+ // Checks if the system's bluetooth module has power.
+ // |callback| : Called with the boolean result.
+ static void isPowered(BooleanCallback callback);
+
+ // Get the bluetooth address of the system's bluetooth module.
+ // |callback| : Called with the address, or null if there was an error.
+ static void getAddress(AddressCallback callback);
+
+ // Get a list of bluetooth devices that support a service.
+ // |service| : The UUID of the desired service.
+ // |callback| : Called with an array of Device objects, all of which
+ // provide |service|.
+ static void getDevicesWithService(
+ DOMString service, DevicesCallback callback);
+
+ // Connect to a service on a device.
+ // |device| : The target device.
+ // |service| : The target service UUID.
+ // |callback| : Called when the connection is established with a Socket
+ // that can be used to communicate with |device|.
+ static void connect(
+ Device device, DOMString service, SocketCallback callback);
+
+ // Close a bluetooth connection.
+ // |socket| : The socket to disconnect.
+ // |callback| : Called to indicate success or failure.
+ static void disconnect(Socket socket, ResultCallback callback);
asargent_no_longer_on_chrome 2012/03/21 21:19:58 Would it make sense for the callback to be optiona
bryeung 2012/03/21 21:34:14 I changed all ResultCallback callbacks to be optio
+
+ // Read data from a bluetooth connection.
+ // |socket| : The socket to read from.
+ // |callback| : Called with the data when it is available.
+ static void read(Socket socket, DataCallback callback);
+
+ // Write data to a bluetooth connection.
+ // |socket| : The socket to write to.
+ // |data| : The data to write.
+ // |callback| : Called to indicate success or failure.
+ static void write(Socket socket, Blob data, ResultCallback callback);
+
+ // Get the local Out of Band Pairing data.
+ // |callback| : Called with the data.
+ static void getOutOfBandPairingData(OutOfBandPairingDataCallback callback);
+
+ // Set the Out of Band Pairing data for the bluetooth device at |address|.
+ // |address| : The bluetooth address of the device sending the data.
+ // |data| : The data.
+ // |callback| : Called to indicate success or failure.
+ static void setOutOfBandPairingData(
+ DOMString address, OutOfBandPairingData data, ResultCallback callback);
asargent_no_longer_on_chrome 2012/03/21 21:19:58 same question here - can callback be optional?
bryeung 2012/03/21 21:34:14 Done.
+ };
+
+ interface Events {
+ // Fired when the availability of bluetooth on the system changes.
+ // |available| : True if bluetooth is available, false otherwise.
+ static void onAvailabilityChanged(boolean available);
+
+ // Fired when the power state of bluetooth on the system changes.
+ // |powered| : True if bluetooth is powered, false otherwise.
+ static void onPowerChanged(boolean has_power);
+ };
+};

Powered by Google App Engine
This is Rietveld 408576698