1/* 2 * Copyright (C) 2017 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 */ 16package com.android.server.usb.descriptors; 17 18import com.android.server.usb.descriptors.report.ReportCanvas; 19 20/** 21 * @hide 22 * An audio class-specific Output Terminal Interface. 23 * see audio10.pdf section 4.3.2.2 24 */ 25public final class Usb10ACOutputTerminal extends UsbACTerminal { 26 private static final String TAG = "Usb10ACOutputTerminal"; 27 28 private byte mSourceID; // 7:1 From Input Terminal. (0x01) 29 private byte mTerminal; // 8:1 Unused. 30 31 public Usb10ACOutputTerminal(int length, byte type, byte subtype, byte subClass) { 32 super(length, type, subtype, subClass); 33 } 34 35 public byte getSourceID() { 36 return mSourceID; 37 } 38 39 public byte getTerminal() { 40 return mTerminal; 41 } 42 43 @Override 44 public int parseRawDescriptors(ByteStream stream) { 45 super.parseRawDescriptors(stream); 46 47 mSourceID = stream.getByte(); 48 mTerminal = stream.getByte(); 49 return mLength; 50 } 51 52 @Override 53 public void report(ReportCanvas canvas) { 54 super.report(canvas); 55 56 canvas.openList(); 57 canvas.writeListItem("Source ID: " + ReportCanvas.getHexString(getSourceID())); 58 canvas.closeList(); 59 } 60} 61