1 /*
2  * Copyright 2019 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 android.media.tv.tuner.frontend;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.media.tv.tuner.frontend.FrontendSettings.Type;
22 import android.media.tv.tuner.frontend.FrontendStatus.FrontendStatusType;
23 import android.util.Range;
24 
25 /**
26  * This class is used to specify meta information of a frontend.
27  *
28  * @hide
29  */
30 @SystemApi
31 public class FrontendInfo {
32     private final int mId;
33     private final int mType;
34     private final Range<Integer> mFrequencyRange;
35     private final Range<Integer> mSymbolRateRange;
36     private final int mAcquireRange;
37     private final int mExclusiveGroupId;
38     private final int[] mStatusCaps;
39     private final FrontendCapabilities mFrontendCap;
40 
FrontendInfo(int id, int type, int minFrequency, int maxFrequency, int minSymbolRate, int maxSymbolRate, int acquireRange, int exclusiveGroupId, int[] statusCaps, FrontendCapabilities frontendCap)41     private FrontendInfo(int id, int type, int minFrequency, int maxFrequency, int minSymbolRate,
42             int maxSymbolRate, int acquireRange, int exclusiveGroupId, int[] statusCaps,
43             FrontendCapabilities frontendCap) {
44         mId = id;
45         mType = type;
46         mFrequencyRange = new Range<>(minFrequency, maxFrequency);
47         mSymbolRateRange = new Range<>(minSymbolRate, maxSymbolRate);
48         mAcquireRange = acquireRange;
49         mExclusiveGroupId = exclusiveGroupId;
50         mStatusCaps = statusCaps;
51         mFrontendCap = frontendCap;
52     }
53 
54     /**
55      * Gets frontend ID.
56      */
getId()57     public int getId() {
58         return mId;
59     }
60     /**
61      * Gets frontend type.
62      */
63     @Type
getType()64     public int getType() {
65         return mType;
66     }
67 
68     /**
69      * Gets supported frequency range in Hz.
70      */
71     @NonNull
getFrequencyRange()72     public Range<Integer> getFrequencyRange() {
73         return mFrequencyRange;
74     }
75 
76     /**
77      * Gets symbol rate range in symbols per second.
78      */
79     @NonNull
getSymbolRateRange()80     public Range<Integer> getSymbolRateRange() {
81         return mSymbolRateRange;
82     }
83 
84     /**
85      * Gets acquire range in Hz.
86      *
87      * <p>The maximum frequency difference the frontend can detect.
88      */
getAcquireRange()89     public int getAcquireRange() {
90         return mAcquireRange;
91     }
92     /**
93      * Gets exclusive group ID.
94      *
95      * <p>Frontends with the same exclusive group ID indicates they can't function at same time. For
96      * instance, they share some hardware modules.
97      */
getExclusiveGroupId()98     public int getExclusiveGroupId() {
99         return mExclusiveGroupId;
100     }
101     /**
102      * Gets status capabilities.
103      *
104      * @return An array of supported status types.
105      */
106     @FrontendStatusType
107     @NonNull
getStatusCapabilities()108     public int[] getStatusCapabilities() {
109         return mStatusCaps;
110     }
111     /**
112      * Gets frontend capabilities.
113      */
114     @NonNull
getFrontendCapabilities()115     public FrontendCapabilities getFrontendCapabilities() {
116         return mFrontendCap;
117     }
118 }
119