DiscoveryHandler.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2013 Yujin Robot.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00005  * use this file except in compliance with the License. You may obtain a copy of
00006  * the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
00013  * License for the specific language governing permissions and limitations under
00014  * the License.
00015  */
00016 package com.github.rosjava.zeroconf_jmdns_suite.jmdns.tutorials;
00017 
00018 import com.github.rosjava.zeroconf_jmdns_suite.jmdns.DiscoveredService;
00019 import com.github.rosjava.zeroconf_jmdns_suite.jmdns.ZeroconfDiscoveryHandler;
00020 
00027 public class DiscoveryHandler implements ZeroconfDiscoveryHandler {
00028         
00029         public void serviceAdded(DiscoveredService discovered_service) {
00030                 String result = "[+] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".";
00031         System.out.println(result);
00032         }
00033         public void serviceRemoved(DiscoveredService discovered_service) {
00034                 String result = "[-] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".";
00035         System.out.println(result);
00036         }
00037         public void serviceResolved(DiscoveredService discovered_service) {
00038                 String result = "[=] " + discovered_service.name + "." + discovered_service.type + "." + discovered_service.domain + ".\n";
00039         result += "    Port     : " + discovered_service.port + "\n";
00040         result += "    Hostname : " + discovered_service.hostname + "\n";
00041         for ( String address : discovered_service.ipv4_addresses ) {
00042                 result += "    Address: " + address + "\n";
00043         }
00044         for ( String address : discovered_service.ipv6_addresses ) {
00045                 result += "    Address: " + address + "\n";
00046         }
00047         System.out.printf(result);
00048         }
00049 }   


zeroconf_jmdns_suite
Author(s): Daniel Stonier
autogenerated on Thu Aug 27 2015 15:50:26