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.IntRange; 21 import android.annotation.NonNull; 22 import android.annotation.SuppressLint; 23 import android.annotation.SystemApi; 24 import android.media.tv.tuner.Lnb; 25 import android.media.tv.tuner.TunerVersionChecker; 26 import java.lang.annotation.Retention; 27 import java.lang.annotation.RetentionPolicy; 28 import java.util.Arrays; 29 import java.util.Collections; 30 import java.util.List; 31 32 /** 33 * A Frontend Status class that contains the metrics of the active frontend. 34 * 35 * @hide 36 */ 37 @SystemApi 38 public class FrontendStatus { 39 40 /** @hide */ 41 @IntDef({FRONTEND_STATUS_TYPE_DEMOD_LOCK, FRONTEND_STATUS_TYPE_SNR, FRONTEND_STATUS_TYPE_BER, 42 FRONTEND_STATUS_TYPE_PER, FRONTEND_STATUS_TYPE_PRE_BER, 43 FRONTEND_STATUS_TYPE_SIGNAL_QUALITY, FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH, 44 FRONTEND_STATUS_TYPE_SYMBOL_RATE, FRONTEND_STATUS_TYPE_FEC, 45 FRONTEND_STATUS_TYPE_MODULATION, FRONTEND_STATUS_TYPE_SPECTRAL, 46 FRONTEND_STATUS_TYPE_LNB_VOLTAGE, FRONTEND_STATUS_TYPE_PLP_ID, 47 FRONTEND_STATUS_TYPE_EWBS, FRONTEND_STATUS_TYPE_AGC, FRONTEND_STATUS_TYPE_LNA, 48 FRONTEND_STATUS_TYPE_LAYER_ERROR, FRONTEND_STATUS_TYPE_MER, 49 FRONTEND_STATUS_TYPE_FREQ_OFFSET, FRONTEND_STATUS_TYPE_HIERARCHY, 50 FRONTEND_STATUS_TYPE_RF_LOCK, FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO, 51 FRONTEND_STATUS_TYPE_BERS, FRONTEND_STATUS_TYPE_CODERATES, 52 FRONTEND_STATUS_TYPE_BANDWIDTH, FRONTEND_STATUS_TYPE_GUARD_INTERVAL, 53 FRONTEND_STATUS_TYPE_TRANSMISSION_MODE, FRONTEND_STATUS_TYPE_UEC, 54 FRONTEND_STATUS_TYPE_T2_SYSTEM_ID, FRONTEND_STATUS_TYPE_INTERLEAVINGS, 55 FRONTEND_STATUS_TYPE_ISDBT_SEGMENTS, FRONTEND_STATUS_TYPE_TS_DATA_RATES, 56 FRONTEND_STATUS_TYPE_MODULATIONS_EXT, FRONTEND_STATUS_TYPE_ROLL_OFF, 57 FRONTEND_STATUS_TYPE_IS_MISO_ENABLED, FRONTEND_STATUS_TYPE_IS_LINEAR, 58 FRONTEND_STATUS_TYPE_IS_SHORT_FRAMES_ENABLED, FRONTEND_STATUS_TYPE_ISDBT_MODE, 59 FRONTEND_STATUS_TYPE_ISDBT_PARTIAL_RECEPTION_FLAG, FRONTEND_STATUS_TYPE_STREAM_IDS, 60 FRONTEND_STATUS_TYPE_DVBT_CELL_IDS, FRONTEND_STATUS_TYPE_ATSC3_ALL_PLP_INFO}) 61 @Retention(RetentionPolicy.SOURCE) 62 public @interface FrontendStatusType {} 63 64 /** 65 * Lock status for Demod. 66 */ 67 public static final int FRONTEND_STATUS_TYPE_DEMOD_LOCK = 68 android.hardware.tv.tuner.FrontendStatusType.DEMOD_LOCK; 69 /** 70 * Signal to Noise Ratio. 71 */ 72 public static final int FRONTEND_STATUS_TYPE_SNR = 73 android.hardware.tv.tuner.FrontendStatusType.SNR; 74 /** 75 * Bit Error Ratio. 76 */ 77 public static final int FRONTEND_STATUS_TYPE_BER = 78 android.hardware.tv.tuner.FrontendStatusType.BER; 79 /** 80 * Packages Error Ratio. 81 */ 82 public static final int FRONTEND_STATUS_TYPE_PER = 83 android.hardware.tv.tuner.FrontendStatusType.PER; 84 /** 85 * Bit Error Ratio before FEC. 86 */ 87 public static final int FRONTEND_STATUS_TYPE_PRE_BER = 88 android.hardware.tv.tuner.FrontendStatusType.PRE_BER; 89 /** 90 * Signal Quality (0..100). Good data over total data in percent can be 91 * used as a way to present Signal Quality. 92 */ 93 public static final int FRONTEND_STATUS_TYPE_SIGNAL_QUALITY = 94 android.hardware.tv.tuner.FrontendStatusType.SIGNAL_QUALITY; 95 /** 96 * Signal Strength. 97 */ 98 public static final int FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH = 99 android.hardware.tv.tuner.FrontendStatusType.SIGNAL_STRENGTH; 100 /** 101 * Symbol Rate in symbols per second. 102 */ 103 public static final int FRONTEND_STATUS_TYPE_SYMBOL_RATE = 104 android.hardware.tv.tuner.FrontendStatusType.SYMBOL_RATE; 105 /** 106 * Forward Error Correction Type. 107 */ 108 public static final int FRONTEND_STATUS_TYPE_FEC = 109 android.hardware.tv.tuner.FrontendStatusType.FEC; 110 /** 111 * Modulation Type. 112 */ 113 public static final int FRONTEND_STATUS_TYPE_MODULATION = 114 android.hardware.tv.tuner.FrontendStatusType.MODULATION; 115 /** 116 * Spectral Inversion Type. 117 */ 118 public static final int FRONTEND_STATUS_TYPE_SPECTRAL = 119 android.hardware.tv.tuner.FrontendStatusType.SPECTRAL; 120 /** 121 * LNB Voltage. 122 */ 123 public static final int FRONTEND_STATUS_TYPE_LNB_VOLTAGE = 124 android.hardware.tv.tuner.FrontendStatusType.LNB_VOLTAGE; 125 /** 126 * Physical Layer Pipe ID. 127 */ 128 public static final int FRONTEND_STATUS_TYPE_PLP_ID = 129 android.hardware.tv.tuner.FrontendStatusType.PLP_ID; 130 /** 131 * Status for Emergency Warning Broadcasting System. 132 */ 133 public static final int FRONTEND_STATUS_TYPE_EWBS = 134 android.hardware.tv.tuner.FrontendStatusType.EWBS; 135 /** 136 * Automatic Gain Control. 137 */ 138 public static final int FRONTEND_STATUS_TYPE_AGC = 139 android.hardware.tv.tuner.FrontendStatusType.AGC; 140 /** 141 * Low Noise Amplifier. 142 */ 143 public static final int FRONTEND_STATUS_TYPE_LNA = 144 android.hardware.tv.tuner.FrontendStatusType.LNA; 145 /** 146 * Error status by layer. 147 */ 148 public static final int FRONTEND_STATUS_TYPE_LAYER_ERROR = 149 android.hardware.tv.tuner.FrontendStatusType.LAYER_ERROR; 150 /** 151 * Modulation Error Ratio. 152 */ 153 public static final int FRONTEND_STATUS_TYPE_MER = 154 android.hardware.tv.tuner.FrontendStatusType.MER; 155 /** 156 * Difference between tuning frequency and actual locked frequency. 157 */ 158 public static final int FRONTEND_STATUS_TYPE_FREQ_OFFSET = 159 android.hardware.tv.tuner.FrontendStatusType.FREQ_OFFSET; 160 /** 161 * Hierarchy for DVBT. 162 */ 163 public static final int FRONTEND_STATUS_TYPE_HIERARCHY = 164 android.hardware.tv.tuner.FrontendStatusType.HIERARCHY; 165 /** 166 * Lock status for RF. 167 */ 168 public static final int FRONTEND_STATUS_TYPE_RF_LOCK = 169 android.hardware.tv.tuner.FrontendStatusType.RF_LOCK; 170 /** 171 * Current tuned PLP information in a frequency band for ATSC-3.0 frontend. 172 */ 173 public static final int FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO = 174 android.hardware.tv.tuner.FrontendStatusType.ATSC3_PLP_INFO; 175 /** 176 * BERS Type. Only supported in Tuner HAL 1.1 or higher. 177 */ 178 public static final int FRONTEND_STATUS_TYPE_BERS = 179 android.hardware.tv.tuner.FrontendStatusType.BERS; 180 /** 181 * Coderate Type. Only supported in Tuner HAL 1.1 or higher. 182 */ 183 public static final int FRONTEND_STATUS_TYPE_CODERATES = 184 android.hardware.tv.tuner.FrontendStatusType.CODERATES; 185 /** 186 * Bandwidth Type. Only supported in Tuner HAL 1.1 or higher. 187 */ 188 public static final int FRONTEND_STATUS_TYPE_BANDWIDTH = 189 android.hardware.tv.tuner.FrontendStatusType.BANDWIDTH; 190 /** 191 * Guard Interval Type. Only supported in Tuner HAL 1.1 or higher. 192 */ 193 public static final int FRONTEND_STATUS_TYPE_GUARD_INTERVAL = 194 android.hardware.tv.tuner.FrontendStatusType.GUARD_INTERVAL; 195 /** 196 * Transmission Mode Type. Only supported in Tuner HAL 1.1 or higher. 197 */ 198 public static final int FRONTEND_STATUS_TYPE_TRANSMISSION_MODE = 199 android.hardware.tv.tuner.FrontendStatusType.TRANSMISSION_MODE; 200 /** 201 * UEC Type. Only supported in Tuner HAL 1.1 or higher. 202 */ 203 public static final int FRONTEND_STATUS_TYPE_UEC = 204 android.hardware.tv.tuner.FrontendStatusType.UEC; 205 /** 206 * T2 System Id Type. Only supported in Tuner HAL 1.1 or higher. 207 */ 208 public static final int FRONTEND_STATUS_TYPE_T2_SYSTEM_ID = 209 android.hardware.tv.tuner.FrontendStatusType.T2_SYSTEM_ID; 210 /** 211 * Interleavings Type. Only supported in Tuner HAL 1.1 or higher. 212 */ 213 public static final int FRONTEND_STATUS_TYPE_INTERLEAVINGS = 214 android.hardware.tv.tuner.FrontendStatusType.INTERLEAVINGS; 215 /** 216 * ISDBT Segments Type. Only supported in Tuner HAL 1.1 or higher. 217 */ 218 public static final int FRONTEND_STATUS_TYPE_ISDBT_SEGMENTS = 219 android.hardware.tv.tuner.FrontendStatusType.ISDBT_SEGMENTS; 220 /** 221 * TS Data Rates Type. Only supported in Tuner HAL 1.1 or higher. 222 */ 223 public static final int FRONTEND_STATUS_TYPE_TS_DATA_RATES = 224 android.hardware.tv.tuner.FrontendStatusType.TS_DATA_RATES; 225 /** 226 * Extended Modulations Type. Only supported in Tuner HAL 1.1 or higher. 227 */ 228 public static final int FRONTEND_STATUS_TYPE_MODULATIONS_EXT = 229 android.hardware.tv.tuner.FrontendStatusType.MODULATIONS; 230 /** 231 * Roll Off Type status of the frontend. Only supported in Tuner HAL 1.1 or higher. 232 */ 233 public static final int FRONTEND_STATUS_TYPE_ROLL_OFF = 234 android.hardware.tv.tuner.FrontendStatusType.ROLL_OFF; 235 /** 236 * If the frontend currently supports MISO or not. Only supported in Tuner HAL 1.1 or higher. 237 */ 238 public static final int FRONTEND_STATUS_TYPE_IS_MISO_ENABLED = 239 android.hardware.tv.tuner.FrontendStatusType.IS_MISO; 240 /** 241 * If the frontend code rate is linear or not. Only supported in Tuner HAL 1.1 or higher. 242 */ 243 public static final int FRONTEND_STATUS_TYPE_IS_LINEAR = 244 android.hardware.tv.tuner.FrontendStatusType.IS_LINEAR; 245 /** 246 * If short frames is enabled or not. Only supported in Tuner HAL 1.1 or higher. 247 */ 248 public static final int FRONTEND_STATUS_TYPE_IS_SHORT_FRAMES_ENABLED = 249 android.hardware.tv.tuner.FrontendStatusType.IS_SHORT_FRAMES; 250 /** 251 * ISDB-T mode. Only supported in Tuner HAL 2.0 or higher. 252 */ 253 public static final int FRONTEND_STATUS_TYPE_ISDBT_MODE = 254 android.hardware.tv.tuner.FrontendStatusType.ISDBT_MODE; 255 /** 256 * ISDB-T partial reception flag. Only supported in Tuner HAL 2.0 or higher. 257 */ 258 public static final int FRONTEND_STATUS_TYPE_ISDBT_PARTIAL_RECEPTION_FLAG = 259 android.hardware.tv.tuner.FrontendStatusType.ISDBT_PARTIAL_RECEPTION_FLAG; 260 261 /** 262 * Stream IDs included in a transponder. 263 */ 264 public static final int FRONTEND_STATUS_TYPE_STREAM_IDS = 265 android.hardware.tv.tuner.FrontendStatusType.STREAM_ID_LIST; 266 267 /** 268 * DVB-T Cell IDs. 269 */ 270 public static final int FRONTEND_STATUS_TYPE_DVBT_CELL_IDS = 271 android.hardware.tv.tuner.FrontendStatusType.DVBT_CELL_IDS; 272 273 /** 274 * All PLP information in a frequency band for ATSC-3.0 frontend, which includes both tuned and 275 * not tuned PLPs for currently watching service. 276 */ 277 public static final int FRONTEND_STATUS_TYPE_ATSC3_ALL_PLP_INFO = 278 android.hardware.tv.tuner.FrontendStatusType.ATSC3_ALL_PLP_INFO; 279 280 /** @hide */ 281 @IntDef(value = { 282 AtscFrontendSettings.MODULATION_UNDEFINED, 283 AtscFrontendSettings.MODULATION_AUTO, 284 AtscFrontendSettings.MODULATION_MOD_8VSB, 285 AtscFrontendSettings.MODULATION_MOD_16VSB, 286 Atsc3FrontendSettings.MODULATION_UNDEFINED, 287 Atsc3FrontendSettings.MODULATION_AUTO, 288 Atsc3FrontendSettings.MODULATION_MOD_QPSK, 289 Atsc3FrontendSettings.MODULATION_MOD_16QAM, 290 Atsc3FrontendSettings.MODULATION_MOD_64QAM, 291 Atsc3FrontendSettings.MODULATION_MOD_256QAM, 292 Atsc3FrontendSettings.MODULATION_MOD_1024QAM, 293 Atsc3FrontendSettings.MODULATION_MOD_4096QAM, 294 DtmbFrontendSettings.MODULATION_CONSTELLATION_UNDEFINED, 295 DtmbFrontendSettings.MODULATION_CONSTELLATION_AUTO, 296 DtmbFrontendSettings.MODULATION_CONSTELLATION_4QAM, 297 DtmbFrontendSettings.MODULATION_CONSTELLATION_4QAM_NR, 298 DtmbFrontendSettings.MODULATION_CONSTELLATION_16QAM, 299 DtmbFrontendSettings.MODULATION_CONSTELLATION_32QAM, 300 DtmbFrontendSettings.MODULATION_CONSTELLATION_64QAM, 301 DvbcFrontendSettings.MODULATION_UNDEFINED, 302 DvbcFrontendSettings.MODULATION_AUTO, 303 DvbcFrontendSettings.MODULATION_MOD_16QAM, 304 DvbcFrontendSettings.MODULATION_MOD_32QAM, 305 DvbcFrontendSettings.MODULATION_MOD_64QAM, 306 DvbcFrontendSettings.MODULATION_MOD_128QAM, 307 DvbcFrontendSettings.MODULATION_MOD_256QAM, 308 DvbsFrontendSettings.MODULATION_UNDEFINED, 309 DvbsFrontendSettings.MODULATION_AUTO, 310 DvbsFrontendSettings.MODULATION_MOD_QPSK, 311 DvbsFrontendSettings.MODULATION_MOD_8PSK, 312 DvbsFrontendSettings.MODULATION_MOD_16QAM, 313 DvbsFrontendSettings.MODULATION_MOD_16PSK, 314 DvbsFrontendSettings.MODULATION_MOD_32PSK, 315 DvbsFrontendSettings.MODULATION_MOD_ACM, 316 DvbsFrontendSettings.MODULATION_MOD_8APSK, 317 DvbsFrontendSettings.MODULATION_MOD_16APSK, 318 DvbsFrontendSettings.MODULATION_MOD_32APSK, 319 DvbsFrontendSettings.MODULATION_MOD_64APSK, 320 DvbsFrontendSettings.MODULATION_MOD_128APSK, 321 DvbsFrontendSettings.MODULATION_MOD_256APSK, 322 DvbsFrontendSettings.MODULATION_MOD_RESERVED, 323 DvbtFrontendSettings.CONSTELLATION_UNDEFINED, 324 DvbtFrontendSettings.CONSTELLATION_AUTO, 325 DvbtFrontendSettings.CONSTELLATION_QPSK, 326 DvbtFrontendSettings.CONSTELLATION_16QAM, 327 DvbtFrontendSettings.CONSTELLATION_64QAM, 328 DvbtFrontendSettings.CONSTELLATION_256QAM, 329 DvbtFrontendSettings.CONSTELLATION_QPSK_R, 330 DvbtFrontendSettings.CONSTELLATION_16QAM_R, 331 DvbtFrontendSettings.CONSTELLATION_64QAM_R, 332 DvbtFrontendSettings.CONSTELLATION_256QAM_R, 333 IsdbsFrontendSettings.MODULATION_UNDEFINED, 334 IsdbsFrontendSettings.MODULATION_AUTO, 335 IsdbsFrontendSettings.MODULATION_MOD_BPSK, 336 IsdbsFrontendSettings.MODULATION_MOD_QPSK, 337 IsdbsFrontendSettings.MODULATION_MOD_TC8PSK, 338 Isdbs3FrontendSettings.MODULATION_UNDEFINED, 339 Isdbs3FrontendSettings.MODULATION_AUTO, 340 Isdbs3FrontendSettings.MODULATION_MOD_BPSK, 341 Isdbs3FrontendSettings.MODULATION_MOD_QPSK, 342 Isdbs3FrontendSettings.MODULATION_MOD_8PSK, 343 Isdbs3FrontendSettings.MODULATION_MOD_16APSK, 344 Isdbs3FrontendSettings.MODULATION_MOD_32APSK, 345 IsdbtFrontendSettings.MODULATION_UNDEFINED, 346 IsdbtFrontendSettings.MODULATION_AUTO, 347 IsdbtFrontendSettings.MODULATION_MOD_DQPSK, 348 IsdbtFrontendSettings.MODULATION_MOD_QPSK, 349 IsdbtFrontendSettings.MODULATION_MOD_16QAM, 350 IsdbtFrontendSettings.MODULATION_MOD_64QAM}) 351 @Retention(RetentionPolicy.SOURCE) 352 public @interface FrontendModulation {} 353 354 /** @hide */ 355 @IntDef(value = { 356 Atsc3FrontendSettings.TIME_INTERLEAVE_MODE_UNDEFINED, 357 Atsc3FrontendSettings.TIME_INTERLEAVE_MODE_AUTO, 358 Atsc3FrontendSettings.TIME_INTERLEAVE_MODE_CTI, 359 Atsc3FrontendSettings.TIME_INTERLEAVE_MODE_HTI, 360 DtmbFrontendSettings.TIME_INTERLEAVE_MODE_UNDEFINED, 361 DtmbFrontendSettings.TIME_INTERLEAVE_MODE_AUTO, 362 DtmbFrontendSettings.TIME_INTERLEAVE_MODE_TIMER_INT_240, 363 DtmbFrontendSettings.TIME_INTERLEAVE_MODE_TIMER_INT_720, 364 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_UNDEFINED, 365 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_AUTO, 366 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_1_0, 367 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_1_1, 368 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_64_2, 369 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_32_4, 370 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_16_8, 371 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_8_16, 372 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_2, 373 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_3, 374 DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_4, 375 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_UNDEFINED, 376 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_AUTO, 377 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_0, 378 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_4, 379 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_8, 380 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_16, 381 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_0, 382 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_2, 383 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_4, 384 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_8, 385 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_0, 386 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_1, 387 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_2, 388 IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_4}) 389 @Retention(RetentionPolicy.SOURCE) 390 public @interface FrontendInterleaveMode {} 391 392 /** @hide */ 393 @IntDef(value = { 394 Atsc3FrontendSettings.BANDWIDTH_UNDEFINED, 395 Atsc3FrontendSettings.BANDWIDTH_AUTO, 396 Atsc3FrontendSettings.BANDWIDTH_BANDWIDTH_6MHZ, 397 Atsc3FrontendSettings.BANDWIDTH_BANDWIDTH_7MHZ, 398 Atsc3FrontendSettings.BANDWIDTH_BANDWIDTH_8MHZ, 399 DtmbFrontendSettings.BANDWIDTH_UNDEFINED, 400 DtmbFrontendSettings.BANDWIDTH_AUTO, 401 DtmbFrontendSettings.BANDWIDTH_6MHZ, 402 DtmbFrontendSettings.BANDWIDTH_8MHZ, 403 DvbtFrontendSettings.BANDWIDTH_UNDEFINED, 404 DvbtFrontendSettings.BANDWIDTH_AUTO, 405 DvbtFrontendSettings.BANDWIDTH_8MHZ, 406 DvbtFrontendSettings.BANDWIDTH_7MHZ, 407 DvbtFrontendSettings.BANDWIDTH_6MHZ, 408 DvbtFrontendSettings.BANDWIDTH_5MHZ, 409 DvbtFrontendSettings.BANDWIDTH_1_7MHZ, 410 DvbtFrontendSettings.BANDWIDTH_10MHZ, 411 IsdbtFrontendSettings.BANDWIDTH_UNDEFINED, 412 IsdbtFrontendSettings.BANDWIDTH_AUTO, 413 IsdbtFrontendSettings.BANDWIDTH_8MHZ, 414 IsdbtFrontendSettings.BANDWIDTH_7MHZ, 415 IsdbtFrontendSettings.BANDWIDTH_6MHZ}) 416 @Retention(RetentionPolicy.SOURCE) 417 public @interface FrontendBandwidth {} 418 419 /** @hide */ 420 @IntDef(value = { 421 DtmbFrontendSettings.TRANSMISSION_MODE_UNDEFINED, 422 DtmbFrontendSettings.TRANSMISSION_MODE_AUTO, 423 DtmbFrontendSettings.TRANSMISSION_MODE_C1, 424 DtmbFrontendSettings.TRANSMISSION_MODE_C3780, 425 DvbtFrontendSettings.TRANSMISSION_MODE_UNDEFINED, 426 DvbtFrontendSettings.TRANSMISSION_MODE_AUTO, 427 DvbtFrontendSettings.TRANSMISSION_MODE_2K, 428 DvbtFrontendSettings.TRANSMISSION_MODE_8K, 429 DvbtFrontendSettings.TRANSMISSION_MODE_4K, 430 DvbtFrontendSettings.TRANSMISSION_MODE_1K, 431 DvbtFrontendSettings.TRANSMISSION_MODE_16K, 432 DvbtFrontendSettings.TRANSMISSION_MODE_32K, 433 IsdbtFrontendSettings.MODE_UNDEFINED, 434 IsdbtFrontendSettings.MODE_AUTO, 435 IsdbtFrontendSettings.MODE_1, 436 IsdbtFrontendSettings.MODE_2, 437 IsdbtFrontendSettings.MODE_3}) 438 @Retention(RetentionPolicy.SOURCE) 439 public @interface FrontendTransmissionMode {} 440 441 /** @hide */ 442 @IntDef(value = { 443 DtmbFrontendSettings.GUARD_INTERVAL_UNDEFINED, 444 DtmbFrontendSettings.GUARD_INTERVAL_AUTO, 445 DtmbFrontendSettings.GUARD_INTERVAL_PN_420_VARIOUS, 446 DtmbFrontendSettings.GUARD_INTERVAL_PN_595_CONST, 447 DtmbFrontendSettings.GUARD_INTERVAL_PN_945_VARIOUS, 448 DtmbFrontendSettings.GUARD_INTERVAL_PN_420_CONST, 449 DtmbFrontendSettings.GUARD_INTERVAL_PN_945_CONST, 450 DtmbFrontendSettings.GUARD_INTERVAL_PN_RESERVED, 451 DvbtFrontendSettings.GUARD_INTERVAL_UNDEFINED, 452 DvbtFrontendSettings.GUARD_INTERVAL_AUTO, 453 DvbtFrontendSettings.GUARD_INTERVAL_1_32, 454 DvbtFrontendSettings.GUARD_INTERVAL_1_16, 455 DvbtFrontendSettings.GUARD_INTERVAL_1_8, 456 DvbtFrontendSettings.GUARD_INTERVAL_1_4, 457 DvbtFrontendSettings.GUARD_INTERVAL_1_128, 458 DvbtFrontendSettings.GUARD_INTERVAL_19_128, 459 DvbtFrontendSettings.GUARD_INTERVAL_19_256, 460 DvbtFrontendSettings.GUARD_INTERVAL_19_128}) 461 @Retention(RetentionPolicy.SOURCE) 462 public @interface FrontendGuardInterval {} 463 464 /** @hide */ 465 @IntDef(value = { 466 DvbsFrontendSettings.ROLLOFF_UNDEFINED, 467 DvbsFrontendSettings.ROLLOFF_0_35, 468 DvbsFrontendSettings.ROLLOFF_0_25, 469 DvbsFrontendSettings.ROLLOFF_0_20, 470 DvbsFrontendSettings.ROLLOFF_0_15, 471 DvbsFrontendSettings.ROLLOFF_0_10, 472 DvbsFrontendSettings.ROLLOFF_0_5, 473 Isdbs3FrontendSettings.ROLLOFF_UNDEFINED, 474 Isdbs3FrontendSettings.ROLLOFF_0_03, 475 IsdbsFrontendSettings.ROLLOFF_UNDEFINED, 476 IsdbsFrontendSettings.ROLLOFF_0_35}) 477 @Retention(RetentionPolicy.SOURCE) 478 public @interface FrontendRollOff {} 479 480 private Boolean mIsDemodLocked; 481 private Integer mSnr; 482 private Integer mBer; 483 private Integer mPer; 484 private Integer mPerBer; 485 private Integer mSignalQuality; 486 private Integer mSignalStrength; 487 private Integer mSymbolRate; 488 private Long mInnerFec; 489 private Integer mModulation; 490 private Integer mInversion; 491 private Integer mLnbVoltage; 492 private Integer mPlpId; 493 private Boolean mIsEwbs; 494 private Integer mAgc; 495 private Boolean mIsLnaOn; 496 private boolean[] mIsLayerErrors; 497 private Integer mMer; 498 private Long mFreqOffset; 499 private Integer mHierarchy; 500 private Boolean mIsRfLocked; 501 private Atsc3PlpTuningInfo[] mPlpInfo; 502 private int[] mBers; 503 private int[] mCodeRates; 504 private Integer mBandwidth; 505 private Integer mGuardInterval; 506 private Integer mTransmissionMode; 507 private Integer mUec; 508 private Integer mSystemId; 509 private int[] mInterleaving; 510 private int[] mTsDataRate; 511 private int[] mIsdbtSegment; 512 private int[] mModulationsExt; 513 private Integer mRollOff; 514 private Boolean mIsMisoEnabled; 515 private Boolean mIsLinear; 516 private Boolean mIsShortFrames; 517 private Integer mIsdbtMode; 518 private Integer mIsdbtPartialReceptionFlag; 519 private int[] mStreamIds; 520 private int[] mDvbtCellIds; 521 private Atsc3PlpInfo[] mAllPlpInfo; 522 523 // Constructed and fields set by JNI code. FrontendStatus()524 private FrontendStatus() { 525 } 526 527 /** 528 * Gets if the demod is currently locked or not. 529 */ isDemodLocked()530 public boolean isDemodLocked() { 531 if (mIsDemodLocked == null) { 532 throw new IllegalStateException("DemodLocked status is empty"); 533 } 534 return mIsDemodLocked; 535 } 536 /** 537 * Gets the current Signal to Noise Ratio in thousandths of a deciBel (0.001dB). 538 */ getSnr()539 public int getSnr() { 540 if (mSnr == null) { 541 throw new IllegalStateException("Snr status is empty"); 542 } 543 return mSnr; 544 } 545 /** 546 * Gets the current Bit Error Ratio. 547 * 548 * <p>The number of error bit per 1 billion bits. 549 */ getBer()550 public int getBer() { 551 if (mBer == null) { 552 throw new IllegalStateException("Ber status is empty"); 553 } 554 return mBer; 555 } 556 557 /** 558 * Gets the current Packages Error Ratio. 559 * 560 * <p>The number of error package per 1 billion packages. 561 */ getPer()562 public int getPer() { 563 if (mPer == null) { 564 throw new IllegalStateException("Per status is empty"); 565 } 566 return mPer; 567 } 568 /** 569 * Gets the current Bit Error Ratio before Forward Error Correction (FEC). 570 * 571 * <p>The number of error bit per 1 billion bits before FEC. 572 */ getPerBer()573 public int getPerBer() { 574 if (mPerBer == null) { 575 throw new IllegalStateException("PerBer status is empty"); 576 } 577 return mPerBer; 578 } 579 /** 580 * Gets the current Signal Quality in percent. 581 */ getSignalQuality()582 public int getSignalQuality() { 583 if (mSignalQuality == null) { 584 throw new IllegalStateException("SignalQuality status is empty"); 585 } 586 return mSignalQuality; 587 } 588 /** 589 * Gets the current Signal Strength in thousandths of a dBm (0.001dBm). 590 */ getSignalStrength()591 public int getSignalStrength() { 592 if (mSignalStrength == null) { 593 throw new IllegalStateException("SignalStrength status is empty"); 594 } 595 return mSignalStrength; 596 } 597 /** 598 * Gets the current symbol rate in symbols per second. 599 */ getSymbolRate()600 public int getSymbolRate() { 601 if (mSymbolRate == null) { 602 throw new IllegalStateException("SymbolRate status is empty"); 603 } 604 return mSymbolRate; 605 } 606 /** 607 * Gets the current Inner Forward Error Correction type as specified in ETSI EN 300 468 V1.15.1 608 * and ETSI EN 302 307-2 V1.1.1. 609 */ 610 @FrontendSettings.InnerFec getInnerFec()611 public long getInnerFec() { 612 if (mInnerFec == null) { 613 throw new IllegalStateException("InnerFec status is empty"); 614 } 615 return mInnerFec; 616 } 617 /** 618 * Gets the currently modulation information. 619 */ 620 @FrontendModulation getModulation()621 public int getModulation() { 622 if (mModulation == null) { 623 throw new IllegalStateException("Modulation status is empty"); 624 } 625 return mModulation; 626 } 627 /** 628 * Gets the currently Spectral Inversion information for DVBC. 629 */ 630 @FrontendSettings.FrontendSpectralInversion getSpectralInversion()631 public int getSpectralInversion() { 632 if (mInversion == null) { 633 throw new IllegalStateException("SpectralInversion status is empty"); 634 } 635 return mInversion; 636 } 637 /** 638 * Gets the current Power Voltage Type for LNB. 639 */ 640 @Lnb.Voltage getLnbVoltage()641 public int getLnbVoltage() { 642 if (mLnbVoltage == null) { 643 throw new IllegalStateException("LnbVoltage status is empty"); 644 } 645 return mLnbVoltage; 646 } 647 /** 648 * Gets the current Physical Layer Pipe ID. 649 */ getPlpId()650 public int getPlpId() { 651 if (mPlpId == null) { 652 throw new IllegalStateException("PlpId status is empty"); 653 } 654 return mPlpId; 655 } 656 /** 657 * Checks whether it's Emergency Warning Broadcasting System 658 */ isEwbs()659 public boolean isEwbs() { 660 if (mIsEwbs == null) { 661 throw new IllegalStateException("Ewbs status is empty"); 662 } 663 return mIsEwbs; 664 } 665 /** 666 * Gets the current Automatic Gain Control value which is normalized from 0 to 255. 667 * 668 * Larger AGC values indicate it is applying more gain. 669 */ getAgc()670 public int getAgc() { 671 if (mAgc == null) { 672 throw new IllegalStateException("Agc status is empty"); 673 } 674 return mAgc; 675 } 676 /** 677 * Checks LNA (Low Noise Amplifier) is on or not. 678 */ isLnaOn()679 public boolean isLnaOn() { 680 if (mIsLnaOn == null) { 681 throw new IllegalStateException("LnaOn status is empty"); 682 } 683 return mIsLnaOn; 684 } 685 /** 686 * Gets the current Error information by layer. 687 * 688 * The order of the vectors is in ascending order of the required CNR (Contrast-to-noise ratio). 689 * The most robust layer is the first. For example, in ISDB-T, vec[0] is the information of 690 * layer A. vec[1] is the information of layer B. 691 */ 692 @NonNull getLayerErrors()693 public boolean[] getLayerErrors() { 694 if (mIsLayerErrors == null) { 695 throw new IllegalStateException("LayerErrors status is empty"); 696 } 697 return mIsLayerErrors; 698 } 699 /** 700 * Gets the current Modulation Error Ratio in thousandths of a deciBel (0.001dB). 701 */ getMer()702 public int getMer() { 703 if (mMer == null) { 704 throw new IllegalStateException("Mer status is empty"); 705 } 706 return mMer; 707 } 708 /** 709 * Gets the current frequency difference in Hz. 710 * 711 * <p>Difference between tuning frequency and actual locked frequency. 712 * @deprecated Use {@link #getFreqOffsetLong()} 713 */ 714 @Deprecated getFreqOffset()715 public int getFreqOffset() { 716 return (int) getFreqOffsetLong(); 717 } 718 /** 719 * Gets the current frequency difference in Hz. 720 * 721 * <p>Difference between tuning frequency and actual locked frequency. 722 */ getFreqOffsetLong()723 public long getFreqOffsetLong() { 724 if (mFreqOffset == null) { 725 throw new IllegalStateException("FreqOffset status is empty"); 726 } 727 return mFreqOffset; 728 } 729 /** 730 * Gets the current hierarchy Type for DVBT. 731 */ 732 @DvbtFrontendSettings.Hierarchy getHierarchy()733 public int getHierarchy() { 734 if (mHierarchy == null) { 735 throw new IllegalStateException("Hierarchy status is empty"); 736 } 737 return mHierarchy; 738 } 739 /** 740 * Gets if the RF is locked or not. 741 */ isRfLocked()742 public boolean isRfLocked() { 743 if (mIsRfLocked == null) { 744 throw new IllegalStateException("isRfLocked status is empty"); 745 } 746 return mIsRfLocked; 747 } 748 /** 749 * Gets an array of the current tuned PLPs information of ATSC3 frontend. 750 */ 751 @NonNull getAtsc3PlpTuningInfo()752 public Atsc3PlpTuningInfo[] getAtsc3PlpTuningInfo() { 753 if (mPlpInfo == null) { 754 throw new IllegalStateException("Atsc3PlpTuningInfo status is empty"); 755 } 756 return mPlpInfo; 757 } 758 759 /** 760 * Gets an array of the current extended bit error ratio. 761 * 762 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 763 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 764 * 765 * The order of the vectors is in ascending order of the required CNR (Contrast-to-noise ratio). 766 * The most robust layer is the first. For example, in ISDB-T, vec[0] is the information of 767 * layer A. vec[1] is the information of layer B. 768 */ 769 @NonNull getBers()770 public int[] getBers() { 771 TunerVersionChecker.checkHigherOrEqualVersionTo( 772 TunerVersionChecker.TUNER_VERSION_1_1, "getBers status"); 773 if (mBers == null) { 774 throw new IllegalStateException("Bers status is empty"); 775 } 776 return mBers; 777 } 778 779 /** 780 * Gets an array of the current code rates. 781 * 782 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 783 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 784 * 785 * The order of the vectors is in ascending order of the required CNR (Contrast-to-noise ratio). 786 * The most robust layer is the first. For example, in ISDB-T, vec[0] is the information of 787 * layer A. vec[1] is the information of layer B. 788 */ 789 @NonNull 790 @FrontendSettings.InnerFec getCodeRates()791 public int[] getCodeRates() { 792 TunerVersionChecker.checkHigherOrEqualVersionTo( 793 TunerVersionChecker.TUNER_VERSION_1_1, "getCodeRates status"); 794 if (mCodeRates == null) { 795 throw new IllegalStateException("CodeRates status is empty"); 796 } 797 return mCodeRates; 798 } 799 800 /** 801 * Gets the current bandwidth information. 802 * 803 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 804 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 805 */ 806 @FrontendBandwidth getBandwidth()807 public int getBandwidth() { 808 TunerVersionChecker.checkHigherOrEqualVersionTo( 809 TunerVersionChecker.TUNER_VERSION_1_1, "getBandwidth status"); 810 if (mBandwidth == null) { 811 throw new IllegalStateException("Bandwidth status is empty"); 812 } 813 return mBandwidth; 814 } 815 816 /** 817 * Gets the current guard interval information. 818 * 819 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 820 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 821 */ 822 @FrontendGuardInterval getGuardInterval()823 public int getGuardInterval() { 824 TunerVersionChecker.checkHigherOrEqualVersionTo( 825 TunerVersionChecker.TUNER_VERSION_1_1, "getGuardInterval status"); 826 if (mGuardInterval == null) { 827 throw new IllegalStateException("GuardInterval status is empty"); 828 } 829 return mGuardInterval; 830 } 831 832 /** 833 * Gets the current transmission mode information. 834 * 835 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 836 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 837 */ 838 @FrontendTransmissionMode getTransmissionMode()839 public int getTransmissionMode() { 840 TunerVersionChecker.checkHigherOrEqualVersionTo( 841 TunerVersionChecker.TUNER_VERSION_1_1, "getTransmissionMode status"); 842 if (mTransmissionMode == null) { 843 throw new IllegalStateException("TransmissionMode status is empty"); 844 } 845 return mTransmissionMode; 846 } 847 848 /** 849 * Gets the current Uncorrectable Error Counts of the frontend's Physical Layer Pipe (PLP) 850 * since the last tune operation. 851 * 852 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 853 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 854 */ getUec()855 public int getUec() { 856 TunerVersionChecker.checkHigherOrEqualVersionTo( 857 TunerVersionChecker.TUNER_VERSION_1_1, "getUec status"); 858 if (mUec == null) { 859 throw new IllegalStateException("Uec status is empty"); 860 } 861 return mUec; 862 } 863 864 /** 865 * Gets the current DVB-T2 system id. 866 * 867 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 868 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 869 */ 870 @IntRange(from = 0, to = 0xffff) getSystemId()871 public int getSystemId() { 872 TunerVersionChecker.checkHigherOrEqualVersionTo( 873 TunerVersionChecker.TUNER_VERSION_1_1, "getSystemId status"); 874 if (mSystemId == null) { 875 throw new IllegalStateException("SystemId status is empty"); 876 } 877 return mSystemId; 878 } 879 880 /** 881 * Gets an array of the current interleaving mode information. 882 * 883 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 884 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 885 * 886 * The order of the vectors is in ascending order of the required CNR (Contrast-to-noise ratio). 887 * The most robust layer is the first. For example, in ISDB-T, vec[0] is the information of 888 * layer A. vec[1] is the information of layer B. 889 */ 890 @NonNull 891 @FrontendInterleaveMode getInterleaving()892 public int[] getInterleaving() { 893 TunerVersionChecker.checkHigherOrEqualVersionTo( 894 TunerVersionChecker.TUNER_VERSION_1_1, "getInterleaving status"); 895 if (mInterleaving == null) { 896 throw new IllegalStateException("Interleaving status is empty"); 897 } 898 return mInterleaving; 899 } 900 901 /** 902 * Gets an array of the current segments information in ISDB-T Specification of all the 903 * channels. 904 * 905 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 906 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 907 * 908 * The order of the vectors is in ascending order of the required CNR (Contrast-to-noise ratio). 909 * The most robust layer is the first. For example, in ISDB-T, vec[0] is the information of 910 * layer A. vec[1] is the information of layer B. 911 */ 912 @NonNull 913 @IntRange(from = 0, to = 0xff) getIsdbtSegment()914 public int[] getIsdbtSegment() { 915 TunerVersionChecker.checkHigherOrEqualVersionTo( 916 TunerVersionChecker.TUNER_VERSION_1_1, "getIsdbtSegment status"); 917 if (mIsdbtSegment == null) { 918 throw new IllegalStateException("IsdbtSegment status is empty"); 919 } 920 return mIsdbtSegment; 921 } 922 923 /** 924 * Gets an array of the Transport Stream Data Rate in BPS of the current channel. 925 * 926 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 927 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 928 */ 929 @NonNull getTsDataRate()930 public int[] getTsDataRate() { 931 TunerVersionChecker.checkHigherOrEqualVersionTo( 932 TunerVersionChecker.TUNER_VERSION_1_1, "getTsDataRate status"); 933 if (mTsDataRate == null) { 934 throw new IllegalStateException("TsDataRate status is empty"); 935 } 936 return mTsDataRate; 937 } 938 939 /** 940 * Gets an array of the current extended modulations information. 941 * 942 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 943 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 944 * 945 * The order of the vectors is in ascending order of the required CNR (Contrast-to-noise ratio). 946 * The most robust layer is the first. For example, in ISDB-T, vec[0] is the information of 947 * layer A. vec[1] is the information of layer B. 948 */ 949 @NonNull 950 @FrontendModulation getExtendedModulations()951 public int[] getExtendedModulations() { 952 TunerVersionChecker.checkHigherOrEqualVersionTo( 953 TunerVersionChecker.TUNER_VERSION_1_1, "getExtendedModulations status"); 954 if (mModulationsExt == null) { 955 throw new IllegalStateException("ExtendedModulations status is empty"); 956 } 957 return mModulationsExt; 958 } 959 960 /** 961 * Gets the current roll off information. 962 * 963 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 964 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 965 */ 966 @FrontendRollOff getRollOff()967 public int getRollOff() { 968 TunerVersionChecker.checkHigherOrEqualVersionTo( 969 TunerVersionChecker.TUNER_VERSION_1_1, "getRollOff status"); 970 if (mRollOff == null) { 971 throw new IllegalStateException("RollOff status is empty"); 972 } 973 return mRollOff; 974 } 975 976 /** 977 * Gets is MISO enabled or not. 978 * 979 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 980 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 981 */ isMisoEnabled()982 public boolean isMisoEnabled() { 983 TunerVersionChecker.checkHigherOrEqualVersionTo( 984 TunerVersionChecker.TUNER_VERSION_1_1, "isMisoEnabled status"); 985 if (mIsMisoEnabled == null) { 986 throw new IllegalStateException("isMisoEnabled status is empty"); 987 } 988 return mIsMisoEnabled; 989 } 990 991 /** 992 * Gets is the Code Rate of the frontend is linear or not. 993 * 994 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 995 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 996 */ isLinear()997 public boolean isLinear() { 998 TunerVersionChecker.checkHigherOrEqualVersionTo( 999 TunerVersionChecker.TUNER_VERSION_1_1, "isLinear status"); 1000 if (mIsLinear == null) { 1001 throw new IllegalStateException("isLinear status is empty"); 1002 } 1003 return mIsLinear; 1004 } 1005 1006 /** 1007 * Gets is the Short Frames enabled or not. 1008 * 1009 * <p>This query is only supported by Tuner HAL 1.1 or higher. Use 1010 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 1011 */ isShortFramesEnabled()1012 public boolean isShortFramesEnabled() { 1013 TunerVersionChecker.checkHigherOrEqualVersionTo( 1014 TunerVersionChecker.TUNER_VERSION_1_1, "isShortFramesEnabled status"); 1015 if (mIsShortFrames == null) { 1016 throw new IllegalStateException("isShortFramesEnabled status is empty"); 1017 } 1018 return mIsShortFrames; 1019 } 1020 1021 /** 1022 * Gets ISDB-T mode. 1023 * 1024 * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL 1025 * doesn't return ISDB-T mode status will throw IllegalStateException. Use 1026 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 1027 */ 1028 @IsdbtFrontendSettings.Mode getIsdbtMode()1029 public int getIsdbtMode() { 1030 TunerVersionChecker.checkHigherOrEqualVersionTo( 1031 TunerVersionChecker.TUNER_VERSION_2_0, "IsdbtMode status"); 1032 if (mIsdbtMode == null) { 1033 throw new IllegalStateException("IsdbtMode status is empty"); 1034 } 1035 return mIsdbtMode; 1036 } 1037 1038 /** 1039 * Gets ISDB-T partial reception flag. 1040 * 1041 * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL 1042 * doesn't return partial reception flag status will throw IllegalStateException. Use 1043 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 1044 */ 1045 @IsdbtFrontendSettings.PartialReceptionFlag getIsdbtPartialReceptionFlag()1046 public int getIsdbtPartialReceptionFlag() { 1047 TunerVersionChecker.checkHigherOrEqualVersionTo( 1048 TunerVersionChecker.TUNER_VERSION_2_0, "IsdbtPartialReceptionFlag status"); 1049 if (mIsdbtPartialReceptionFlag == null) { 1050 throw new IllegalStateException("IsdbtPartialReceptionFlag status is empty"); 1051 } 1052 return mIsdbtPartialReceptionFlag; 1053 } 1054 1055 /** 1056 * Gets stream ids included in a transponder. 1057 * 1058 * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL 1059 * doesn't return stream ids will throw IllegalStateException. Use 1060 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 1061 */ 1062 @SuppressLint("ArrayReturn") 1063 @NonNull getStreamIds()1064 public int[] getStreamIds() { 1065 TunerVersionChecker.checkHigherOrEqualVersionTo( 1066 TunerVersionChecker.TUNER_VERSION_2_0, "stream ids status"); 1067 if (mStreamIds == null) { 1068 throw new IllegalStateException("stream ids are empty"); 1069 } 1070 return mStreamIds; 1071 } 1072 1073 /** 1074 * Gets DVB-T cell ids. 1075 * 1076 * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL 1077 * doesn't return cell ids will throw IllegalStateException. Use 1078 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 1079 */ 1080 @SuppressLint("ArrayReturn") 1081 @NonNull getDvbtCellIds()1082 public int[] getDvbtCellIds() { 1083 TunerVersionChecker.checkHigherOrEqualVersionTo( 1084 TunerVersionChecker.TUNER_VERSION_2_0, "dvbt cell ids status"); 1085 if (mDvbtCellIds == null) { 1086 throw new IllegalStateException("dvbt cell ids are empty"); 1087 } 1088 return mDvbtCellIds; 1089 } 1090 1091 /** 1092 * Gets a list of all PLPs information of ATSC3 frontend, which includes both tuned and not 1093 * tuned PLPs for currently watching service. 1094 * 1095 * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version will throw 1096 * UnsupportedOperationException. Use {@link TunerVersionChecker#getTunerVersion()} to check 1097 * the version. 1098 * 1099 * @return a list of all PLPs information. It is empty if HAL doesn't return all PLPs 1100 * information status. 1101 */ 1102 @NonNull getAllAtsc3PlpInfo()1103 public List<Atsc3PlpInfo> getAllAtsc3PlpInfo() { 1104 if (!TunerVersionChecker.checkHigherOrEqualVersionTo( 1105 TunerVersionChecker.TUNER_VERSION_2_0, "Atsc3PlpInfo all status")) { 1106 throw new UnsupportedOperationException("Atsc3PlpInfo all status is empty"); 1107 } 1108 if (mAllPlpInfo == null) { 1109 return Collections.EMPTY_LIST; 1110 } 1111 return Arrays.asList(mAllPlpInfo); 1112 } 1113 1114 /** 1115 * Information of each tuning Physical Layer Pipes. 1116 */ 1117 public static class Atsc3PlpTuningInfo { 1118 private final int mPlpId; 1119 private final boolean mIsLocked; 1120 private final int mUec; 1121 Atsc3PlpTuningInfo(int plpId, boolean isLocked, int uec)1122 private Atsc3PlpTuningInfo(int plpId, boolean isLocked, int uec) { 1123 mPlpId = plpId; 1124 mIsLocked = isLocked; 1125 mUec = uec; 1126 } 1127 1128 /** 1129 * Gets Physical Layer Pipe ID. 1130 */ getPlpId()1131 public int getPlpId() { 1132 return mPlpId; 1133 } 1134 /** 1135 * Gets Demod Lock/Unlock status of this particular PLP. 1136 */ isLocked()1137 public boolean isLocked() { 1138 return mIsLocked; 1139 } 1140 /** 1141 * Gets Uncorrectable Error Counts (UEC) of this particular PLP since last tune operation. 1142 */ getUec()1143 public int getUec() { 1144 return mUec; 1145 } 1146 } 1147 } 1148