6 @author: Daniel Stonier 11 String representation of zeroconf announcement 14 return "\tname: %s\n\ttype: %s [%s]\n\tdomain: %s\n\thostname: %s\n\taddress: %s\n\tport: %d\n\tinterface: %d\n\tprotocol: %d\n\tdescription: %s\n\tis_local:%d\n\tour_own: %d\n\twide_area: %d\n\tmulticast: %d" % (
22 service.hardware_interface,
33 Sometimes you'll see the same service on multiple interfaces - this will often happen on localhost 34 where the service will be getting advertised on whatever network devices you currently have 35 running (e.g. eth0 and wlan1). 37 In these cases, we assume they're equal. In fact, the important properties uniquely 38 identifying the service for us (remembering that we're discovering on a particular domain and 41 service_name, port, domain 44 if ( service_one.name == service_two.name )
and ( service_one.port == service_two.port )
and ( service_one.domain == service_two.domain ):
51 This emulates what python-avahi's ServiceTypeDatabase class does in 52 conjuction with /usr/share/service-types and /usr/lib/avahi/service-types.db. 54 We could just roll out further .db's which would then get 55 it to print nice englishified versions of the service types for any 56 zeroconf browser, however we're really only interested in making it functional 57 internally (ros-internally) for now. So just hacking it in code for now. 59 if service_type ==
'_ros-master._tcp':
61 if service_type ==
'_concert-master._tcp':
62 return "Concert Master" 63 if service_type ==
'_app-manager._tcp':
66 if service_type ==
'_ros-master._udp':
67 return "Ros Master (UDP)" 68 if service_type ==
'_concert-master._udp':
69 return "Concert Master (UDP)" 70 if service_type ==
'_app-manager._udp':
71 return "App Manager (UDP)" def service_to_str(service)
def service_name(service_type)
def same_service(service_one, service_two)