Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import asyncio
import logging
from functools import partial

from returns.pipeline import is_successful
from returns.result import Result
Expand Down Expand Up @@ -58,7 +59,7 @@ async def scan_wifi_networks(self, timeout: int = 60) -> Result[proto.ResponseGe
async with GoproObserverDistinctInitial[ResponseStartScanning, NotifStartScanning](
gopro=self._gopro,
update=ProtobufId(FeatureId.NETWORK_MANAGEMENT, ActionId.NOTIF_START_SCAN),
register_command=self._gopro.ble_command.scan_wifi_networks(),
register_command=lambda: self._gopro.ble_command.scan_wifi_networks(),
) as observable, asyncio.timeout(timeout):
if observable.initial_response.result != EnumResultGeneric.RESULT_SUCCESS:
return Result.from_failure(GoProError("Failed to start scanning."))
Expand Down Expand Up @@ -90,10 +91,12 @@ async def connect(
# Are we already provisioned?
if entry.scan_entry_flags & EnumScanEntryFlags.SCAN_FLAG_CONFIGURED:
logger.info(f"Connecting to already provisioned network {ssid}...")
command = self._gopro.ble_command.request_wifi_connect(ssid=ssid)
command = partial(self._gopro.ble_command.request_wifi_connect, ssid=ssid)
else:
logger.info(f"Provisioning new network {ssid}...")
command = self._gopro.ble_command.request_wifi_connect_new(ssid=ssid, password=password)
command = partial(
self._gopro.ble_command.request_wifi_connect_new, ssid=ssid, password=password
)

async with GoproObserverDistinctInitial[
ResponseConnect | ResponseConnectNew,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ async def get_livestream_status_observable(
"""
return await GoProObservable[NotifyLiveStreamStatus](
gopro=self.gopro,
register_command=self.gopro.ble_command.register_livestream_status(
register_command=lambda: self.gopro.ble_command.register_livestream_status(
register=[EnumRegisterLiveStreamStatus.REGISTER_LIVE_STREAM_STATUS_STATUS]
),
unregister_command=self.gopro.ble_command.register_livestream_status(
unregister_command=lambda: self.gopro.ble_command.register_livestream_status(
unregister=[EnumRegisterLiveStreamStatus.REGISTER_LIVE_STREAM_STATUS_STATUS]
),
update=ProtobufId(FeatureId.QUERY, ActionId.LIVESTREAM_STATUS_NOTIF),
Expand Down
Loading