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.IntDef;
20 import android.annotation.LongDef;
21 import android.annotation.SystemApi;
22 import android.hardware.tv.tuner.V1_0.Constants;
23 
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 
27 /**
28  * Frontend settings for tune and scan operations.
29  *
30  * @hide
31  */
32 @SystemApi
33 public abstract class FrontendSettings {
34     /** @hide */
35     @IntDef(prefix = "TYPE_",
36             value = {TYPE_UNDEFINED, TYPE_ANALOG, TYPE_ATSC, TYPE_ATSC3, TYPE_DVBC, TYPE_DVBS,
37                     TYPE_DVBT, TYPE_ISDBS, TYPE_ISDBS3, TYPE_ISDBT})
38     @Retention(RetentionPolicy.SOURCE)
39     public @interface Type {}
40 
41     /**
42      * Undefined frontend type.
43      */
44     public static final int TYPE_UNDEFINED = Constants.FrontendType.UNDEFINED;
45     /**
46      * Analog frontend type.
47      */
48     public static final int TYPE_ANALOG = Constants.FrontendType.ANALOG;
49     /**
50      * Advanced Television Systems Committee (ATSC) frontend type.
51      */
52     public static final int TYPE_ATSC = Constants.FrontendType.ATSC;
53     /**
54      * Advanced Television Systems Committee 3.0 (ATSC-3) frontend type.
55      */
56     public static final int TYPE_ATSC3 = Constants.FrontendType.ATSC3;
57     /**
58      * Digital Video Broadcasting-Cable (DVB-C) frontend type.
59      */
60     public static final int TYPE_DVBC = Constants.FrontendType.DVBC;
61     /**
62      * Digital Video Broadcasting-Satellite (DVB-S) frontend type.
63      */
64     public static final int TYPE_DVBS = Constants.FrontendType.DVBS;
65     /**
66      * Digital Video Broadcasting-Terrestrial (DVB-T) frontend type.
67      */
68     public static final int TYPE_DVBT = Constants.FrontendType.DVBT;
69     /**
70      * Integrated Services Digital Broadcasting-Satellite (ISDB-S) frontend type.
71      */
72     public static final int TYPE_ISDBS = Constants.FrontendType.ISDBS;
73     /**
74      * Integrated Services Digital Broadcasting-Satellite 3 (ISDB-S3) frontend type.
75      */
76     public static final int TYPE_ISDBS3 = Constants.FrontendType.ISDBS3;
77     /**
78      * Integrated Services Digital Broadcasting-Terrestrial (ISDB-T) frontend type.
79      */
80     public static final int TYPE_ISDBT = Constants.FrontendType.ISDBT;
81 
82 
83 
84     /** @hide */
85     @LongDef(flag = true,
86             prefix = "FEC_",
87             value = {FEC_UNDEFINED, FEC_AUTO, FEC_1_2, FEC_1_3, FEC_1_4, FEC_1_5, FEC_2_3, FEC_2_5,
88             FEC_2_9, FEC_3_4, FEC_3_5, FEC_4_5, FEC_4_15, FEC_5_6, FEC_5_9, FEC_6_7, FEC_7_8,
89             FEC_7_9, FEC_7_15, FEC_8_9, FEC_8_15, FEC_9_10, FEC_9_20, FEC_11_15, FEC_11_20,
90             FEC_11_45, FEC_13_18, FEC_13_45, FEC_14_45, FEC_23_36, FEC_25_36, FEC_26_45, FEC_28_45,
91             FEC_29_45, FEC_31_45, FEC_32_45, FEC_77_90})
92     @Retention(RetentionPolicy.SOURCE)
93     public @interface InnerFec {}
94 
95     /**
96      * FEC not defined.
97      */
98     public static final long FEC_UNDEFINED = Constants.FrontendInnerFec.FEC_UNDEFINED;
99     /**
100      * hardware is able to detect and set FEC automatically.
101      */
102     public static final long FEC_AUTO = Constants.FrontendInnerFec.AUTO;
103     /**
104      * 1/2 conv. code rate.
105      */
106     public static final long FEC_1_2 = Constants.FrontendInnerFec.FEC_1_2;
107     /**
108      * 1/3 conv. code rate.
109      */
110     public static final long FEC_1_3 = Constants.FrontendInnerFec.FEC_1_3;
111     /**
112      * 1/4 conv. code rate.
113      */
114     public static final long FEC_1_4 = Constants.FrontendInnerFec.FEC_1_4;
115     /**
116      * 1/5 conv. code rate.
117      */
118     public static final long FEC_1_5 = Constants.FrontendInnerFec.FEC_1_5;
119     /**
120      * 2/3 conv. code rate.
121      */
122     public static final long FEC_2_3 = Constants.FrontendInnerFec.FEC_2_3;
123     /**
124      * 2/5 conv. code rate.
125      */
126     public static final long FEC_2_5 = Constants.FrontendInnerFec.FEC_2_5;
127     /**
128      * 2/9 conv. code rate.
129      */
130     public static final long FEC_2_9 = Constants.FrontendInnerFec.FEC_2_9;
131     /**
132      * 3/4 conv. code rate.
133      */
134     public static final long FEC_3_4 = Constants.FrontendInnerFec.FEC_3_4;
135     /**
136      * 3/5 conv. code rate.
137      */
138     public static final long FEC_3_5 = Constants.FrontendInnerFec.FEC_3_5;
139     /**
140      * 4/5 conv. code rate.
141      */
142     public static final long FEC_4_5 = Constants.FrontendInnerFec.FEC_4_5;
143     /**
144      * 4/15 conv. code rate.
145      */
146     public static final long FEC_4_15 = Constants.FrontendInnerFec.FEC_4_15;
147     /**
148      * 5/6 conv. code rate.
149      */
150     public static final long FEC_5_6 = Constants.FrontendInnerFec.FEC_5_6;
151     /**
152      * 5/9 conv. code rate.
153      */
154     public static final long FEC_5_9 = Constants.FrontendInnerFec.FEC_5_9;
155     /**
156      * 6/7 conv. code rate.
157      */
158     public static final long FEC_6_7 = Constants.FrontendInnerFec.FEC_6_7;
159     /**
160      * 7/8 conv. code rate.
161      */
162     public static final long FEC_7_8 = Constants.FrontendInnerFec.FEC_7_8;
163     /**
164      * 7/9 conv. code rate.
165      */
166     public static final long FEC_7_9 = Constants.FrontendInnerFec.FEC_7_9;
167     /**
168      * 7/15 conv. code rate.
169      */
170     public static final long FEC_7_15 = Constants.FrontendInnerFec.FEC_7_15;
171     /**
172      * 8/9 conv. code rate.
173      */
174     public static final long FEC_8_9 = Constants.FrontendInnerFec.FEC_8_9;
175     /**
176      * 8/15 conv. code rate.
177      */
178     public static final long FEC_8_15 = Constants.FrontendInnerFec.FEC_8_15;
179     /**
180      * 9/10 conv. code rate.
181      */
182     public static final long FEC_9_10 = Constants.FrontendInnerFec.FEC_9_10;
183     /**
184      * 9/20 conv. code rate.
185      */
186     public static final long FEC_9_20 = Constants.FrontendInnerFec.FEC_9_20;
187     /**
188      * 11/15 conv. code rate.
189      */
190     public static final long FEC_11_15 = Constants.FrontendInnerFec.FEC_11_15;
191     /**
192      * 11/20 conv. code rate.
193      */
194     public static final long FEC_11_20 = Constants.FrontendInnerFec.FEC_11_20;
195     /**
196      * 11/45 conv. code rate.
197      */
198     public static final long FEC_11_45 = Constants.FrontendInnerFec.FEC_11_45;
199     /**
200      * 13/18 conv. code rate.
201      */
202     public static final long FEC_13_18 = Constants.FrontendInnerFec.FEC_13_18;
203     /**
204      * 13/45 conv. code rate.
205      */
206     public static final long FEC_13_45 = Constants.FrontendInnerFec.FEC_13_45;
207     /**
208      * 14/45 conv. code rate.
209      */
210     public static final long FEC_14_45 = Constants.FrontendInnerFec.FEC_14_45;
211     /**
212      * 23/36 conv. code rate.
213      */
214     public static final long FEC_23_36 = Constants.FrontendInnerFec.FEC_23_36;
215     /**
216      * 25/36 conv. code rate.
217      */
218     public static final long FEC_25_36 = Constants.FrontendInnerFec.FEC_25_36;
219     /**
220      * 26/45 conv. code rate.
221      */
222     public static final long FEC_26_45 = Constants.FrontendInnerFec.FEC_26_45;
223     /**
224      * 28/45 conv. code rate.
225      */
226     public static final long FEC_28_45 = Constants.FrontendInnerFec.FEC_28_45;
227     /**
228      * 29/45 conv. code rate.
229      */
230     public static final long FEC_29_45 = Constants.FrontendInnerFec.FEC_29_45;
231     /**
232      * 31/45 conv. code rate.
233      */
234     public static final long FEC_31_45 = Constants.FrontendInnerFec.FEC_31_45;
235     /**
236      * 32/45 conv. code rate.
237      */
238     public static final long FEC_32_45 = Constants.FrontendInnerFec.FEC_32_45;
239     /**
240      * 77/90 conv. code rate.
241      */
242     public static final long FEC_77_90 = Constants.FrontendInnerFec.FEC_77_90;
243 
244 
245 
246     private final int mFrequency;
247 
FrontendSettings(int frequency)248     FrontendSettings(int frequency) {
249         mFrequency = frequency;
250     }
251 
252     /**
253      * Returns the frontend type.
254      */
255     @Type
getType()256     public abstract int getType();
257 
258     /**
259      * Gets the frequency.
260      *
261      * @return the frequency in Hz.
262      */
getFrequency()263     public int getFrequency() {
264         return mFrequency;
265     }
266 }
267