1 /* 2 * Copyright (C) 2013 4th Line GmbH, Switzerland 3 * 4 * The contents of this file are subject to the terms of either the GNU 5 * Lesser General Public License Version 2 or later ("LGPL") or the 6 * Common Development and Distribution License Version 1 or later 7 * ("CDDL") (collectively, the "License"). You may not use this file 8 * except in compliance with the License. See LICENSE.txt for more 9 * information. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 */ 15 16 package org.fourthline.cling.model; 17 18 /** 19 * Options for discovery processing by the {@link org.fourthline.cling.registry.Registry}. 20 * 21 * @author Christian Bauer 22 */ 23 public class DiscoveryOptions { 24 25 protected boolean advertised; 26 protected boolean byeByeBeforeFirstAlive; 27 28 /** 29 * @param advertised If <code>false</code>, no alive notifications will be announced for 30 * this device and it will not appear in search responses. 31 */ 32 public DiscoveryOptions(boolean advertised) { 33 this.advertised = advertised; 34 } 35 36 /** 37 * 38 * @param advertised If <code>false</code>, no alive notifications will be announced for 39 * this device and it will not appear in search responses. 40 * @param byeByeBeforeFirstAlive If <code>true</code>, a byebye NOTIFY message will be send before the 41 * first alive NOTIFY message. 42 */ 43 public DiscoveryOptions(boolean advertised, boolean byeByeBeforeFirstAlive) { 44 this.advertised = advertised; 45 this.byeByeBeforeFirstAlive = byeByeBeforeFirstAlive; 46 } 47 48 /** 49 * @return <boolean>true</boolean> for regular advertisement with alive 50 * messages and in search responses. 51 */ 52 public boolean isAdvertised() { 53 return advertised; 54 } 55 56 /** 57 * @return <boolean>true</boolean> if a byebye NOTIFY message will be send before the 58 * first alive NOTIFY message. 59 */ 60 public boolean isByeByeBeforeFirstAlive() { 61 return byeByeBeforeFirstAlive; 62 } 63 64 // Performance optimization on Android 65 private static String simpleName = DiscoveryOptions.class.getSimpleName(); 66 @Override 67 public String toString() { 68 return "(" + simpleName + ")" + " advertised: " + isAdvertised() + " byebyeBeforeFirstAlive: " + isByeByeBeforeFirstAlive(); 69 } 70 }