Skip to content

Commit

Permalink
Python SDK Wifi Fixes and Hero 13 Testing (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw committed Sep 9, 2024
1 parent c48fc01 commit 51777b9
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import sys

try:
import tkinter

import cv2
import PIL

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rich.console import Console

from open_gopro import Params, WirelessGoPro
from open_gopro.demos.gui.components.util import display_video_blocking
from open_gopro.demos.gui.util import display_video_blocking
from open_gopro.logger import setup_logging
from open_gopro.util import add_cli_args_and_parse

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from open_gopro import Params, WiredGoPro, WirelessGoPro
from open_gopro.constants import WebcamError, WebcamStatus
from open_gopro.demos.gui.components.util import display_video_blocking
from open_gopro.demos.gui.util import display_video_blocking
from open_gopro.gopro_base import GoProBase
from open_gopro.logger import setup_logging
from open_gopro.util import add_cli_args_and_parse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,23 +712,11 @@ def connect(self, ssid: str, password: str, timeout: float = 15) -> bool:
discovered = False
while not discovered and (time.time() - start) <= timeout:
# Scan for network
# Surprisingly, yes this is the industry standard location for this and no, there's no shortcut for it
response = cmd(
r"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan"
)
# TODO Sometimes the response is blank?
if not response:
logger.warning("MacOS did not return a response to SSID scanning.")
continue
lines = response.splitlines()
ssid_end_index = lines[0].index("SSID") + 4 # Find where the SSID column ends

for result in lines[1:]: # Skip title row
current_ssid = result[:ssid_end_index].strip()
if current_ssid == ssid.strip():
discovered = True
break
if discovered:
response = cmd(r"/usr/sbin/system_profiler SPAirPortDataType")
regex = re.compile(
r"\n\s+([\x20-\x7E]{1,32}):\n\s+PHY Mode:"
) # 0x20...0x7E --> ASCII for printable characters
if ssid in sorted(regex.findall(response)):
break
time.sleep(1)
else:
Expand Down

0 comments on commit 51777b9

Please sign in to comment.