001/* 002 * Copyright (C) Cross The Road Electronics. All rights reserved. 003 * License information can be found in CTRE_LICENSE.txt 004 * For support and suggestions contact support@ctr-electronics.com or file 005 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases 006 */ 007package com.ctre.phoenixpro.configs; 008 009import com.ctre.phoenixpro.StatusCode; 010import com.ctre.phoenixpro.hardware.DeviceIdentifier; 011import com.ctre.phoenixpro.configs.jni.ConfigJNI; 012 013/** 014 * Class description for the Talon FX integrated motor controller that runs on 015 * associated Falcon motors. 016 * 017 * This handles the configurations for the {@link com.ctre.phoenixpro.hardware.TalonFX} 018 */ 019public class TalonFXConfigurator extends ParentConfigurator 020{ 021 public TalonFXConfigurator (DeviceIdentifier id) 022 { 023 super(id); 024 } 025 026 /** 027 * Refreshes the values of the specified config group. 028 * <p> 029 * This will wait up to {@link #defaultTimeoutSeconds}. 030 * <p> 031 * Call to refresh the selected configs from the device. 032 * 033 * @param configs The configs to refresh 034 * @return StatusCode of refreshing the configs 035 */ 036 public StatusCode refresh(TalonFXConfiguration configs) 037 { 038 return refresh(configs, defaultTimeoutSeconds); 039 } 040 041 /** 042 * Refreshes the values of the specified config group. 043 * <p> 044 * Call to refresh the selected configs from the device. 045 * 046 * @param configs The configs to refresh 047 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 048 * @return StatusCode of refreshing the configs 049 */ 050 public StatusCode refresh(TalonFXConfiguration configs, double timeoutSeconds) 051 { 052 StringBuilder serializedString = new StringBuilder(); 053 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 054 if (err == StatusCode.OK) { 055 /* Only deserialize if we successfully got configs */ 056 configs.deserialize(serializedString.toString()); 057 } 058 return err; 059 } 060 061 /** 062 * Applies the contents of the specified config to the device. 063 * <p> 064 * This will wait up to {@link #defaultTimeoutSeconds}. 065 * <p> 066 * Call to apply the selected configs. 067 * 068 * @param configs Configs to apply against. 069 * @return StatusCode of the set command 070 */ 071 public StatusCode apply(TalonFXConfiguration configs) 072 { 073 return apply(configs, defaultTimeoutSeconds); 074 } 075 076 /** 077 * Applies the contents of the specified config to the device. 078 * <p> 079 * Call to apply the selected configs. 080 * 081 * @param configs Configs to apply against. 082 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 083 * @return StatusCode of the set command 084 */ 085 public StatusCode apply(TalonFXConfiguration configs, double timeoutSeconds) 086 { 087 return setConfigsPrivate(configs.serialize(), timeoutSeconds, configs.FutureProofConfigs, false); 088 } 089 090 091 /** 092 * Refreshes the values of the specified config group. 093 * <p> 094 * This will wait up to {@link #defaultTimeoutSeconds}. 095 * <p> 096 * Call to refresh the selected configs from the device. 097 * 098 * @param configs The configs to refresh 099 * @return StatusCode of refreshing the configs 100 */ 101 public StatusCode refresh(Slot0Configs configs) 102 { 103 return refresh(configs, defaultTimeoutSeconds); 104 } 105 106 /** 107 * Refreshes the values of the specified config group. 108 * <p> 109 * Call to refresh the selected configs from the device. 110 * 111 * @param configs The configs to refresh 112 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 113 * @return StatusCode of refreshing the configs 114 */ 115 public StatusCode refresh(Slot0Configs configs, double timeoutSeconds) 116 { 117 StringBuilder serializedString = new StringBuilder(); 118 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 119 if (err == StatusCode.OK) { 120 /* Only deserialize if we successfully got configs */ 121 configs.deserialize(serializedString.toString()); 122 } 123 return err; 124 } 125 126 /** 127 * Applies the contents of the specified config to the device. 128 * <p> 129 * This will wait up to {@link #defaultTimeoutSeconds}. 130 * <p> 131 * Call to apply the selected configs. 132 * 133 * @param configs Configs to apply against. 134 * @return StatusCode of the set command 135 */ 136 public StatusCode apply(Slot0Configs configs) 137 { 138 return apply(configs, defaultTimeoutSeconds); 139 } 140 141 /** 142 * Applies the contents of the specified config to the device. 143 * <p> 144 * Call to apply the selected configs. 145 * 146 * @param configs Configs to apply against. 147 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 148 * @return StatusCode of the set command 149 */ 150 public StatusCode apply(Slot0Configs configs, double timeoutSeconds) 151 { 152 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 153 } 154 155 156 /** 157 * Refreshes the values of the specified config group. 158 * <p> 159 * This will wait up to {@link #defaultTimeoutSeconds}. 160 * <p> 161 * Call to refresh the selected configs from the device. 162 * 163 * @param configs The configs to refresh 164 * @return StatusCode of refreshing the configs 165 */ 166 public StatusCode refresh(Slot1Configs configs) 167 { 168 return refresh(configs, defaultTimeoutSeconds); 169 } 170 171 /** 172 * Refreshes the values of the specified config group. 173 * <p> 174 * Call to refresh the selected configs from the device. 175 * 176 * @param configs The configs to refresh 177 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 178 * @return StatusCode of refreshing the configs 179 */ 180 public StatusCode refresh(Slot1Configs configs, double timeoutSeconds) 181 { 182 StringBuilder serializedString = new StringBuilder(); 183 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 184 if (err == StatusCode.OK) { 185 /* Only deserialize if we successfully got configs */ 186 configs.deserialize(serializedString.toString()); 187 } 188 return err; 189 } 190 191 /** 192 * Applies the contents of the specified config to the device. 193 * <p> 194 * This will wait up to {@link #defaultTimeoutSeconds}. 195 * <p> 196 * Call to apply the selected configs. 197 * 198 * @param configs Configs to apply against. 199 * @return StatusCode of the set command 200 */ 201 public StatusCode apply(Slot1Configs configs) 202 { 203 return apply(configs, defaultTimeoutSeconds); 204 } 205 206 /** 207 * Applies the contents of the specified config to the device. 208 * <p> 209 * Call to apply the selected configs. 210 * 211 * @param configs Configs to apply against. 212 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 213 * @return StatusCode of the set command 214 */ 215 public StatusCode apply(Slot1Configs configs, double timeoutSeconds) 216 { 217 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 218 } 219 220 221 /** 222 * Refreshes the values of the specified config group. 223 * <p> 224 * This will wait up to {@link #defaultTimeoutSeconds}. 225 * <p> 226 * Call to refresh the selected configs from the device. 227 * 228 * @param configs The configs to refresh 229 * @return StatusCode of refreshing the configs 230 */ 231 public StatusCode refresh(Slot2Configs configs) 232 { 233 return refresh(configs, defaultTimeoutSeconds); 234 } 235 236 /** 237 * Refreshes the values of the specified config group. 238 * <p> 239 * Call to refresh the selected configs from the device. 240 * 241 * @param configs The configs to refresh 242 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 243 * @return StatusCode of refreshing the configs 244 */ 245 public StatusCode refresh(Slot2Configs configs, double timeoutSeconds) 246 { 247 StringBuilder serializedString = new StringBuilder(); 248 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 249 if (err == StatusCode.OK) { 250 /* Only deserialize if we successfully got configs */ 251 configs.deserialize(serializedString.toString()); 252 } 253 return err; 254 } 255 256 /** 257 * Applies the contents of the specified config to the device. 258 * <p> 259 * This will wait up to {@link #defaultTimeoutSeconds}. 260 * <p> 261 * Call to apply the selected configs. 262 * 263 * @param configs Configs to apply against. 264 * @return StatusCode of the set command 265 */ 266 public StatusCode apply(Slot2Configs configs) 267 { 268 return apply(configs, defaultTimeoutSeconds); 269 } 270 271 /** 272 * Applies the contents of the specified config to the device. 273 * <p> 274 * Call to apply the selected configs. 275 * 276 * @param configs Configs to apply against. 277 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 278 * @return StatusCode of the set command 279 */ 280 public StatusCode apply(Slot2Configs configs, double timeoutSeconds) 281 { 282 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 283 } 284 285 286 /** 287 * Refreshes the values of the specified config group. 288 * <p> 289 * This will wait up to {@link #defaultTimeoutSeconds}. 290 * <p> 291 * Call to refresh the selected configs from the device. 292 * 293 * @param configs The configs to refresh 294 * @return StatusCode of refreshing the configs 295 */ 296 public StatusCode refresh(MotorOutputConfigs configs) 297 { 298 return refresh(configs, defaultTimeoutSeconds); 299 } 300 301 /** 302 * Refreshes the values of the specified config group. 303 * <p> 304 * Call to refresh the selected configs from the device. 305 * 306 * @param configs The configs to refresh 307 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 308 * @return StatusCode of refreshing the configs 309 */ 310 public StatusCode refresh(MotorOutputConfigs configs, double timeoutSeconds) 311 { 312 StringBuilder serializedString = new StringBuilder(); 313 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 314 if (err == StatusCode.OK) { 315 /* Only deserialize if we successfully got configs */ 316 configs.deserialize(serializedString.toString()); 317 } 318 return err; 319 } 320 321 /** 322 * Applies the contents of the specified config to the device. 323 * <p> 324 * This will wait up to {@link #defaultTimeoutSeconds}. 325 * <p> 326 * Call to apply the selected configs. 327 * 328 * @param configs Configs to apply against. 329 * @return StatusCode of the set command 330 */ 331 public StatusCode apply(MotorOutputConfigs configs) 332 { 333 return apply(configs, defaultTimeoutSeconds); 334 } 335 336 /** 337 * Applies the contents of the specified config to the device. 338 * <p> 339 * Call to apply the selected configs. 340 * 341 * @param configs Configs to apply against. 342 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 343 * @return StatusCode of the set command 344 */ 345 public StatusCode apply(MotorOutputConfigs configs, double timeoutSeconds) 346 { 347 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 348 } 349 350 351 /** 352 * Refreshes the values of the specified config group. 353 * <p> 354 * This will wait up to {@link #defaultTimeoutSeconds}. 355 * <p> 356 * Call to refresh the selected configs from the device. 357 * 358 * @param configs The configs to refresh 359 * @return StatusCode of refreshing the configs 360 */ 361 public StatusCode refresh(CurrentLimitsConfigs configs) 362 { 363 return refresh(configs, defaultTimeoutSeconds); 364 } 365 366 /** 367 * Refreshes the values of the specified config group. 368 * <p> 369 * Call to refresh the selected configs from the device. 370 * 371 * @param configs The configs to refresh 372 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 373 * @return StatusCode of refreshing the configs 374 */ 375 public StatusCode refresh(CurrentLimitsConfigs configs, double timeoutSeconds) 376 { 377 StringBuilder serializedString = new StringBuilder(); 378 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 379 if (err == StatusCode.OK) { 380 /* Only deserialize if we successfully got configs */ 381 configs.deserialize(serializedString.toString()); 382 } 383 return err; 384 } 385 386 /** 387 * Applies the contents of the specified config to the device. 388 * <p> 389 * This will wait up to {@link #defaultTimeoutSeconds}. 390 * <p> 391 * Call to apply the selected configs. 392 * 393 * @param configs Configs to apply against. 394 * @return StatusCode of the set command 395 */ 396 public StatusCode apply(CurrentLimitsConfigs configs) 397 { 398 return apply(configs, defaultTimeoutSeconds); 399 } 400 401 /** 402 * Applies the contents of the specified config to the device. 403 * <p> 404 * Call to apply the selected configs. 405 * 406 * @param configs Configs to apply against. 407 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 408 * @return StatusCode of the set command 409 */ 410 public StatusCode apply(CurrentLimitsConfigs configs, double timeoutSeconds) 411 { 412 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 413 } 414 415 416 /** 417 * Refreshes the values of the specified config group. 418 * <p> 419 * This will wait up to {@link #defaultTimeoutSeconds}. 420 * <p> 421 * Call to refresh the selected configs from the device. 422 * 423 * @param configs The configs to refresh 424 * @return StatusCode of refreshing the configs 425 */ 426 public StatusCode refresh(VoltageConfigs configs) 427 { 428 return refresh(configs, defaultTimeoutSeconds); 429 } 430 431 /** 432 * Refreshes the values of the specified config group. 433 * <p> 434 * Call to refresh the selected configs from the device. 435 * 436 * @param configs The configs to refresh 437 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 438 * @return StatusCode of refreshing the configs 439 */ 440 public StatusCode refresh(VoltageConfigs configs, double timeoutSeconds) 441 { 442 StringBuilder serializedString = new StringBuilder(); 443 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 444 if (err == StatusCode.OK) { 445 /* Only deserialize if we successfully got configs */ 446 configs.deserialize(serializedString.toString()); 447 } 448 return err; 449 } 450 451 /** 452 * Applies the contents of the specified config to the device. 453 * <p> 454 * This will wait up to {@link #defaultTimeoutSeconds}. 455 * <p> 456 * Call to apply the selected configs. 457 * 458 * @param configs Configs to apply against. 459 * @return StatusCode of the set command 460 */ 461 public StatusCode apply(VoltageConfigs configs) 462 { 463 return apply(configs, defaultTimeoutSeconds); 464 } 465 466 /** 467 * Applies the contents of the specified config to the device. 468 * <p> 469 * Call to apply the selected configs. 470 * 471 * @param configs Configs to apply against. 472 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 473 * @return StatusCode of the set command 474 */ 475 public StatusCode apply(VoltageConfigs configs, double timeoutSeconds) 476 { 477 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 478 } 479 480 481 /** 482 * Refreshes the values of the specified config group. 483 * <p> 484 * This will wait up to {@link #defaultTimeoutSeconds}. 485 * <p> 486 * Call to refresh the selected configs from the device. 487 * 488 * @param configs The configs to refresh 489 * @return StatusCode of refreshing the configs 490 */ 491 public StatusCode refresh(TorqueCurrentConfigs configs) 492 { 493 return refresh(configs, defaultTimeoutSeconds); 494 } 495 496 /** 497 * Refreshes the values of the specified config group. 498 * <p> 499 * Call to refresh the selected configs from the device. 500 * 501 * @param configs The configs to refresh 502 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 503 * @return StatusCode of refreshing the configs 504 */ 505 public StatusCode refresh(TorqueCurrentConfigs configs, double timeoutSeconds) 506 { 507 StringBuilder serializedString = new StringBuilder(); 508 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 509 if (err == StatusCode.OK) { 510 /* Only deserialize if we successfully got configs */ 511 configs.deserialize(serializedString.toString()); 512 } 513 return err; 514 } 515 516 /** 517 * Applies the contents of the specified config to the device. 518 * <p> 519 * This will wait up to {@link #defaultTimeoutSeconds}. 520 * <p> 521 * Call to apply the selected configs. 522 * 523 * @param configs Configs to apply against. 524 * @return StatusCode of the set command 525 */ 526 public StatusCode apply(TorqueCurrentConfigs configs) 527 { 528 return apply(configs, defaultTimeoutSeconds); 529 } 530 531 /** 532 * Applies the contents of the specified config to the device. 533 * <p> 534 * Call to apply the selected configs. 535 * 536 * @param configs Configs to apply against. 537 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 538 * @return StatusCode of the set command 539 */ 540 public StatusCode apply(TorqueCurrentConfigs configs, double timeoutSeconds) 541 { 542 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 543 } 544 545 546 /** 547 * Refreshes the values of the specified config group. 548 * <p> 549 * This will wait up to {@link #defaultTimeoutSeconds}. 550 * <p> 551 * Call to refresh the selected configs from the device. 552 * 553 * @param configs The configs to refresh 554 * @return StatusCode of refreshing the configs 555 */ 556 public StatusCode refresh(FeedbackConfigs configs) 557 { 558 return refresh(configs, defaultTimeoutSeconds); 559 } 560 561 /** 562 * Refreshes the values of the specified config group. 563 * <p> 564 * Call to refresh the selected configs from the device. 565 * 566 * @param configs The configs to refresh 567 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 568 * @return StatusCode of refreshing the configs 569 */ 570 public StatusCode refresh(FeedbackConfigs configs, double timeoutSeconds) 571 { 572 StringBuilder serializedString = new StringBuilder(); 573 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 574 if (err == StatusCode.OK) { 575 /* Only deserialize if we successfully got configs */ 576 configs.deserialize(serializedString.toString()); 577 } 578 return err; 579 } 580 581 /** 582 * Applies the contents of the specified config to the device. 583 * <p> 584 * This will wait up to {@link #defaultTimeoutSeconds}. 585 * <p> 586 * Call to apply the selected configs. 587 * 588 * @param configs Configs to apply against. 589 * @return StatusCode of the set command 590 */ 591 public StatusCode apply(FeedbackConfigs configs) 592 { 593 return apply(configs, defaultTimeoutSeconds); 594 } 595 596 /** 597 * Applies the contents of the specified config to the device. 598 * <p> 599 * Call to apply the selected configs. 600 * 601 * @param configs Configs to apply against. 602 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 603 * @return StatusCode of the set command 604 */ 605 public StatusCode apply(FeedbackConfigs configs, double timeoutSeconds) 606 { 607 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 608 } 609 610 611 /** 612 * Refreshes the values of the specified config group. 613 * <p> 614 * This will wait up to {@link #defaultTimeoutSeconds}. 615 * <p> 616 * Call to refresh the selected configs from the device. 617 * 618 * @param configs The configs to refresh 619 * @return StatusCode of refreshing the configs 620 */ 621 public StatusCode refresh(OpenLoopRampsConfigs configs) 622 { 623 return refresh(configs, defaultTimeoutSeconds); 624 } 625 626 /** 627 * Refreshes the values of the specified config group. 628 * <p> 629 * Call to refresh the selected configs from the device. 630 * 631 * @param configs The configs to refresh 632 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 633 * @return StatusCode of refreshing the configs 634 */ 635 public StatusCode refresh(OpenLoopRampsConfigs configs, double timeoutSeconds) 636 { 637 StringBuilder serializedString = new StringBuilder(); 638 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 639 if (err == StatusCode.OK) { 640 /* Only deserialize if we successfully got configs */ 641 configs.deserialize(serializedString.toString()); 642 } 643 return err; 644 } 645 646 /** 647 * Applies the contents of the specified config to the device. 648 * <p> 649 * This will wait up to {@link #defaultTimeoutSeconds}. 650 * <p> 651 * Call to apply the selected configs. 652 * 653 * @param configs Configs to apply against. 654 * @return StatusCode of the set command 655 */ 656 public StatusCode apply(OpenLoopRampsConfigs configs) 657 { 658 return apply(configs, defaultTimeoutSeconds); 659 } 660 661 /** 662 * Applies the contents of the specified config to the device. 663 * <p> 664 * Call to apply the selected configs. 665 * 666 * @param configs Configs to apply against. 667 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 668 * @return StatusCode of the set command 669 */ 670 public StatusCode apply(OpenLoopRampsConfigs configs, double timeoutSeconds) 671 { 672 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 673 } 674 675 676 /** 677 * Refreshes the values of the specified config group. 678 * <p> 679 * This will wait up to {@link #defaultTimeoutSeconds}. 680 * <p> 681 * Call to refresh the selected configs from the device. 682 * 683 * @param configs The configs to refresh 684 * @return StatusCode of refreshing the configs 685 */ 686 public StatusCode refresh(ClosedLoopRampsConfigs configs) 687 { 688 return refresh(configs, defaultTimeoutSeconds); 689 } 690 691 /** 692 * Refreshes the values of the specified config group. 693 * <p> 694 * Call to refresh the selected configs from the device. 695 * 696 * @param configs The configs to refresh 697 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 698 * @return StatusCode of refreshing the configs 699 */ 700 public StatusCode refresh(ClosedLoopRampsConfigs configs, double timeoutSeconds) 701 { 702 StringBuilder serializedString = new StringBuilder(); 703 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 704 if (err == StatusCode.OK) { 705 /* Only deserialize if we successfully got configs */ 706 configs.deserialize(serializedString.toString()); 707 } 708 return err; 709 } 710 711 /** 712 * Applies the contents of the specified config to the device. 713 * <p> 714 * This will wait up to {@link #defaultTimeoutSeconds}. 715 * <p> 716 * Call to apply the selected configs. 717 * 718 * @param configs Configs to apply against. 719 * @return StatusCode of the set command 720 */ 721 public StatusCode apply(ClosedLoopRampsConfigs configs) 722 { 723 return apply(configs, defaultTimeoutSeconds); 724 } 725 726 /** 727 * Applies the contents of the specified config to the device. 728 * <p> 729 * Call to apply the selected configs. 730 * 731 * @param configs Configs to apply against. 732 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 733 * @return StatusCode of the set command 734 */ 735 public StatusCode apply(ClosedLoopRampsConfigs configs, double timeoutSeconds) 736 { 737 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 738 } 739 740 741 /** 742 * Refreshes the values of the specified config group. 743 * <p> 744 * This will wait up to {@link #defaultTimeoutSeconds}. 745 * <p> 746 * Call to refresh the selected configs from the device. 747 * 748 * @param configs The configs to refresh 749 * @return StatusCode of refreshing the configs 750 */ 751 public StatusCode refresh(HardwareLimitSwitchConfigs configs) 752 { 753 return refresh(configs, defaultTimeoutSeconds); 754 } 755 756 /** 757 * Refreshes the values of the specified config group. 758 * <p> 759 * Call to refresh the selected configs from the device. 760 * 761 * @param configs The configs to refresh 762 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 763 * @return StatusCode of refreshing the configs 764 */ 765 public StatusCode refresh(HardwareLimitSwitchConfigs configs, double timeoutSeconds) 766 { 767 StringBuilder serializedString = new StringBuilder(); 768 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 769 if (err == StatusCode.OK) { 770 /* Only deserialize if we successfully got configs */ 771 configs.deserialize(serializedString.toString()); 772 } 773 return err; 774 } 775 776 /** 777 * Applies the contents of the specified config to the device. 778 * <p> 779 * This will wait up to {@link #defaultTimeoutSeconds}. 780 * <p> 781 * Call to apply the selected configs. 782 * 783 * @param configs Configs to apply against. 784 * @return StatusCode of the set command 785 */ 786 public StatusCode apply(HardwareLimitSwitchConfigs configs) 787 { 788 return apply(configs, defaultTimeoutSeconds); 789 } 790 791 /** 792 * Applies the contents of the specified config to the device. 793 * <p> 794 * Call to apply the selected configs. 795 * 796 * @param configs Configs to apply against. 797 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 798 * @return StatusCode of the set command 799 */ 800 public StatusCode apply(HardwareLimitSwitchConfigs configs, double timeoutSeconds) 801 { 802 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 803 } 804 805 806 /** 807 * Refreshes the values of the specified config group. 808 * <p> 809 * This will wait up to {@link #defaultTimeoutSeconds}. 810 * <p> 811 * Call to refresh the selected configs from the device. 812 * 813 * @param configs The configs to refresh 814 * @return StatusCode of refreshing the configs 815 */ 816 public StatusCode refresh(AudioConfigs configs) 817 { 818 return refresh(configs, defaultTimeoutSeconds); 819 } 820 821 /** 822 * Refreshes the values of the specified config group. 823 * <p> 824 * Call to refresh the selected configs from the device. 825 * 826 * @param configs The configs to refresh 827 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 828 * @return StatusCode of refreshing the configs 829 */ 830 public StatusCode refresh(AudioConfigs configs, double timeoutSeconds) 831 { 832 StringBuilder serializedString = new StringBuilder(); 833 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 834 if (err == StatusCode.OK) { 835 /* Only deserialize if we successfully got configs */ 836 configs.deserialize(serializedString.toString()); 837 } 838 return err; 839 } 840 841 /** 842 * Applies the contents of the specified config to the device. 843 * <p> 844 * This will wait up to {@link #defaultTimeoutSeconds}. 845 * <p> 846 * Call to apply the selected configs. 847 * 848 * @param configs Configs to apply against. 849 * @return StatusCode of the set command 850 */ 851 public StatusCode apply(AudioConfigs configs) 852 { 853 return apply(configs, defaultTimeoutSeconds); 854 } 855 856 /** 857 * Applies the contents of the specified config to the device. 858 * <p> 859 * Call to apply the selected configs. 860 * 861 * @param configs Configs to apply against. 862 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 863 * @return StatusCode of the set command 864 */ 865 public StatusCode apply(AudioConfigs configs, double timeoutSeconds) 866 { 867 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 868 } 869 870 871 /** 872 * Refreshes the values of the specified config group. 873 * <p> 874 * This will wait up to {@link #defaultTimeoutSeconds}. 875 * <p> 876 * Call to refresh the selected configs from the device. 877 * 878 * @param configs The configs to refresh 879 * @return StatusCode of refreshing the configs 880 */ 881 public StatusCode refresh(SoftwareLimitSwitchConfigs configs) 882 { 883 return refresh(configs, defaultTimeoutSeconds); 884 } 885 886 /** 887 * Refreshes the values of the specified config group. 888 * <p> 889 * Call to refresh the selected configs from the device. 890 * 891 * @param configs The configs to refresh 892 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 893 * @return StatusCode of refreshing the configs 894 */ 895 public StatusCode refresh(SoftwareLimitSwitchConfigs configs, double timeoutSeconds) 896 { 897 StringBuilder serializedString = new StringBuilder(); 898 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 899 if (err == StatusCode.OK) { 900 /* Only deserialize if we successfully got configs */ 901 configs.deserialize(serializedString.toString()); 902 } 903 return err; 904 } 905 906 /** 907 * Applies the contents of the specified config to the device. 908 * <p> 909 * This will wait up to {@link #defaultTimeoutSeconds}. 910 * <p> 911 * Call to apply the selected configs. 912 * 913 * @param configs Configs to apply against. 914 * @return StatusCode of the set command 915 */ 916 public StatusCode apply(SoftwareLimitSwitchConfigs configs) 917 { 918 return apply(configs, defaultTimeoutSeconds); 919 } 920 921 /** 922 * Applies the contents of the specified config to the device. 923 * <p> 924 * Call to apply the selected configs. 925 * 926 * @param configs Configs to apply against. 927 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 928 * @return StatusCode of the set command 929 */ 930 public StatusCode apply(SoftwareLimitSwitchConfigs configs, double timeoutSeconds) 931 { 932 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 933 } 934 935 936 /** 937 * Refreshes the values of the specified config group. 938 * <p> 939 * This will wait up to {@link #defaultTimeoutSeconds}. 940 * <p> 941 * Call to refresh the selected configs from the device. 942 * 943 * @param configs The configs to refresh 944 * @return StatusCode of refreshing the configs 945 */ 946 public StatusCode refresh(MotionMagicConfigs configs) 947 { 948 return refresh(configs, defaultTimeoutSeconds); 949 } 950 951 /** 952 * Refreshes the values of the specified config group. 953 * <p> 954 * Call to refresh the selected configs from the device. 955 * 956 * @param configs The configs to refresh 957 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 958 * @return StatusCode of refreshing the configs 959 */ 960 public StatusCode refresh(MotionMagicConfigs configs, double timeoutSeconds) 961 { 962 StringBuilder serializedString = new StringBuilder(); 963 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 964 if (err == StatusCode.OK) { 965 /* Only deserialize if we successfully got configs */ 966 configs.deserialize(serializedString.toString()); 967 } 968 return err; 969 } 970 971 /** 972 * Applies the contents of the specified config to the device. 973 * <p> 974 * This will wait up to {@link #defaultTimeoutSeconds}. 975 * <p> 976 * Call to apply the selected configs. 977 * 978 * @param configs Configs to apply against. 979 * @return StatusCode of the set command 980 */ 981 public StatusCode apply(MotionMagicConfigs configs) 982 { 983 return apply(configs, defaultTimeoutSeconds); 984 } 985 986 /** 987 * Applies the contents of the specified config to the device. 988 * <p> 989 * Call to apply the selected configs. 990 * 991 * @param configs Configs to apply against. 992 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 993 * @return StatusCode of the set command 994 */ 995 public StatusCode apply(MotionMagicConfigs configs, double timeoutSeconds) 996 { 997 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 998 } 999 1000 1001 /** 1002 * Refreshes the values of the specified config group. 1003 * <p> 1004 * This will wait up to {@link #defaultTimeoutSeconds}. 1005 * <p> 1006 * Call to refresh the selected configs from the device. 1007 * 1008 * @param configs The configs to refresh 1009 * @return StatusCode of refreshing the configs 1010 */ 1011 public StatusCode refresh(CustomParamsConfigs configs) 1012 { 1013 return refresh(configs, defaultTimeoutSeconds); 1014 } 1015 1016 /** 1017 * Refreshes the values of the specified config group. 1018 * <p> 1019 * Call to refresh the selected configs from the device. 1020 * 1021 * @param configs The configs to refresh 1022 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 1023 * @return StatusCode of refreshing the configs 1024 */ 1025 public StatusCode refresh(CustomParamsConfigs configs, double timeoutSeconds) 1026 { 1027 StringBuilder serializedString = new StringBuilder(); 1028 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 1029 if (err == StatusCode.OK) { 1030 /* Only deserialize if we successfully got configs */ 1031 configs.deserialize(serializedString.toString()); 1032 } 1033 return err; 1034 } 1035 1036 /** 1037 * Applies the contents of the specified config to the device. 1038 * <p> 1039 * This will wait up to {@link #defaultTimeoutSeconds}. 1040 * <p> 1041 * Call to apply the selected configs. 1042 * 1043 * @param configs Configs to apply against. 1044 * @return StatusCode of the set command 1045 */ 1046 public StatusCode apply(CustomParamsConfigs configs) 1047 { 1048 return apply(configs, defaultTimeoutSeconds); 1049 } 1050 1051 /** 1052 * Applies the contents of the specified config to the device. 1053 * <p> 1054 * Call to apply the selected configs. 1055 * 1056 * @param configs Configs to apply against. 1057 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 1058 * @return StatusCode of the set command 1059 */ 1060 public StatusCode apply(CustomParamsConfigs configs, double timeoutSeconds) 1061 { 1062 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 1063 } 1064 1065 1066 /** 1067 * Refreshes the values of the specified config group. 1068 * <p> 1069 * This will wait up to {@link #defaultTimeoutSeconds}. 1070 * <p> 1071 * Call to refresh the selected configs from the device. 1072 * 1073 * @param configs The configs to refresh 1074 * @return StatusCode of refreshing the configs 1075 */ 1076 public StatusCode refresh(ClosedLoopGeneralConfigs configs) 1077 { 1078 return refresh(configs, defaultTimeoutSeconds); 1079 } 1080 1081 /** 1082 * Refreshes the values of the specified config group. 1083 * <p> 1084 * Call to refresh the selected configs from the device. 1085 * 1086 * @param configs The configs to refresh 1087 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 1088 * @return StatusCode of refreshing the configs 1089 */ 1090 public StatusCode refresh(ClosedLoopGeneralConfigs configs, double timeoutSeconds) 1091 { 1092 StringBuilder serializedString = new StringBuilder(); 1093 StatusCode err = getConfigsPrivate(serializedString, timeoutSeconds); 1094 if (err == StatusCode.OK) { 1095 /* Only deserialize if we successfully got configs */ 1096 configs.deserialize(serializedString.toString()); 1097 } 1098 return err; 1099 } 1100 1101 /** 1102 * Applies the contents of the specified config to the device. 1103 * <p> 1104 * This will wait up to {@link #defaultTimeoutSeconds}. 1105 * <p> 1106 * Call to apply the selected configs. 1107 * 1108 * @param configs Configs to apply against. 1109 * @return StatusCode of the set command 1110 */ 1111 public StatusCode apply(ClosedLoopGeneralConfigs configs) 1112 { 1113 return apply(configs, defaultTimeoutSeconds); 1114 } 1115 1116 /** 1117 * Applies the contents of the specified config to the device. 1118 * <p> 1119 * Call to apply the selected configs. 1120 * 1121 * @param configs Configs to apply against. 1122 * @param timeoutSeconds Maximum amount of time to wait when performing configuration 1123 * @return StatusCode of the set command 1124 */ 1125 public StatusCode apply(ClosedLoopGeneralConfigs configs, double timeoutSeconds) 1126 { 1127 return setConfigsPrivate(configs.serialize(), timeoutSeconds, false, false); 1128 } 1129 1130 1131 /** 1132 * The position to set the rotor position to right now. 1133 * <p> 1134 * This will wait up to {@link #defaultTimeoutSeconds}. 1135 * <p> 1136 * This is available in the configurator in case the user wants 1137 * to initialize their device entirely without passing a device 1138 * reference down to the code that performs the initialization. 1139 * In this case, the user passes down the configurator object 1140 * and performs all the initialization code on the object. 1141 * 1142 * @param newValue Value to set to. 1143 * @return StatusCode of the set command 1144 */ 1145 public StatusCode setRotorPosition(double newValue) { 1146 return setRotorPosition(newValue, defaultTimeoutSeconds); 1147 } 1148 /** 1149 * The position to set the rotor position to right now. 1150 * <p> 1151 * This is available in the configurator in case the user wants 1152 * to initialize their device entirely without passing a device 1153 * reference down to the code that performs the initialization. 1154 * In this case, the user passes down the configurator object 1155 * and performs all the initialization code on the object. 1156 * 1157 * @param newValue Value to set to. 1158 * @param timeoutSeconds Maximum time to wait up to in seconds. 1159 * @return StatusCode of the set command 1160 */ 1161 public StatusCode setRotorPosition(double newValue, double timeoutSeconds) { 1162 String serialized = ConfigJNI.Serializedouble(1008, newValue); 1163 return setConfigsPrivate(serialized, timeoutSeconds, false, true); 1164 } 1165 1166 /** 1167 * Clear the sticky faults in the device. 1168 * <p> 1169 * This typically has no impact on the device functionality. Instead, 1170 * it just clears telemetry faults that are accessible via API and 1171 * Tuner Self-Test. 1172 * <p> 1173 * This will wait up to {@link #defaultTimeoutSeconds}. 1174 * <p> 1175 * This is available in the configurator in case the user wants 1176 * to initialize their device entirely without passing a device 1177 * reference down to the code that performs the initialization. 1178 * In this case, the user passes down the configurator object 1179 * and performs all the initialization code on the object. 1180 * @return StatusCode of the set command 1181 */ 1182 public StatusCode clearStickyFaults() { 1183 return clearStickyFaults(defaultTimeoutSeconds); 1184 } 1185 /** 1186 * Clear the sticky faults in the device. 1187 * <p> 1188 * This typically has no impact on the device functionality. Instead, 1189 * it just clears telemetry faults that are accessible via API and 1190 * Tuner Self-Test. 1191 * <p> 1192 * This is available in the configurator in case the user wants 1193 * to initialize their device entirely without passing a device 1194 * reference down to the code that performs the initialization. 1195 * In this case, the user passes down the configurator object 1196 * and performs all the initialization code on the object. 1197 * @param timeoutSeconds Maximum time to wait up to in seconds. 1198 * @return StatusCode of the set command 1199 */ 1200 public StatusCode clearStickyFaults(double timeoutSeconds) { 1201 String serialized = ConfigJNI.Serializedouble(1476, 0); 1202 return setConfigsPrivate(serialized, timeoutSeconds, false, true); 1203 } 1204}