1 /* 2 * Copyright (C) 2024 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.FlaggedApi; 20 import android.annotation.SystemApi; 21 import android.hardware.tv.tuner.FrontendDvbsStandard; 22 import android.hardware.tv.tuner.FrontendDvbtStandard; 23 import android.media.tv.flags.Flags; 24 25 /** 26 * Standard extension for the standard DVB-T and DVB-S series. 27 * 28 * @hide 29 */ 30 @SystemApi 31 @FlaggedApi(Flags.FLAG_TUNER_W_APIS) 32 public final class StandardExtension { 33 private final int mDvbsStandardExtension; 34 private final int mDvbtStandardExtension; 35 36 /** 37 * Private constructor called by JNI only. 38 */ StandardExtension(int dvbsStandardExtension, int dvbtStandardExtension)39 private StandardExtension(int dvbsStandardExtension, int dvbtStandardExtension) { 40 mDvbsStandardExtension = dvbsStandardExtension; 41 mDvbtStandardExtension = dvbtStandardExtension; 42 } 43 44 /** 45 * Gets the DVB-S standard extension within the DVB-S standard series. 46 * 47 * @return An integer representing the standard, such as 48 * {@link DvbsFrontendSettings#STANDARD_S}. 49 * 50 * @see android.media.tv.tuner.frontend.DvbsFrontendSettings 51 */ 52 @DvbsFrontendSettings.Standard getDvbsStandardExtension()53 public int getDvbsStandardExtension() { 54 if (mDvbsStandardExtension == FrontendDvbsStandard.UNDEFINED) { 55 throw new IllegalStateException("No DVB-S standard transition"); 56 } 57 return mDvbsStandardExtension; 58 } 59 60 /** 61 * Gets the DVB-T standard extension within the DVB-T standard series. 62 * 63 * @return An integer representing the standard, such as 64 * {@link DvbtFrontendSettings#STANDARD_T}. 65 * 66 * @see android.media.tv.tuner.frontend.DvbtFrontendSettings 67 */ 68 @DvbtFrontendSettings.Standard getDvbtStandardExtension()69 public int getDvbtStandardExtension() { 70 if (mDvbtStandardExtension == FrontendDvbtStandard.UNDEFINED) { 71 throw new IllegalStateException("No DVB-T standard transition"); 72 } 73 return mDvbtStandardExtension; 74 } 75 } 76