Add documentation

CURA-2035
This commit is contained in:
fieldOfView 2016-08-09 13:54:13 +02:00
parent 0816663e16
commit bd6e36f487

View file

@ -81,6 +81,7 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
if state_change == ServiceStateChange.Added: if state_change == ServiceStateChange.Added:
Logger.log("d", "Bonjour service added: %s" % name) Logger.log("d", "Bonjour service added: %s" % name)
# First try getting info from zeroconf cache
info = ServiceInfo(service_type, name, properties = {}) info = ServiceInfo(service_type, name, properties = {})
for record in zeroconf.cache.entries_with_name(name.lower()): for record in zeroconf.cache.entries_with_name(name.lower()):
info.update_record(zeroconf, time.time(), record) info.update_record(zeroconf, time.time(), record)
@ -90,6 +91,7 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin):
if info.address: if info.address:
break break
# Request more data if info is not complete
if not info.address: if not info.address:
Logger.log("d", "Trying to get address of %s", name) Logger.log("d", "Trying to get address of %s", name)
info = zeroconf.get_service_info(service_type, name) info = zeroconf.get_service_info(service_type, name)