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.SystemApi; 23 import android.hardware.tv.tuner.FrontendDvbtBandwidth; 24 import android.hardware.tv.tuner.FrontendDvbtCoderate; 25 import android.hardware.tv.tuner.FrontendDvbtConstellation; 26 import android.hardware.tv.tuner.FrontendDvbtGuardInterval; 27 import android.hardware.tv.tuner.FrontendDvbtHierarchy; 28 import android.hardware.tv.tuner.FrontendDvbtPlpMode; 29 import android.hardware.tv.tuner.FrontendDvbtStandard; 30 import android.hardware.tv.tuner.FrontendDvbtTransmissionMode; 31 import android.media.tv.tuner.TunerVersionChecker; 32 33 import java.lang.annotation.Retention; 34 import java.lang.annotation.RetentionPolicy; 35 36 /** 37 * Frontend settings for DVBT. 38 * 39 * @hide 40 */ 41 @SystemApi 42 public class DvbtFrontendSettings extends FrontendSettings { 43 44 /** @hide */ 45 @IntDef(prefix = "TRANSMISSION_MODE_", 46 value = {TRANSMISSION_MODE_UNDEFINED, TRANSMISSION_MODE_AUTO, 47 TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_4K, 48 TRANSMISSION_MODE_1K, TRANSMISSION_MODE_16K, TRANSMISSION_MODE_32K}) 49 @Retention(RetentionPolicy.SOURCE) 50 public @interface TransmissionMode {} 51 52 /** 53 * Transmission Mode undefined. 54 */ 55 public static final int TRANSMISSION_MODE_UNDEFINED = FrontendDvbtTransmissionMode.UNDEFINED; 56 /** 57 * Hardware is able to detect and set Transmission Mode automatically 58 */ 59 public static final int TRANSMISSION_MODE_AUTO = FrontendDvbtTransmissionMode.AUTO; 60 /** 61 * 2K Transmission Mode. 62 */ 63 public static final int TRANSMISSION_MODE_2K = FrontendDvbtTransmissionMode.MODE_2K; 64 /** 65 * 8K Transmission Mode. 66 */ 67 public static final int TRANSMISSION_MODE_8K = FrontendDvbtTransmissionMode.MODE_8K; 68 /** 69 * 4K Transmission Mode. 70 */ 71 public static final int TRANSMISSION_MODE_4K = FrontendDvbtTransmissionMode.MODE_4K; 72 /** 73 * 1K Transmission Mode. 74 */ 75 public static final int TRANSMISSION_MODE_1K = FrontendDvbtTransmissionMode.MODE_1K; 76 /** 77 * 16K Transmission Mode. 78 */ 79 public static final int TRANSMISSION_MODE_16K = FrontendDvbtTransmissionMode.MODE_16K; 80 /** 81 * 32K Transmission Mode. 82 */ 83 public static final int TRANSMISSION_MODE_32K = FrontendDvbtTransmissionMode.MODE_32K; 84 /** 85 * 8K Transmission Extended Mode. 86 */ 87 public static final int TRANSMISSION_MODE_EXTENDED_8K = FrontendDvbtTransmissionMode.MODE_8K_E; 88 /** 89 * 16K Transmission Extended Mode. 90 */ 91 public static final int TRANSMISSION_MODE_EXTENDED_16K = 92 FrontendDvbtTransmissionMode.MODE_16K_E; 93 /** 94 * 32K Transmission Extended Mode. 95 */ 96 public static final int TRANSMISSION_MODE_EXTENDED_32K = 97 FrontendDvbtTransmissionMode.MODE_32K_E; 98 99 /** @hide */ 100 @IntDef(prefix = "BANDWIDTH_", 101 value = {BANDWIDTH_UNDEFINED, BANDWIDTH_AUTO, BANDWIDTH_8MHZ, BANDWIDTH_7MHZ, 102 BANDWIDTH_6MHZ, BANDWIDTH_5MHZ, BANDWIDTH_1_7MHZ, BANDWIDTH_10MHZ}) 103 @Retention(RetentionPolicy.SOURCE) 104 public @interface Bandwidth {} 105 106 /** 107 * Bandwidth undefined. 108 */ 109 public static final int BANDWIDTH_UNDEFINED = FrontendDvbtBandwidth.UNDEFINED; 110 /** 111 * Hardware is able to detect and set Bandwidth automatically. 112 */ 113 public static final int BANDWIDTH_AUTO = FrontendDvbtBandwidth.AUTO; 114 /** 115 * 8 MHz bandwidth. 116 */ 117 public static final int BANDWIDTH_8MHZ = FrontendDvbtBandwidth.BANDWIDTH_8MHZ; 118 /** 119 * 7 MHz bandwidth. 120 */ 121 public static final int BANDWIDTH_7MHZ = FrontendDvbtBandwidth.BANDWIDTH_7MHZ; 122 /** 123 * 6 MHz bandwidth. 124 */ 125 public static final int BANDWIDTH_6MHZ = FrontendDvbtBandwidth.BANDWIDTH_6MHZ; 126 /** 127 * 5 MHz bandwidth. 128 */ 129 public static final int BANDWIDTH_5MHZ = FrontendDvbtBandwidth.BANDWIDTH_5MHZ; 130 /** 131 * 1,7 MHz bandwidth. 132 */ 133 public static final int BANDWIDTH_1_7MHZ = FrontendDvbtBandwidth.BANDWIDTH_1_7MHZ; 134 /** 135 * 10 MHz bandwidth. 136 */ 137 public static final int BANDWIDTH_10MHZ = FrontendDvbtBandwidth.BANDWIDTH_10MHZ; 138 139 140 /** @hide */ 141 @IntDef(prefix = "CONSTELLATION_", 142 value = {CONSTELLATION_UNDEFINED, CONSTELLATION_AUTO, CONSTELLATION_QPSK, 143 CONSTELLATION_16QAM, CONSTELLATION_64QAM, CONSTELLATION_256QAM, 144 CONSTELLATION_QPSK_R, CONSTELLATION_16QAM_R, CONSTELLATION_64QAM_R, 145 CONSTELLATION_256QAM_R}) 146 @Retention(RetentionPolicy.SOURCE) 147 public @interface Constellation {} 148 149 /** 150 * Constellation not defined. 151 */ 152 public static final int CONSTELLATION_UNDEFINED = FrontendDvbtConstellation.UNDEFINED; 153 /** 154 * Hardware is able to detect and set Constellation automatically. 155 */ 156 public static final int CONSTELLATION_AUTO = FrontendDvbtConstellation.AUTO; 157 /** 158 * QPSK Constellation. 159 */ 160 public static final int CONSTELLATION_QPSK = FrontendDvbtConstellation.CONSTELLATION_QPSK; 161 /** 162 * 16QAM Constellation. 163 */ 164 public static final int CONSTELLATION_16QAM = FrontendDvbtConstellation.CONSTELLATION_16QAM; 165 /** 166 * 64QAM Constellation. 167 */ 168 public static final int CONSTELLATION_64QAM = FrontendDvbtConstellation.CONSTELLATION_64QAM; 169 /** 170 * 256QAM Constellation. 171 */ 172 public static final int CONSTELLATION_256QAM = FrontendDvbtConstellation.CONSTELLATION_256QAM; 173 /** 174 * QPSK Rotated Constellation. 175 */ 176 public static final int CONSTELLATION_QPSK_R = FrontendDvbtConstellation.CONSTELLATION_QPSK_R; 177 /** 178 * 16QAM Rotated Constellation. 179 */ 180 public static final int CONSTELLATION_16QAM_R = FrontendDvbtConstellation.CONSTELLATION_16QAM_R; 181 /** 182 * 64QAM Rotated Constellation. 183 */ 184 public static final int CONSTELLATION_64QAM_R = FrontendDvbtConstellation.CONSTELLATION_64QAM_R; 185 /** 186 * 256QAM Rotated Constellation. 187 */ 188 public static final int CONSTELLATION_256QAM_R = 189 FrontendDvbtConstellation.CONSTELLATION_256QAM_R; 190 191 /** @hide */ 192 @IntDef(prefix = "HIERARCHY_", 193 value = {HIERARCHY_UNDEFINED, HIERARCHY_AUTO, HIERARCHY_NON_NATIVE, HIERARCHY_1_NATIVE, 194 HIERARCHY_2_NATIVE, HIERARCHY_4_NATIVE, HIERARCHY_NON_INDEPTH, HIERARCHY_1_INDEPTH, 195 HIERARCHY_2_INDEPTH, HIERARCHY_4_INDEPTH}) 196 @Retention(RetentionPolicy.SOURCE) 197 public @interface Hierarchy {} 198 199 /** 200 * Hierarchy undefined. 201 */ 202 public static final int HIERARCHY_UNDEFINED = FrontendDvbtHierarchy.UNDEFINED; 203 /** 204 * Hardware is able to detect and set Hierarchy automatically. 205 */ 206 public static final int HIERARCHY_AUTO = FrontendDvbtHierarchy.AUTO; 207 /** 208 * Non-native Hierarchy 209 */ 210 public static final int HIERARCHY_NON_NATIVE = FrontendDvbtHierarchy.HIERARCHY_NON_NATIVE; 211 /** 212 * 1-native Hierarchy 213 */ 214 public static final int HIERARCHY_1_NATIVE = FrontendDvbtHierarchy.HIERARCHY_1_NATIVE; 215 /** 216 * 2-native Hierarchy 217 */ 218 public static final int HIERARCHY_2_NATIVE = FrontendDvbtHierarchy.HIERARCHY_2_NATIVE; 219 /** 220 * 4-native Hierarchy 221 */ 222 public static final int HIERARCHY_4_NATIVE = FrontendDvbtHierarchy.HIERARCHY_4_NATIVE; 223 /** 224 * Non-indepth Hierarchy 225 */ 226 public static final int HIERARCHY_NON_INDEPTH = FrontendDvbtHierarchy.HIERARCHY_NON_INDEPTH; 227 /** 228 * 1-indepth Hierarchy 229 */ 230 public static final int HIERARCHY_1_INDEPTH = FrontendDvbtHierarchy.HIERARCHY_1_INDEPTH; 231 /** 232 * 2-indepth Hierarchy 233 */ 234 public static final int HIERARCHY_2_INDEPTH = FrontendDvbtHierarchy.HIERARCHY_2_INDEPTH; 235 /** 236 * 4-indepth Hierarchy 237 */ 238 public static final int HIERARCHY_4_INDEPTH = FrontendDvbtHierarchy.HIERARCHY_4_INDEPTH; 239 240 241 /** @hide */ 242 @IntDef(prefix = "CODERATE_", 243 value = {CODERATE_UNDEFINED, CODERATE_AUTO, CODERATE_1_2, CODERATE_2_3, CODERATE_3_4, 244 CODERATE_5_6, CODERATE_7_8, CODERATE_3_5, CODERATE_4_5, CODERATE_6_7, CODERATE_8_9}) 245 @Retention(RetentionPolicy.SOURCE) 246 public @interface CodeRate {} 247 248 /** 249 * Code rate undefined. 250 */ 251 public static final int CODERATE_UNDEFINED = FrontendDvbtCoderate.UNDEFINED; 252 /** 253 * Hardware is able to detect and set code rate automatically. 254 */ 255 public static final int CODERATE_AUTO = FrontendDvbtCoderate.AUTO; 256 /** 257 * 1/2 code rate. 258 */ 259 public static final int CODERATE_1_2 = FrontendDvbtCoderate.CODERATE_1_2; 260 /** 261 * 2/3 code rate. 262 */ 263 public static final int CODERATE_2_3 = FrontendDvbtCoderate.CODERATE_2_3; 264 /** 265 * 3/4 code rate. 266 */ 267 public static final int CODERATE_3_4 = FrontendDvbtCoderate.CODERATE_3_4; 268 /** 269 * 5/6 code rate. 270 */ 271 public static final int CODERATE_5_6 = FrontendDvbtCoderate.CODERATE_5_6; 272 /** 273 * 7/8 code rate. 274 */ 275 public static final int CODERATE_7_8 = FrontendDvbtCoderate.CODERATE_7_8; 276 /** 277 * 4/5 code rate. 278 */ 279 public static final int CODERATE_3_5 = FrontendDvbtCoderate.CODERATE_3_5; 280 /** 281 * 4/5 code rate. 282 */ 283 public static final int CODERATE_4_5 = FrontendDvbtCoderate.CODERATE_4_5; 284 /** 285 * 6/7 code rate. 286 */ 287 public static final int CODERATE_6_7 = FrontendDvbtCoderate.CODERATE_6_7; 288 /** 289 * 8/9 code rate. 290 */ 291 public static final int CODERATE_8_9 = FrontendDvbtCoderate.CODERATE_8_9; 292 293 /** @hide */ 294 @IntDef(prefix = "GUARD_INTERVAL_", 295 value = {GUARD_INTERVAL_UNDEFINED, GUARD_INTERVAL_AUTO, 296 GUARD_INTERVAL_1_32, GUARD_INTERVAL_1_16, 297 GUARD_INTERVAL_1_8, GUARD_INTERVAL_1_4, 298 GUARD_INTERVAL_1_128, 299 GUARD_INTERVAL_19_128, 300 GUARD_INTERVAL_19_256}) 301 @Retention(RetentionPolicy.SOURCE) 302 public @interface GuardInterval {} 303 304 /** 305 * Guard Interval undefined. 306 */ 307 public static final int GUARD_INTERVAL_UNDEFINED = 308 FrontendDvbtGuardInterval.UNDEFINED; 309 /** 310 * Hardware is able to detect and set Guard Interval automatically. 311 */ 312 public static final int GUARD_INTERVAL_AUTO = FrontendDvbtGuardInterval.AUTO; 313 /** 314 * 1/32 Guard Interval. 315 */ 316 public static final int GUARD_INTERVAL_1_32 = FrontendDvbtGuardInterval.INTERVAL_1_32; 317 /** 318 * 1/16 Guard Interval. 319 */ 320 public static final int GUARD_INTERVAL_1_16 = FrontendDvbtGuardInterval.INTERVAL_1_16; 321 /** 322 * 1/8 Guard Interval. 323 */ 324 public static final int GUARD_INTERVAL_1_8 = FrontendDvbtGuardInterval.INTERVAL_1_8; 325 /** 326 * 1/4 Guard Interval. 327 */ 328 public static final int GUARD_INTERVAL_1_4 = FrontendDvbtGuardInterval.INTERVAL_1_4; 329 /** 330 * 1/128 Guard Interval. 331 */ 332 public static final int GUARD_INTERVAL_1_128 = FrontendDvbtGuardInterval.INTERVAL_1_128; 333 /** 334 * 19/128 Guard Interval. 335 */ 336 public static final int GUARD_INTERVAL_19_128 = FrontendDvbtGuardInterval.INTERVAL_19_128; 337 /** 338 * 19/256 Guard Interval. 339 */ 340 public static final int GUARD_INTERVAL_19_256 = FrontendDvbtGuardInterval.INTERVAL_19_256; 341 342 /** @hide */ 343 @IntDef(prefix = "STANDARD_", 344 value = {STANDARD_AUTO, STANDARD_T, STANDARD_T2} 345 ) 346 @Retention(RetentionPolicy.SOURCE) 347 public @interface Standard {} 348 349 /** 350 * Hardware is able to detect and set Standard automatically. 351 */ 352 public static final int STANDARD_AUTO = FrontendDvbtStandard.AUTO; 353 /** 354 * T standard. 355 */ 356 public static final int STANDARD_T = FrontendDvbtStandard.T; 357 /** 358 * T2 standard. 359 */ 360 public static final int STANDARD_T2 = FrontendDvbtStandard.T2; 361 362 /** @hide */ 363 @IntDef(prefix = "PLP_MODE_", 364 value = {PLP_MODE_UNDEFINED, PLP_MODE_AUTO, PLP_MODE_MANUAL}) 365 @Retention(RetentionPolicy.SOURCE) 366 public @interface PlpMode {} 367 368 /** 369 * Physical Layer Pipe (PLP) Mode undefined. 370 */ 371 public static final int PLP_MODE_UNDEFINED = FrontendDvbtPlpMode.UNDEFINED; 372 /** 373 * Hardware is able to detect and set Physical Layer Pipe (PLP) Mode automatically. 374 */ 375 public static final int PLP_MODE_AUTO = FrontendDvbtPlpMode.AUTO; 376 /** 377 * Physical Layer Pipe (PLP) manual Mode. 378 */ 379 public static final int PLP_MODE_MANUAL = FrontendDvbtPlpMode.MANUAL; 380 381 private int mTransmissionMode; 382 private final int mBandwidth; 383 private final int mConstellation; 384 private final int mHierarchy; 385 private final int mHpCodeRate; 386 private final int mLpCodeRate; 387 private final int mGuardInterval; 388 private final boolean mIsHighPriority; 389 private final int mStandard; 390 private final boolean mIsMiso; 391 private final int mPlpMode; 392 private final int mPlpId; 393 private final int mPlpGroupId; 394 DvbtFrontendSettings(long frequency, int transmissionMode, int bandwidth, int constellation, int hierarchy, int hpCodeRate, int lpCodeRate, int guardInterval, boolean isHighPriority, int standard, boolean isMiso, int plpMode, int plpId, int plpGroupId)395 private DvbtFrontendSettings(long frequency, int transmissionMode, int bandwidth, 396 int constellation, int hierarchy, int hpCodeRate, int lpCodeRate, int guardInterval, 397 boolean isHighPriority, int standard, boolean isMiso, int plpMode, int plpId, 398 int plpGroupId) { 399 super(frequency); 400 mTransmissionMode = transmissionMode; 401 mBandwidth = bandwidth; 402 mConstellation = constellation; 403 mHierarchy = hierarchy; 404 mHpCodeRate = hpCodeRate; 405 mLpCodeRate = lpCodeRate; 406 mGuardInterval = guardInterval; 407 mIsHighPriority = isHighPriority; 408 mStandard = standard; 409 mIsMiso = isMiso; 410 mPlpMode = plpMode; 411 mPlpId = plpId; 412 mPlpGroupId = plpGroupId; 413 } 414 415 /** 416 * Gets Transmission Mode. 417 */ 418 @TransmissionMode getTransmissionMode()419 public int getTransmissionMode() { 420 return mTransmissionMode; 421 } 422 /** 423 * Gets Bandwidth. 424 */ 425 @Bandwidth getBandwidth()426 public int getBandwidth() { 427 return mBandwidth; 428 } 429 /** 430 * Gets Constellation. 431 */ 432 @Constellation getConstellation()433 public int getConstellation() { 434 return mConstellation; 435 } 436 /** 437 * Gets Hierarchy. 438 */ 439 @Hierarchy getHierarchy()440 public int getHierarchy() { 441 return mHierarchy; 442 } 443 /** 444 * Gets Code Rate for High Priority level. 445 */ 446 @CodeRate getHighPriorityCodeRate()447 public int getHighPriorityCodeRate() { 448 return mHpCodeRate; 449 } 450 /** 451 * Gets Code Rate for Low Priority level. 452 */ 453 @CodeRate getLowPriorityCodeRate()454 public int getLowPriorityCodeRate() { 455 return mLpCodeRate; 456 } 457 /** 458 * Gets Guard Interval. 459 */ 460 @GuardInterval getGuardInterval()461 public int getGuardInterval() { 462 return mGuardInterval; 463 } 464 /** 465 * Checks whether it's high priority. 466 */ isHighPriority()467 public boolean isHighPriority() { 468 return mIsHighPriority; 469 } 470 /** 471 * Gets Standard. 472 */ 473 @Standard getStandard()474 public int getStandard() { 475 return mStandard; 476 } 477 /** 478 * Gets whether it's MISO. 479 */ isMiso()480 public boolean isMiso() { 481 return mIsMiso; 482 } 483 /** 484 * Gets Physical Layer Pipe (PLP) Mode. 485 */ 486 @PlpMode getPlpMode()487 public int getPlpMode() { 488 return mPlpMode; 489 } 490 /** 491 * Gets Physical Layer Pipe (PLP) ID. 492 */ getPlpId()493 public int getPlpId() { 494 return mPlpId; 495 } 496 /** 497 * Gets Physical Layer Pipe (PLP) group ID. 498 */ getPlpGroupId()499 public int getPlpGroupId() { 500 return mPlpGroupId; 501 } 502 isExtendedTransmissionMode(@ransmissionMode int transmissionMode)503 private static boolean isExtendedTransmissionMode(@TransmissionMode int transmissionMode) { 504 return transmissionMode == TRANSMISSION_MODE_EXTENDED_8K 505 || transmissionMode == TRANSMISSION_MODE_EXTENDED_16K 506 || transmissionMode == TRANSMISSION_MODE_EXTENDED_32K; 507 } 508 isExtendedConstellation(@onstellation int constellation)509 private static boolean isExtendedConstellation(@Constellation int constellation) { 510 return constellation == CONSTELLATION_QPSK_R 511 || constellation == CONSTELLATION_16QAM_R 512 || constellation == CONSTELLATION_64QAM_R 513 || constellation == CONSTELLATION_256QAM_R; 514 } 515 516 /** 517 * Creates a builder for {@link DvbtFrontendSettings}. 518 */ 519 @NonNull builder()520 public static Builder builder() { 521 return new Builder(); 522 } 523 524 /** 525 * Builder for {@link DvbtFrontendSettings}. 526 */ 527 public static class Builder { 528 private long mFrequency = 0; 529 private int mTransmissionMode = TRANSMISSION_MODE_UNDEFINED; 530 private int mBandwidth = BANDWIDTH_UNDEFINED; 531 private int mConstellation = CONSTELLATION_UNDEFINED; 532 private int mHierarchy = HIERARCHY_UNDEFINED; 533 private int mHpCodeRate = CODERATE_UNDEFINED; 534 private int mLpCodeRate = CODERATE_UNDEFINED; 535 private int mGuardInterval = GUARD_INTERVAL_UNDEFINED; 536 private boolean mIsHighPriority = false; 537 private int mStandard = STANDARD_AUTO; 538 private boolean mIsMiso = false; 539 private int mPlpMode = PLP_MODE_UNDEFINED; 540 private int mPlpId = 0; 541 private int mPlpGroupId = 0; 542 Builder()543 private Builder() { 544 } 545 546 /** 547 * Sets frequency in Hz. 548 * 549 * <p>Default value is 0. 550 * @deprecated Use {@link #setFrequencyLong(long)} 551 */ 552 @NonNull 553 @IntRange(from = 1) 554 @Deprecated setFrequency(int frequency)555 public Builder setFrequency(int frequency) { 556 return setFrequencyLong((long) frequency); 557 } 558 559 /** 560 * Sets frequency in Hz. 561 * 562 * <p>Default value is 0. 563 */ 564 @NonNull 565 @IntRange(from = 1) setFrequencyLong(long frequency)566 public Builder setFrequencyLong(long frequency) { 567 mFrequency = frequency; 568 return this; 569 } 570 571 /** 572 * Sets Transmission Mode. 573 * 574 * <p>{@link #TRANSMISSION_MODE_EXTENDED_8K}, {@link #TRANSMISSION_MODE_EXTENDED_16K} and 575 * {@link #TRANSMISSION_MODE_EXTENDED_32K} are only supported by Tuner HAL 1.1 or higher. 576 * Unsupported version would cause no-op. Use {@link TunerVersionChecker#getTunerVersion()} 577 * to check the version. 578 * 579 * <p>Default value is {@link #TRANSMISSION_MODE_UNDEFINED}. 580 */ 581 @NonNull setTransmissionMode(@ransmissionMode int transmissionMode)582 public Builder setTransmissionMode(@TransmissionMode int transmissionMode) { 583 if (!isExtendedTransmissionMode(transmissionMode) 584 || TunerVersionChecker.checkHigherOrEqualVersionTo( 585 TunerVersionChecker.TUNER_VERSION_1_1, "set TransmissionMode Ext")) { 586 mTransmissionMode = transmissionMode; 587 } 588 return this; 589 } 590 591 /** 592 * Sets Bandwidth. 593 * 594 * <p>Default value is {@link #BANDWIDTH_UNDEFINED}. 595 */ 596 @NonNull setBandwidth(@andwidth int bandwidth)597 public Builder setBandwidth(@Bandwidth int bandwidth) { 598 mBandwidth = bandwidth; 599 return this; 600 } 601 /** 602 * Sets Constellation. 603 * 604 * <p>{@link #CONSTELLATION_QPSK_R}, {@link #CONSTELLATION_16QAM_R}, 605 * {@link #CONSTELLATION_64QAM_R} and {@link #CONSTELLATION_256QAM_Rare} are only supported 606 * by Tuner HAL 1.1 or higher. Unsupported version would cause no-op. Use 607 * {@link TunerVersionChecker#getTunerVersion()} to check the version. 608 * 609 * <p>Default value is {@link #CONSTELLATION_UNDEFINED}. 610 */ 611 @NonNull setConstellation(@onstellation int constellation)612 public Builder setConstellation(@Constellation int constellation) { 613 if (!isExtendedConstellation(constellation) 614 || TunerVersionChecker.checkHigherOrEqualVersionTo( 615 TunerVersionChecker.TUNER_VERSION_1_1, "set Constellation Ext")) { 616 mConstellation = constellation; 617 } 618 return this; 619 } 620 /** 621 * Sets Hierarchy. 622 * 623 * <p>Default value is {@link #HIERARCHY_UNDEFINED}. 624 */ 625 @NonNull setHierarchy(@ierarchy int hierarchy)626 public Builder setHierarchy(@Hierarchy int hierarchy) { 627 mHierarchy = hierarchy; 628 return this; 629 } 630 /** 631 * Sets Code Rate for High Priority level. 632 * 633 * <p>Default value is {@link #CODERATE_UNDEFINED}. 634 */ 635 @NonNull setHighPriorityCodeRate(@odeRate int hpCodeRate)636 public Builder setHighPriorityCodeRate(@CodeRate int hpCodeRate) { 637 mHpCodeRate = hpCodeRate; 638 return this; 639 } 640 /** 641 * Sets Code Rate for Low Priority level. 642 * 643 * <p>Default value is {@link #CODERATE_UNDEFINED}. 644 */ 645 @NonNull setLowPriorityCodeRate(@odeRate int lpCodeRate)646 public Builder setLowPriorityCodeRate(@CodeRate int lpCodeRate) { 647 mLpCodeRate = lpCodeRate; 648 return this; 649 } 650 /** 651 * Sets Guard Interval. 652 * 653 * <p>Default value is {@link #GUARD_INTERVAL_UNDEFINED}. 654 */ 655 @NonNull setGuardInterval(@uardInterval int guardInterval)656 public Builder setGuardInterval(@GuardInterval int guardInterval) { 657 mGuardInterval = guardInterval; 658 return this; 659 } 660 /** 661 * Sets whether it's high priority. 662 * 663 * <p>Default value is {@code false}. 664 */ 665 @NonNull setHighPriority(boolean isHighPriority)666 public Builder setHighPriority(boolean isHighPriority) { 667 mIsHighPriority = isHighPriority; 668 return this; 669 } 670 /** 671 * Sets Standard. 672 * 673 * <p>Default value is {@link #STANDARD_AUTO}. 674 */ 675 @NonNull setStandard(@tandard int standard)676 public Builder setStandard(@Standard int standard) { 677 mStandard = standard; 678 return this; 679 } 680 /** 681 * Sets whether it's MISO. 682 * 683 * <p>Default value is {@code false}. 684 */ 685 @NonNull setMiso(boolean isMiso)686 public Builder setMiso(boolean isMiso) { 687 mIsMiso = isMiso; 688 return this; 689 } 690 /** 691 * Sets Physical Layer Pipe (PLP) Mode. 692 * 693 * <p>Default value is {@link #PLP_MODE_UNDEFINED}. 694 */ 695 @NonNull setPlpMode(@lpMode int plpMode)696 public Builder setPlpMode(@PlpMode int plpMode) { 697 mPlpMode = plpMode; 698 return this; 699 } 700 /** 701 * Sets Physical Layer Pipe (PLP) ID. 702 * 703 * <p>Default value is 0. 704 */ 705 @NonNull setPlpId(int plpId)706 public Builder setPlpId(int plpId) { 707 mPlpId = plpId; 708 return this; 709 } 710 /** 711 * Sets Physical Layer Pipe (PLP) group ID. 712 * 713 * <p>Default value is 0. 714 */ 715 @NonNull setPlpGroupId(int plpGroupId)716 public Builder setPlpGroupId(int plpGroupId) { 717 mPlpGroupId = plpGroupId; 718 return this; 719 } 720 721 /** 722 * Builds a {@link DvbtFrontendSettings} object. 723 */ 724 @NonNull build()725 public DvbtFrontendSettings build() { 726 return new DvbtFrontendSettings(mFrequency, mTransmissionMode, mBandwidth, 727 mConstellation, mHierarchy, mHpCodeRate, mLpCodeRate, mGuardInterval, 728 mIsHighPriority, mStandard, mIsMiso, mPlpMode, mPlpId, mPlpGroupId); 729 } 730 } 731 732 @Override getType()733 public int getType() { 734 return FrontendSettings.TYPE_DVBT; 735 } 736 } 737