INNER CODE UNIT · Python

discover_devices

xoseperez/espurna · code/ota.py:351

def discover_devices(args):
    # Look for services and try to immediately print the device when it is discovered
    # (unless --sort <field> is specified, then we will wait until discovery finishes
    listener = Listener(print_when_discovered=not args.sort)

    try:
        browser = zeroconf.ServiceBrowser(
            zeroconf.Zeroconf(), "_arduino._tcp.local.", listener
        )
    except (
        zeroconf.BadTypeInNameException,
        NotImplementedError,
        OSError,
        socket.error,
        zeroconf.NonUniqueNameException,
    ) as exc:
        print("! error when creating service discovery browser: {}".format(exc))
        sys.exit(1)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…