OpenCores
URL https://opencores.org/ocsvn/usb_fpga_2_13/usb_fpga_2_13/trunk

Subversion Repositories usb_fpga_2_13

[/] [usb_fpga_2_13/] [trunk/] [libusbJava-src/] [ch/] [ntb/] [usb/] [Usb_Interface_Descriptor.java] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ZTEX
/*
2
 * Java libusb wrapper
3
 * Copyright (c) 2005-2006 Andreas Schläpfer <spandi at users.sourceforge.net>
4
 *
5
 * http://libusbjava.sourceforge.net
6
 * This library is covered by the LGPL, read LGPL.txt for details.
7
 */
8
package ch.ntb.usb;
9
 
10
/**
11
 * Represents the descriptor of a USB interface.<br>
12
 * The interface descriptor could be seen as a header or grouping of the
13
 * endpoints into a functional group performing a single feature of the device.<br>
14
 * <br>
15
 * The length of the interface descriptor is
16
 * {@link ch.ntb.usb.Usb_Descriptor#USB_DT_INTERFACE_SIZE} and the type is
17
 * {@link ch.ntb.usb.Usb_Descriptor#USB_DT_INTERFACE}.
18
 *
19
 */
20
public class Usb_Interface_Descriptor extends Usb_Descriptor {
21
 
22
        /**
23
         * Maximum number of interfaces
24
         */
25
        public static final int USB_MAXINTERFACES = 32;
26
 
27
        private byte bInterfaceNumber;
28
 
29
        private byte bAlternateSetting;
30
 
31
        private byte bNumEndpoints;
32
 
33
        private byte bInterfaceClass;
34
 
35
        private byte bInterfaceSubClass;
36
 
37
        private byte bInterfaceProtocol;
38
 
39
        private byte iInterface;
40
 
41
        private Usb_Endpoint_Descriptor[] endpoint;
42
 
43
        private byte[] extra; /* Extra descriptors */
44
 
45
        private int extralen;
46
 
47
        @Override
48
        public String toString() {
49
                return "Usb_Interface_Descriptor bNumEndpoints: 0x"
50
                                + Integer.toHexString(bNumEndpoints);
51
        }
52
 
53
        /**
54
         * Returns the value used to select the alternate setting ({@link LibusbJava#usb_set_altinterface(long, int)}).<br>
55
         *
56
         * @return the alternate setting
57
         */
58
        public byte getBAlternateSetting() {
59
                return bAlternateSetting;
60
        }
61
 
62
        /**
63
         * Returns the class code (Assigned by <a
64
         * href="http://www.usb.org">www.usb.org</a>).<br>
65
         *
66
         * @return the class code
67
         */
68
        public byte getBInterfaceClass() {
69
                return bInterfaceClass;
70
        }
71
 
72
        /**
73
         * Returns the number (identifier) of this interface.<br>
74
         *
75
         * @return the number (identifier) of this interface
76
         */
77
        public byte getBInterfaceNumber() {
78
                return bInterfaceNumber;
79
        }
80
 
81
        /**
82
         * Returns the protocol code (Assigned by <a
83
         * href="http://www.usb.org">www.usb.org</a>).<br>
84
         *
85
         * @return the protocol code
86
         */
87
        public byte getBInterfaceProtocol() {
88
                return bInterfaceProtocol;
89
        }
90
 
91
        /**
92
         * Returns the subclass code (Assigned by <a
93
         * href="http://www.usb.org">www.usb.org</a>).<br>
94
         *
95
         * @return the subclass code
96
         */
97
        public byte getBInterfaceSubClass() {
98
                return bInterfaceSubClass;
99
        }
100
 
101
        /**
102
         * Returns the number of endpoints used for this interface.<br>
103
         *
104
         * @return the number of endpoints used for this interface
105
         */
106
        public byte getBNumEndpoints() {
107
                return bNumEndpoints;
108
        }
109
 
110
        /**
111
         * Returns an array of endpoint descriptors.<br>
112
         *
113
         * @return an array of endpoint descriptors
114
         */
115
        public Usb_Endpoint_Descriptor[] getEndpoint() {
116
                return endpoint;
117
        }
118
 
119
        /**
120
         * Returns the data of extra descriptor(s) if available.<br>
121
         *
122
         * @return null or a byte array with the extra descriptor data
123
         */
124
        public byte[] getExtra() {
125
                return extra;
126
        }
127
 
128
        /**
129
         * Returns the number of bytes of the extra descriptor.<br>
130
         *
131
         * @return the number of bytes of the extra descriptor
132
         */
133
        public int getExtralen() {
134
                return extralen;
135
        }
136
 
137
        /**
138
         * Returns the index of the String descriptor describing this interface.<br>
139
         *
140
         * @return the index of the String descriptor
141
         */
142
        public byte getIInterface() {
143
                return iInterface;
144
        }
145
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.