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
18/**
19 * @hide
20 * An audio class-specific Feature Unit Interface
21 * see audio10.pdf section 3.5.5
22 */
23public final class UsbACFeatureUnit extends UsbACInterface {
24    private static final String TAG = "UsbACFeatureUnit";
25
26    // audio10.pdf section 4.3.2.5
27    public static final int CONTROL_MASK_MUTE =    0x0001;
28    public static final int CONTROL_MASK_VOL =     0x0002;
29    public static final int CONTROL_MASK_BASS =    0x0004;
30    public static final int CONTROL_MASK_MID =     0x0008;
31    public static final int CONTROL_MASK_TREB =    0x0010;
32    public static final int CONTROL_MASK_EQ =      0x0020;
33    public static final int CONTROL_MASK_AGC =     0x0040;
34    public static final int CONTROL_MASK_DELAY =   0x0080;
35    public static final int CONTROL_MASK_BOOST =   0x0100; // BASS boost
36    public static final int CONTROL_MASK_LOUD =    0x0200; // LOUDNESS
37
38    private int mNumChannels;
39
40    private byte mUnitID;   // 3:1 Constant uniquely identifying the Unit within the audio function.
41                            // This value is used in all requests to address this Unit
42    private byte mSourceID; // 4:1 ID of the Unit or Terminal to which this Feature Unit
43                            // is connected.
44    private byte mControlSize;  // 5:1 Size in bytes of an element of the mControls array: n
45    private int[] mControls;    // 6:? bitmask (see above) of supported controls in a given
46                                // logical channel
47    private byte mUnitName;     // ?:1 Index of a string descriptor, describing this Feature Unit.
48
49    public UsbACFeatureUnit(int length, byte type, byte subtype, int subClass) {
50        super(length, type, subtype, subClass);
51    }
52
53    public int getNumChannels() {
54        return mNumChannels;
55    }
56
57    public byte getUnitID() {
58        return mUnitID;
59    }
60
61    public byte getSourceID() {
62        return mSourceID;
63    }
64
65    public byte getControlSize() {
66        return mControlSize;
67    }
68
69    public int[] getControls() {
70        return mControls;
71    }
72
73    public byte getUnitName() {
74        return mUnitName;
75    }
76}
77