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

Side by Side Diff: tools/dom/src/chrome/usb.dart

Issue 12316032: Added more Chrome.* libraries to dart:chrome (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added isMaximised override file Created 7 years, 10 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
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Generated from namespace: usb
6
7 part of chrome;
8
9 /**
10 * Types
11 */
12
13 class UsbDevice extends ChromeObject {
14 /*
15 * Public constructor
16 */
17 UsbDevice({int handle, int vendorId, int productId}) {
18 if (?handle)
19 this.handle = handle;
20 if (?vendorId)
21 this.vendorId = vendorId;
22 if (?productId)
23 this.productId = productId;
24 }
25
26 /*
27 * Private constructor
28 */
29 UsbDevice._proxy(_jsObject) : super._proxy(_jsObject);
30
31 /*
32 * Public accessors
33 */
34 int get handle => JS('int', '#.handle', this._jsObject);
35
36 void set handle(int handle) {
37 JS('void', '#.handle = #', this._jsObject, handle);
38 }
39
40 int get vendorId => JS('int', '#.vendorId', this._jsObject);
41
42 void set vendorId(int vendorId) {
43 JS('void', '#.vendorId = #', this._jsObject, vendorId);
44 }
45
46 int get productId => JS('int', '#.productId', this._jsObject);
47
48 void set productId(int productId) {
49 JS('void', '#.productId = #', this._jsObject, productId);
50 }
51
52 }
53
54 class UsbControlTransferInfo extends ChromeObject {
55 /*
56 * Public constructor
57 */
58 UsbControlTransferInfo({String direction, String recipient, String requestType , int request, int value, int index, int length, String data}) {
59 if (?direction)
60 this.direction = direction;
61 if (?recipient)
62 this.recipient = recipient;
63 if (?requestType)
64 this.requestType = requestType;
65 if (?request)
66 this.request = request;
67 if (?value)
68 this.value = value;
69 if (?index)
70 this.index = index;
71 if (?length)
72 this.length = length;
73 if (?data)
74 this.data = data;
75 }
76
77 /*
78 * Private constructor
79 */
80 UsbControlTransferInfo._proxy(_jsObject) : super._proxy(_jsObject);
81
82 /*
83 * Public accessors
84 */
85 /// The direction of this transfer.
86 String get direction => JS('String', '#.direction', this._jsObject);
87
88 void set direction(String direction) {
89 JS('void', '#.direction = #', this._jsObject, direction);
90 }
91
92 /// The intended recipient for this transfer.
93 String get recipient => JS('String', '#.recipient', this._jsObject);
94
95 void set recipient(String recipient) {
96 JS('void', '#.recipient = #', this._jsObject, recipient);
97 }
98
99 /// The type of this request.
100 String get requestType => JS('String', '#.requestType', this._jsObject);
101
102 void set requestType(String requestType) {
103 JS('void', '#.requestType = #', this._jsObject, requestType);
104 }
105
106 int get request => JS('int', '#.request', this._jsObject);
107
108 void set request(int request) {
109 JS('void', '#.request = #', this._jsObject, request);
110 }
111
112 int get value => JS('int', '#.value', this._jsObject);
113
114 void set value(int value) {
115 JS('void', '#.value = #', this._jsObject, value);
116 }
117
118 int get index => JS('int', '#.index', this._jsObject);
119
120 void set index(int index) {
121 JS('void', '#.index = #', this._jsObject, index);
122 }
123
124 /// If this transfer is an input transfer, then this field must be set to
125 /// indicate the expected data length. If this is an output transfer, then thi s
126 /// field is ignored.
127 int get length => JS('int', '#.length', this._jsObject);
128
129 void set length(int length) {
130 JS('void', '#.length = #', this._jsObject, length);
131 }
132
133 /// The data payload carried by this transfer. If this is an output tranfer
134 /// then this field must be set.
135 String get data => JS('String', '#.data', this._jsObject);
136
137 void set data(String data) {
138 JS('void', '#.data = #', this._jsObject, data);
139 }
140
141 }
142
143 class UsbGenericTransferInfo extends ChromeObject {
144 /*
145 * Public constructor
146 */
147 UsbGenericTransferInfo({String direction, int endpoint, int length, String dat a}) {
148 if (?direction)
149 this.direction = direction;
150 if (?endpoint)
151 this.endpoint = endpoint;
152 if (?length)
153 this.length = length;
154 if (?data)
155 this.data = data;
156 }
157
158 /*
159 * Private constructor
160 */
161 UsbGenericTransferInfo._proxy(_jsObject) : super._proxy(_jsObject);
162
163 /*
164 * Public accessors
165 */
166 /// The direction of this transfer.
167 String get direction => JS('String', '#.direction', this._jsObject);
168
169 void set direction(String direction) {
170 JS('void', '#.direction = #', this._jsObject, direction);
171 }
172
173 int get endpoint => JS('int', '#.endpoint', this._jsObject);
174
175 void set endpoint(int endpoint) {
176 JS('void', '#.endpoint = #', this._jsObject, endpoint);
177 }
178
179 /// If this is an input transfer then this field indicates the size of the
180 /// input buffer. If this is an output transfer then this field is ignored.
181 int get length => JS('int', '#.length', this._jsObject);
182
183 void set length(int length) {
184 JS('void', '#.length = #', this._jsObject, length);
185 }
186
187 /// If this is an output transfer then this field must be populated. Otherwise ,
188 /// it will be ignored.
189 String get data => JS('String', '#.data', this._jsObject);
190
191 void set data(String data) {
192 JS('void', '#.data = #', this._jsObject, data);
193 }
194
195 }
196
197 class UsbIsochronousTransferInfo extends ChromeObject {
198 /*
199 * Public constructor
200 */
201 UsbIsochronousTransferInfo({UsbGenericTransferInfo transferInfo, int packets, int packetLength}) {
202 if (?transferInfo)
203 this.transferInfo = transferInfo;
204 if (?packets)
205 this.packets = packets;
206 if (?packetLength)
207 this.packetLength = packetLength;
208 }
209
210 /*
211 * Private constructor
212 */
213 UsbIsochronousTransferInfo._proxy(_jsObject) : super._proxy(_jsObject);
214
215 /*
216 * Public accessors
217 */
218 /// All of the normal transfer parameters are encapsulated in the transferInfo
219 /// parameters. Note that the data specified in this parameter block is split
220 /// along packetLength boundaries to form the individual packets of the
221 /// transfer.
222 UsbGenericTransferInfo get transferInfo => new UsbGenericTransferInfo._proxy(J S('', '#.transferInfo', this._jsObject));
223
224 void set transferInfo(UsbGenericTransferInfo transferInfo) {
225 JS('void', '#.transferInfo = #', this._jsObject, convertArgument(transferInf o));
226 }
227
228 /// The total number of packets in this transfer.
229 int get packets => JS('int', '#.packets', this._jsObject);
230
231 void set packets(int packets) {
232 JS('void', '#.packets = #', this._jsObject, packets);
233 }
234
235 /// The length of each of the packets in this transfer.
236 int get packetLength => JS('int', '#.packetLength', this._jsObject);
237
238 void set packetLength(int packetLength) {
239 JS('void', '#.packetLength = #', this._jsObject, packetLength);
240 }
241
242 }
243
244 class UsbTransferResultInfo extends ChromeObject {
245 /*
246 * Public constructor
247 */
248 UsbTransferResultInfo({int resultCode, String data}) {
249 if (?resultCode)
250 this.resultCode = resultCode;
251 if (?data)
252 this.data = data;
253 }
254
255 /*
256 * Private constructor
257 */
258 UsbTransferResultInfo._proxy(_jsObject) : super._proxy(_jsObject);
259
260 /*
261 * Public accessors
262 */
263 /// A value of 0 indicates that the transfer was a success. Other values
264 /// indicate failure.
265 int get resultCode => JS('int', '#.resultCode', this._jsObject);
266
267 void set resultCode(int resultCode) {
268 JS('void', '#.resultCode = #', this._jsObject, resultCode);
269 }
270
271 /// If the transfer was an input transfer then this field will contain all of
272 /// the input data requested.
273 String get data => JS('String', '#.data', this._jsObject);
274
275 void set data(String data) {
276 JS('void', '#.data = #', this._jsObject, data);
277 }
278
279 }
280
281 class UsbFindDevicesOptions extends ChromeObject {
282 /*
283 * Public constructor
284 */
285 UsbFindDevicesOptions({int vendorId, int productId}) {
286 if (?vendorId)
287 this.vendorId = vendorId;
288 if (?productId)
289 this.productId = productId;
290 }
291
292 /*
293 * Private constructor
294 */
295 UsbFindDevicesOptions._proxy(_jsObject) : super._proxy(_jsObject);
296
297 /*
298 * Public accessors
299 */
300 int get vendorId => JS('int', '#.vendorId', this._jsObject);
301
302 void set vendorId(int vendorId) {
303 JS('void', '#.vendorId = #', this._jsObject, vendorId);
304 }
305
306 int get productId => JS('int', '#.productId', this._jsObject);
307
308 void set productId(int productId) {
309 JS('void', '#.productId = #', this._jsObject, productId);
310 }
311
312 }
313
314 /**
315 * Functions
316 */
317
318 class API_usb {
319 /*
320 * API connection
321 */
322 Object _jsObject;
323
324 /*
325 * Functions
326 */
327 /// Finds the first instance of the USB device specified by the vendorId/
328 /// productId pair and, if permissions allow, opens it for use. Upon
329 /// successfully opening a device the callback is invoked with a populated
330 /// Device object. On failure, the callback is invoked with null.
331 void findDevices(UsbFindDevicesOptions options, void callback(List<UsbDevice> device)) {
332 void __proxy_callback(device) {
333 if (?callback) {
334 List<UsbDevice> __proxy_device = new List<UsbDevice>();
335 for (var o in device) {
336 __proxy_device.add(new UsbDevice._proxy(o));
337 }
338 callback(__proxy_device);
339 }
340 }
341 JS('void', '#.findDevices(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
342 }
343
344 /// Closes an open device instance. Invoking operations on a device after it
345 /// has been closed is a safe operation, but causes no action to be taken.
346 void closeDevice(UsbDevice device, [void callback()]) => JS('void', '#.closeDe vice(#, #)', this._jsObject, convertArgument(device), convertDartClosureToJS(cal lback, 0));
347
348 /// Claims an interface on the specified USB device.
349 void claimInterface(UsbDevice device, int interfaceNumber, void callback()) => JS('void', '#.claimInterface(#, #, #)', this._jsObject, convertArgument(device) , interfaceNumber, convertDartClosureToJS(callback, 0));
350
351 /// Releases a claim to an interface on the provided device.
352 void releaseInterface(UsbDevice device, int interfaceNumber, void callback()) => JS('void', '#.releaseInterface(#, #, #)', this._jsObject, convertArgument(dev ice), interfaceNumber, convertDartClosureToJS(callback, 0));
353
354 /// Selects an alternate setting on a previously claimed interface on a device .
355 void setInterfaceAlternateSetting(UsbDevice device, int interfaceNumber, int a lternateSetting, void callback()) => JS('void', '#.setInterfaceAlternateSetting( #, #, #, #)', this._jsObject, convertArgument(device), interfaceNumber, alternat eSetting, convertDartClosureToJS(callback, 0));
356
357 /// Performs a control transfer on the specified device. See the
358 /// ControlTransferInfo structure for the parameters required to make a
359 /// transfer.
360 void controlTransfer(UsbDevice device, UsbControlTransferInfo transferInfo, vo id callback(UsbTransferResultInfo info)) {
361 void __proxy_callback(info) {
362 if (?callback) {
363 callback(new UsbTransferResultInfo._proxy(info));
364 }
365 }
366 JS('void', '#.controlTransfer(#, #, #)', this._jsObject, convertArgument(dev ice), convertArgument(transferInfo), convertDartClosureToJS(__proxy_callback, 1) );
367 }
368
369 /// Performs a bulk transfer on the specified device.
370 void bulkTransfer(UsbDevice device, UsbGenericTransferInfo transferInfo, void callback(UsbTransferResultInfo info)) {
371 void __proxy_callback(info) {
372 if (?callback) {
373 callback(new UsbTransferResultInfo._proxy(info));
374 }
375 }
376 JS('void', '#.bulkTransfer(#, #, #)', this._jsObject, convertArgument(device ), convertArgument(transferInfo), convertDartClosureToJS(__proxy_callback, 1));
377 }
378
379 /// Performs an interrupt transfer on the specified device.
380 void interruptTransfer(UsbDevice device, UsbGenericTransferInfo transferInfo, void callback(UsbTransferResultInfo info)) {
381 void __proxy_callback(info) {
382 if (?callback) {
383 callback(new UsbTransferResultInfo._proxy(info));
384 }
385 }
386 JS('void', '#.interruptTransfer(#, #, #)', this._jsObject, convertArgument(d evice), convertArgument(transferInfo), convertDartClosureToJS(__proxy_callback, 1));
387 }
388
389 /// Performs an isochronous transfer on the specific device.
390 void isochronousTransfer(UsbDevice device, UsbIsochronousTransferInfo transfer Info, void callback(UsbTransferResultInfo info)) {
391 void __proxy_callback(info) {
392 if (?callback) {
393 callback(new UsbTransferResultInfo._proxy(info));
394 }
395 }
396 JS('void', '#.isochronousTransfer(#, #, #)', this._jsObject, convertArgument (device), convertArgument(transferInfo), convertDartClosureToJS(__proxy_callback , 1));
397 }
398
399 API_usb(this._jsObject) {
400 }
401 }
OLDNEW
« no previous file with comments | « tools/dom/src/chrome/system_info_display.dart ('k') | tools/dom/templates/html/dart2js/chrome_dart2js.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698