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

Side by Side 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: more review comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Bluetooth API.
6 // TODO(bryeung): mark this API as ChromeOS only (see crbug.com/119398).
Mihai Parparita -not on Chrome 2012/03/22 15:33:11 This is fine.
7
8 [nodoc] namespace experimental.bluetooth {
9 dictionary Device {
10 DOMString address;
11 DOMString name;
12 };
13
14 dictionary Socket {
15 long id;
16 };
17
18 // TODO(bryeung): This is a temporary hack until Blobs are supported
19 dictionary Blob {
20 DOMString data;
21 };
22
23 dictionary OutOfBandPairingData {
24 // Simple Pairing Hash C
25 // Always 16 octets long.
26 // TODO(bryeung): this should really be an octet[]
27 DOMString hash;
28
29 // Simple Pairing Randomizer R
30 // Always 16 octets long.
31 // TODO(bryeung): this should really be an octet[]
32 DOMString randomizer;
33 };
34
35 // Reports failures via chrome.extension.lastError.
36 callback ResultCallback = void ();
37 callback BooleanCallback = void (boolean result);
38 callback AddressCallback = void (DOMString result);
39 callback DevicesCallback = void (Device[] result);
40 callback SocketCallback = void (Socket result);
41 callback DataCallback = void (Blob result);
42 callback OutOfBandPairingDataCallback = void (OutOfBandPairingData data);
43
44 interface Functions {
45 // Checks if the system has bluetooth support.
46 // |callback| : Called with the boolean result.
47 static void isAvailable(BooleanCallback callback);
48
49 // Checks if the system's bluetooth module has power.
50 // |callback| : Called with the boolean result.
51 static void isPowered(BooleanCallback callback);
52
53 // Get the bluetooth address of the system's bluetooth module.
54 // |callback| : Called with the address, or null if there was an error.
55 static void getAddress(AddressCallback callback);
56
57 // Get a list of bluetooth devices that support a service.
58 // |service| : The UUID of the desired service.
59 // |callback| : Called with an array of Device objects, all of which
60 // provide |service|.
61 static void getDevicesWithService(
62 DOMString service, DevicesCallback callback);
63
64 // Connect to a service on a device.
65 // |device| : The target device.
66 // |service| : The target service UUID.
67 // |callback| : Called when the connection is established with a Socket
68 // that can be used to communicate with |device|.
69 static void connect(
70 Device device, DOMString service, SocketCallback callback);
71
72 // Close a bluetooth connection.
73 // |socket| : The socket to disconnect.
74 // |callback| : Called to indicate success or failure.
75 static void disconnect(Socket socket, optional ResultCallback callback);
76
77 // Read data from a bluetooth connection.
78 // |socket| : The socket to read from.
79 // |callback| : Called with the data when it is available.
80 static void read(Socket socket, DataCallback callback);
81
82 // Write data to a bluetooth connection.
83 // |socket| : The socket to write to.
84 // |data| : The data to write.
85 // |callback| : Called to indicate success or failure.
86 static void write(
87 Socket socket, Blob data, optional ResultCallback callback);
88
89 // Get the local Out of Band Pairing data.
90 // |callback| : Called with the data.
91 static void getOutOfBandPairingData(OutOfBandPairingDataCallback callback);
92
93 // Set the Out of Band Pairing data for the bluetooth device at |address|.
94 // |address| : The bluetooth address of the device sending the data.
95 // |data| : The data.
96 // |callback| : Called to indicate success or failure.
97 static void setOutOfBandPairingData(
98 DOMString address,
99 OutOfBandPairingData data,
100 optional ResultCallback callback);
101 };
102
103 interface Events {
104 // Fired when the availability of bluetooth on the system changes.
105 // |available| : True if bluetooth is available, false otherwise.
106 static void onAvailabilityChanged(boolean available);
107
108 // Fired when the power state of bluetooth on the system changes.
109 // |powered| : True if bluetooth is powered, false otherwise.
110 static void onPowerChanged(boolean has_power);
111 };
112 };
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/api.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698