4.1.2.1. UpnpDiscover

class fluxclient.upnp.UpnpDiscover(uuid=None, device_ipaddr=None, mcst_ipaddr='239.255.255.250', mcst_port=1901)

The uuid and device_ipaddr param can limit UpnpDiscover to find device with specified uuid or IP address. These params usually be used when you want recive specified status continuously.

Parameters:
  • uuid (uuid.UUID) – Discover specified uuid of device only
  • device_ipaddr (string) – Discover device from specified IP address only.
poke(ipaddr, version=None)

Sends a special message to destination IP address. And the destination device will send a unicast UDP package back.

discover(callback, lookup_callback=None, timeout=inf)

Executes discovering task. The callback function has a minimal definition:

def callback(upnp_discover_instance, device, **kw):
    pass
  • upnp_discover_instance is the instance which calls this method.
  • device a fluxclient.upnp.Device instance
Parameters:
  • callback (callable) – This method will be invoked when a device has been found or the computer recived a new status from a device.
  • timeout (float) – Maximum waiting time.
stop()

Invoke this function to break discover task

Note

Discover method may still invoke a callback even if user called this method, because the data already in local socket buffer.