001package voyeur;
002/*-
003 * ##########################################################################
004 * Local Area Network Voyeur
005 * %%
006 * Copyright (C) 2019 - 2022 Allen D. Ball
007 * %%
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *      http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 * ##########################################################################
020 */
021import ball.upnp.ssdp.SSDPDiscoveryCache;
022import ball.upnp.ssdp.SSDPDiscoveryService;
023import javax.annotation.PostConstruct;
024import javax.annotation.PreDestroy;
025import lombok.NoArgsConstructor;
026import lombok.extern.log4j.Log4j2;
027import org.springframework.beans.factory.annotation.Value;
028import org.springframework.stereotype.Service;
029
030/**
031 * {@link SSDPDiscoveryCache} {@link Service}.
032 *
033 * {@injected.fields}
034 *
035 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
036 */
037@Service
038@NoArgsConstructor @Log4j2
039public class SSDP extends SSDPDiscoveryCache {
040    private static final long serialVersionUID = 881598533396699066L;
041
042    /** @serial */ @Value("${ssdp.product}") private String product = null;
043
044    @PostConstruct
045    public void init() throws Exception {
046        new SSDPDiscoveryService(product).addListener(this);
047    }
048
049    @PreDestroy
050    public void destroy() { }
051}