1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.tests.usbgadget.libusb; 18 19 import com.google.common.collect.ImmutableList; 20 import com.sun.jna.Pointer; 21 import com.sun.jna.Structure; 22 import java.util.List; 23 24 public class Interface extends Structure { 25 public static class ByReference extends Interface implements Structure.ByReference {} 26 Interface()27 public Interface() {} 28 Interface(Pointer p)29 public Interface(Pointer p) { 30 super(p); 31 read(); 32 } 33 toArray(int size)34 public Interface[] toArray(int size) { 35 return (Interface[]) super.toArray(new Interface[size]); 36 } 37 38 @Override getFieldOrder()39 protected List<String> getFieldOrder() { 40 return ImmutableList.of("altsetting", "num_altsetting"); 41 } 42 43 public InterfaceDescriptor.ByReference altsetting; 44 public int num_altsetting; 45 } 46