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

Side by Side Diff: Source/modules/webusb/USBDevice.h

Issue 1245363002: Add WebUSB bindings and client interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: iface ctors, OWNERS, rebase Created 5 years, 4 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
« no previous file with comments | « Source/modules/webusb/USBController.cpp ('k') | Source/modules/webusb/USBDevice.cpp » ('j') | 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 2015 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 #ifndef USBDevice_h
6 #define USBDevice_h
7
8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/modules/v8/UnionTypesModules.h"
11 #include "modules/webusb/USBConfiguration.h"
12 #include "platform/heap/Handle.h"
13 #include "public/platform/modules/webusb/WebUSBDevice.h"
14 #include "public/platform/modules/webusb/WebUSBDeviceInfo.h"
15
16 namespace blink {
17
18 class USBControlTransferParameters;
19
20 class USBDevice
21 : public GarbageCollectedFinalized<USBDevice>
22 , public ScriptWrappable {
23 DEFINE_WRAPPERTYPEINFO();
24 public:
25 typedef WebUSBDeviceInfo WebType;
26
27 static USBDevice* create(PassOwnPtr<WebUSBDevice>);
28
29 USBDevice(PassOwnPtr<WebUSBDevice>);
30 virtual ~USBDevice() { }
31
32 const WebUSBDeviceInfo& info() const { return m_device->info(); }
33
34 String guid() const { return info().guid; }
35 uint8_t usbVersionMajor() { return info().usbVersionMajor; }
36 uint8_t usbVersionMinor() { return info().usbVersionMinor; }
37 uint8_t usbVersionSubminor() { return info().usbVersionSubminor; }
38 uint8_t deviceClass() { return info().deviceClass; }
39 uint8_t deviceSubclass() const { return info().deviceSubclass; }
40 uint8_t deviceProtocol() const { return info().deviceProtocol; }
41 uint16_t vendorId() const { return info().vendorID; }
42 uint16_t productId() const { return info().productID; }
43 uint8_t deviceVersionMajor() const { return info().deviceVersionMajor; }
44 uint8_t deviceVersionMinor() const { return info().deviceVersionMinor; }
45 uint8_t deviceVersionSubminor() const { return info().deviceVersionSubminor; }
46 String manufacturerName() const { return info().manufacturerName; }
47 String productName() const { return info().productName; }
48 String serialNumber() const { return info().serialNumber; }
49 HeapVector<Member<USBConfiguration>> configurations() const;
50
51 ScriptPromise open(ScriptState*);
52 ScriptPromise close(ScriptState*);
53 ScriptPromise setConfiguration(ScriptState*, uint8_t configurationValue);
54 ScriptPromise claimInterface(ScriptState*, uint8_t interfaceNumber);
55 ScriptPromise releaseInterface(ScriptState*, uint8_t interfaceNumber);
56 ScriptPromise setInterface(ScriptState*, uint8_t interfaceNumber, uint8_t al ternateSetting);
57 ScriptPromise controlTransferIn(ScriptState*, const USBControlTransferParame ters&, uint16_t length);
58 ScriptPromise controlTransferOut(ScriptState*, const USBControlTransferParam eters&);
59 ScriptPromise controlTransferOut(ScriptState*, const USBControlTransferParam eters&, const ArrayBufferOrArrayBufferView& data);
60 ScriptPromise clearHalt(ScriptState*, uint8_t endpointNumber);
61 ScriptPromise transferIn(ScriptState*, uint8_t endpointNumber, unsigned leng th);
62 ScriptPromise transferOut(ScriptState*, uint8_t endpointNumber, const ArrayB ufferOrArrayBufferView& data);
63 ScriptPromise reset(ScriptState*);
64
65 DEFINE_INLINE_TRACE() { }
66
67 private:
68 OwnPtr<WebUSBDevice> m_device;
69 };
70
71 } // namespace blink
72
73 #endif // USBDevice_h
OLDNEW
« no previous file with comments | « Source/modules/webusb/USBController.cpp ('k') | Source/modules/webusb/USBDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698