[docs]defdiscover_devices(search_duration_seconds:float)->T.List[Device]:"""Return all devices that could be found in the given search duration. .. seealso:: The asynchronous equivalent :py:func:`pupil_labs.realtime_api.discovery.discover_devices` """asyncdef_discover():asyncwithAsyncNetwork()asnetwork:awaitasyncio.sleep(search_duration_seconds)returnnetwork.devicesreturn[Device.from_discovered_device(dev)fordevinasyncio.run(_discover())]
[docs]defdiscover_one_device(max_search_duration_seconds:T.Optional[float]=10.0,)->T.Optional[Device]:"""Return the first device that could be found in the given search duration. .. seealso:: The asynchronous equivalent :py:func:`pupil_labs.realtime_api.discovery.Network.wait_for_new_device` """asyncdef_discover():asyncwithAsyncNetwork()asnetwork:returnawaitnetwork.wait_for_new_device(max_search_duration_seconds)device=asyncio.run(_discover())returnNoneifdeviceisNoneelseDevice.from_discovered_device(device)