MCPcopy Create free account
hub / github.com/FastLED/FastLED / connect

Method connect

ci/autoresearch/net.py:56–72  ·  view source on GitHub ↗

Connect the host machine to a WiFi network.

(self, ssid: str, password: str)

Source from the content-addressed store, hash-verified

54 # -- public helpers (shared logic) --
55
56 def connect(self, ssid: str, password: str) -> bool:
57 """Connect the host machine to a WiFi network."""
58 print(f" Connecting host to WiFi '{ssid}' ({self.platform_name})...")
59 try:
60 result = self._run_connect(ssid, password)
61 if result.returncode != 0:
62 print(
63 f" {Fore.RED}Failed to connect: {result.stderr}{Style.RESET_ALL}"
64 )
65 return False
66 print(" Waiting for WiFi connection to establish...")
67 time.sleep(5)
68 print(f" {Fore.GREEN}Connected to '{ssid}'{Style.RESET_ALL}")
69 return True
70 except (subprocess.TimeoutExpired, FileNotFoundError, OSError) as e:
71 print(f" {Fore.RED}WiFi connection error: {e}{Style.RESET_ALL}")
72 return False
73
74 def restore(self, original_ssid: str | None) -> None:
75 """Restore the host's original WiFi connection."""

Callers 3

run_ota_autoresearchFunction · 0.45

Calls 2

_run_connectMethod · 0.95
printFunction · 0.50

Tested by

no test coverage detected