Detect available tools and hardware using Intercept's utilities.
(self)
| 400 | return shutil.which(tool_name) |
| 401 | |
| 402 | def detect_capabilities(self) -> dict: |
| 403 | """Detect available tools and hardware using Intercept's utilities.""" |
| 404 | if self._capabilities is not None: |
| 405 | return self._capabilities |
| 406 | |
| 407 | capabilities = { |
| 408 | 'modes': {}, |
| 409 | 'devices': [], |
| 410 | 'interfaces': { |
| 411 | 'wifi_interfaces': [], |
| 412 | 'bt_adapters': [], |
| 413 | 'sdr_devices': [], |
| 414 | }, |
| 415 | 'agent_version': AGENT_VERSION, |
| 416 | 'gps': gps_manager.is_running, |
| 417 | 'gps_position': gps_manager.position, |
| 418 | 'tool_details': {}, # Detailed tool status |
| 419 | } |
| 420 | |
| 421 | # Detect interfaces using Intercept's TSCM device detection |
| 422 | self._detect_interfaces(capabilities) |
| 423 | |
| 424 | # Use Intercept's comprehensive dependency checking if available |
| 425 | if HAS_DEPENDENCIES_MODULE: |
| 426 | try: |
| 427 | dep_status = check_all_dependencies() |
| 428 | # Map dependency status to mode availability |
| 429 | mode_mapping = { |
| 430 | 'pager': 'pager', |
| 431 | 'sensor': 'sensor', |
| 432 | 'aircraft': 'adsb', |
| 433 | 'ais': 'ais', |
| 434 | 'acars': 'acars', |
| 435 | 'aprs': 'aprs', |
| 436 | 'wifi': 'wifi', |
| 437 | 'bluetooth': 'bluetooth', |
| 438 | 'tscm': 'tscm', |
| 439 | 'satellite': 'satellite', |
| 440 | } |
| 441 | for dep_mode, cap_mode in mode_mapping.items(): |
| 442 | if dep_mode in dep_status: |
| 443 | mode_info = dep_status[dep_mode] |
| 444 | # Check if mode is enabled in config |
| 445 | if not config.modes_enabled.get(cap_mode, True): |
| 446 | capabilities['modes'][cap_mode] = False |
| 447 | else: |
| 448 | capabilities['modes'][cap_mode] = mode_info['ready'] |
| 449 | # Store detailed tool info |
| 450 | capabilities['tool_details'][cap_mode] = { |
| 451 | 'name': mode_info['name'], |
| 452 | 'ready': mode_info['ready'], |
| 453 | 'missing_required': mode_info['missing_required'], |
| 454 | 'tools': mode_info['tools'], |
| 455 | } |
| 456 | # Handle modes not in dependencies.py |
| 457 | extra_modes = ['dsc', 'rtlamr', 'listening_post'] |
| 458 | extra_tools = { |
| 459 | 'dsc': ['rtl_fm'], |