Main entry point.
()
| 682 | |
| 683 | |
| 684 | def main(): |
| 685 | """Main entry point.""" |
| 686 | args = parse_args() |
| 687 | |
| 688 | # Set device type globally based on args |
| 689 | if args.device_type == "adb": |
| 690 | device_type = DeviceType.ADB |
| 691 | elif args.device_type == "hdc": |
| 692 | device_type = DeviceType.HDC |
| 693 | else: # ios |
| 694 | device_type = DeviceType.IOS |
| 695 | |
| 696 | # Set device type globally for non-iOS devices |
| 697 | if device_type != DeviceType.IOS: |
| 698 | set_device_type(device_type) |
| 699 | |
| 700 | # Enable HDC verbose mode if using HDC |
| 701 | if device_type == DeviceType.HDC: |
| 702 | from phone_agent.hdc import set_hdc_verbose |
| 703 | |
| 704 | set_hdc_verbose(True) |
| 705 | |
| 706 | # Handle --list-apps (no system check needed) |
| 707 | if args.list_apps: |
| 708 | if device_type == DeviceType.HDC: |
| 709 | print("Supported HarmonyOS apps:") |
| 710 | apps = list_harmonyos_apps() |
| 711 | elif device_type == DeviceType.IOS: |
| 712 | print("Supported iOS apps:") |
| 713 | print("\nNote: For iOS apps, Bundle IDs are configured in:") |
| 714 | print(" phone_agent/config/apps_ios.py") |
| 715 | print("\nCurrently configured apps:") |
| 716 | apps = list_ios_apps() |
| 717 | else: |
| 718 | print("Supported Android apps:") |
| 719 | apps = list_supported_apps() |
| 720 | |
| 721 | for app in sorted(apps): |
| 722 | print(f" - {app}") |
| 723 | |
| 724 | if device_type == DeviceType.IOS: |
| 725 | print( |
| 726 | "\nTo add iOS apps, find the Bundle ID and add to APP_PACKAGES_IOS dictionary." |
| 727 | ) |
| 728 | return |
| 729 | |
| 730 | # Handle device commands (these may need partial system checks) |
| 731 | if handle_device_commands(args): |
| 732 | return |
| 733 | |
| 734 | # Run system requirements check before proceeding |
| 735 | if not check_system_requirements( |
| 736 | device_type, |
| 737 | wda_url=args.wda_url |
| 738 | if device_type == DeviceType.IOS |
| 739 | else "http://localhost:8100", |
| 740 | ): |
| 741 | sys.exit(1) |
no test coverage detected