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

Unified Diff: chrome/common/extensions/api/experimental_bluetooth.idl

Issue 10536159: Bluetooth Extension API: Add a discovery API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 6 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
index 3e77143b352920532edf9ef6abc2ca1b69485373..9fa0ec932870f9b0e4497b4038851382fea47e7c 100644
--- a/chrome/common/extensions/api/experimental_bluetooth.idl
+++ b/chrome/common/extensions/api/experimental_bluetooth.idl
@@ -44,6 +44,7 @@
callback AddressCallback = void (DOMString result);
callback BooleanCallback = void (boolean result);
callback DataCallback = void (ArrayBuffer result);
+ callback DeviceCallback = void (Device device);
callback DevicesCallback = void (Device[] result);
callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data);
callback ResultCallback = void ();
@@ -104,6 +105,12 @@
OutOfBandPairingData? data;
};
+ // Options for the startDiscovery function.
+ dictionary StartDiscoveryOptions {
+ // Called for each device that is discovered.
+ DeviceCallback device_callback;
+ };
+
// These functions all report failures via chrome.extension.lastError.
interface Functions {
// Checks if the system has bluetooth support.
@@ -160,6 +167,20 @@
// |callback| : Called to indicate success or failure.
static void setOutOfBandPairingData(SetOutOfBandPairingDataOptions options,
optional ResultCallback callback);
+
+ // Start discovery. Discovered devices will be returned via the
+ // |onDeviceDiscovered| callback. Note that discovery can be resource
+ // intensive. stopDiscovery should be called as soon as is convenient.
+ // |options| : The options for this function.
+ // |callback| : Called to indicate success or failure.
+ static void startDiscovery(
+ StartDiscoveryOptions options,
+ optional ResultCallback callback);
+
+ // Stop discovery.
+ // |callback| : Called to indicate success or failure.
+ static void stopDiscovery(
+ optional ResultCallback callback);
};
interface Events {
@@ -170,5 +191,9 @@
// 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);
+
+ // Used to return discovered devices to the extension. Users should not
+ // add listeners to this event directly.
+ 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
};
};

Powered by Google App Engine
This is Rietveld 408576698