Go to the documentation of this file.00001 package ros.zeroconf.jmdns.demos;
00002
00003 import ros.zeroconf.jmdns.ZeroconfDiscoveryHandler;
00004 import org.ros.message.zeroconf_comms.DiscoveredService;
00005
00012 public class DiscoveryHandler implements ZeroconfDiscoveryHandler {
00013
00014 public void serviceAdded(DiscoveredService discovered_service) {
00015 String result = "[+] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".";
00016 System.out.println(result);
00017 }
00018 public void serviceRemoved(DiscoveredService discovered_service) {
00019 String result = "[-] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".";
00020 System.out.println(result);
00021 }
00022 public void serviceResolved(DiscoveredService discovered_service) {
00023 String result = "[=] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".\n";
00024 result += " Port : " + discovered_service.port + "\n";
00025 result += " Hostname : " + discovered_service.hostname + "\n";
00026 for ( String address : discovered_service.ipv4_addresses ) {
00027 result += " Address: " + address + "\n";
00028 }
00029 for ( String address : discovered_service.ipv6_addresses ) {
00030 result += " Address: " + address + "\n";
00031 }
00032 System.out.printf(result);
00033 }
00034 }