bpod_core.ipc.iter_services

bpod_core.ipc.iter_services(service_type, properties=None, timeout=10, poll_interval=1, *, local=True, remote=True) Iterator[ServiceEvent]

Discover all services matching the given type and properties.

Continuously monitors both local (IPC) and remote (Zeroconf/TCP) services, yielding 'added' and 'removed' events as services appear and disappear.

Parameters:
  • service_type (str) – The service type to discover, e.g., ‘bpod’.

  • properties (dict, optional) – Dictionary of expected service properties to match.

  • timeout (float or None, optional) – How many seconds to monitor, by default 10. Pass None to monitor indefinitely until the iterator is closed.

  • poll_interval (float, optional) – How often to poll for local service changes, in seconds. Default is 1.

  • local (bool, optional) – Whether to search for services on the local machine, by default True.

  • remote (bool, optional) – Whether to also search for services on the network, by default True.

Yields:

ServiceEvent – A named tuple with the following fields:

  • kind: str, either ‘added’ or ‘removed’

  • address: str, the service address, e.g., ‘tcp://192.168.1.10:1234

  • properties: dict, the service properties, e.g., {‘name’: ‘MyDevice’}

Return type:

Iterator[ServiceEvent]