Skip to content

Commit

Permalink
Add location authorization check
Browse files Browse the repository at this point in the history
This works toward solving: gopro#506
  • Loading branch information
epheo committed Apr 9, 2024
1 parent 936015b commit eeeb132
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,18 @@ def connect(self, ssid: str, password: str, timeout: float = 15) -> bool:
location_manager = CLLocationManager.alloc().init()
location_manager.startUpdatingLocation()

# Get the current authorization status for Python
max_wait = 60
for i in range(1, max_wait):
authorization_status = location_manager.authorizationStatus()
if authorization_status == 3 or authorization_status == 4:
print("Python has been authorized for location services")
break
if i == max_wait-1:
exit("Unable to obtain authorization, exiting")
time.sleep(1)


# Load CoreWLAN framework
objc.loadBundle('CoreWLAN',
bundle_path='/System/Library/Frameworks/CoreWLAN.framework',
Expand Down

0 comments on commit eeeb132

Please sign in to comment.