001package ball.upnp; 002/*- 003 * ########################################################################## 004 * UPnP/SSDP Implementation Classes 005 * $Id: RootDevice.java 7215 2021-01-03 18:39:51Z ball $ 006 * $HeadURL: svn+ssh://svn.hcf.dev/var/spool/scm/repository.svn/ball-upnp/trunk/src/main/java/ball/upnp/RootDevice.java $ 007 * %% 008 * Copyright (C) 2013 - 2021 Allen D. Ball 009 * %% 010 * Licensed under the Apache License, Version 2.0 (the "License"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an "AS IS" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * ########################################################################## 022 */ 023import java.net.URI; 024import java.util.Map; 025import java.util.Set; 026import java.util.function.BiConsumer; 027 028/** 029 * {@link.uri http://www.upnp.org/ UPnP} {@link RootDevice} interface. 030 * 031 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball} 032 * @version $Revision: 7215 $ 033 */ 034public interface RootDevice extends Device { 035 036 /** 037 * {@code upnp:rootdevice} 038 */ 039 public static final URI NT = URI.create("upnp:rootdevice"); 040 041 /** 042 * {@code CONFIGID.UPNP.ORG} 043 * 044 * @return {@code configID} 045 */ 046 default int getConfigId() { return 1; } 047 048 /** 049 * {@code CACHE-CONTROL: MAX-AGE} 050 * 051 * @return {@code MAX-AGE} 052 */ 053 default int getMaxAge() { return 1800; } 054 055 /** 056 * {@code LOCATION} 057 * 058 * @return Description {@link URI} 059 */ 060 public URI getLocation(); 061 062 /** 063 * Method to get {@link.this} {@link RootDevice}'s presentation 064 * {@code URL} (as an {@link URI}). 065 * 066 * @return The presentation {@link URI}. 067 */ 068 public URI getPresentationURL(); 069 070 /** 071 * Method to invoke {@link BiConsumer consumer} for every {@link URI NT} 072 * / {@link URI USN} combinations representing the {@link RootDevice} 073 * with embedded {@link Service}s and {@link Device}s. 074 * 075 * @param consumer The {@link BiConsumer}. 076 */ 077 default void notify(BiConsumer<URI,URI> consumer) { 078 getUSNMap().forEach((usn, v) -> v.forEach(nt -> consumer.accept(nt, usn))); 079 } 080}