public Location(NetworkAddress networkAddress, String path) { this.networkAddress = networkAddress; this.path = path; this.url = createAbsoluteURL(networkAddress.getAddress(), networkAddress.getPort(), path); }
@Override public String getUserAgentValue(int majorVersion, int minorVersion) { // TODO: UPNP VIOLATION: Synology NAS requires User-Agent to contain // "Android" to return DLNA protocolInfo required to stream to Samsung TV // see: http://two-play.com/forums/viewtopic.php?f=6&t=81 ServerClientTokens tokens = new ServerClientTokens(majorVersion, minorVersion); tokens.setOsName("Android"); tokens.setOsVersion(Build.VERSION.RELEASE); return tokens.toString(); } }
@Override public String toString() { return getOsName()+"/"+getOsVersion() + " UPnP/" + getMajorVersion() + "." + getMinorVersion() + " " + getProductName() + "/" + getProductVersion(); }
public PositionInfo(PositionInfo copy, long relTimeSeconds, long absTimeSeconds) { this.track = copy.track; this.trackDuration = copy.trackDuration; this.trackMetaData = copy.trackMetaData; this.trackURI = copy.trackURI; this.relTime = ModelUtil.toTimeString(relTimeSeconds); this.absTime = ModelUtil.toTimeString(absTimeSeconds); this.relCount = copy.relCount; this.absCount = copy.absCount; }
/** * @return Defaults to string value of {@link org.fourthline.cling.model.ServerClientTokens}. */ public String getUserAgentValue(int majorVersion, int minorVersion) { return new ServerClientTokens(majorVersion, minorVersion).toString(); } }
@Override public String toString() { return "(" + simpleName + ")" + " advertised: " + isAdvertised() + " byebyeBeforeFirstAlive: " + isByeByeBeforeFirstAlive(); } }
public static Element appendNewElementIfNotNull(Document document, Element parent, String element, Object content, String namespace) { if (content == null) return parent; return appendNewElement(document, parent, element, content, namespace); }
@Override protected Namespace createNamespace() { // For the Jetty server, this is the servlet context path return new Namespace("/upnp"); }
/** * Converts the given instances into comma-separated elements of a string, * escaping commas with backslashes. */ public static String toCommaSeparatedList(Object[] o) { return toCommaSeparatedList(o, true, false); }
/** * Converts the comma-separated elements of a string into an array of strings, * unescaping backslashed commas. */ public static String[] fromCommaSeparatedList(String s) { return fromCommaSeparatedList(s, true); }
public long getSecondsUntilExpiration() { // Note: Uses direct field access for performance reasons on Android return maxAgeSeconds == UNLIMITED_AGE ? Integer.MAX_VALUE : (lastRefreshTimestampSeconds + maxAgeSeconds) - getCurrentTimestampSeconds(); }
RegistryItem(K key, I item, int maxAgeSeconds) { this.key = key; this.item = item; this.expirationDetails = new ExpirationDetails(maxAgeSeconds); }
public URI getControlPath(Service service) { return appendPathToBaseURI(getServicePath(service) + CONTROL); }
/** * Performance optimization, avoids URI manipulation. */ public String getEventCallbackPathString(Service service) { return decodedPath + getServicePath(service) + EVENTS + CALLBACK_FILE; }
@Override protected Namespace createNamespace() { return new Namespace("/upnp"); }
public String getRecQualityModesString() { return ModelUtil.toCommaSeparatedList(recQualityModes); } }
/** * @param halfTime If <code>true</code> then half maximum age is used to determine expiration. * @return <code>true</code> if the maximum age has been reached. */ public boolean hasExpired(boolean halfTime) { // Note: Uses direct field access for performance reasons on Android return maxAgeSeconds != UNLIMITED_AGE && (lastRefreshTimestampSeconds + (maxAgeSeconds/(halfTime ? 2 : 1))) < getCurrentTimestampSeconds(); }