]> git.basschouten.com Git - openhab-addons.git/blob
5fe6d53afda8e506aa590a0bae32985413be9994
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.yamahareceiver.internal.config;
14
15 import java.util.Optional;
16
17 import org.apache.commons.lang.StringUtils;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 /**
22  * Main settings.
23  *
24  * @author Tomasz Maruszak - Initial contribution.
25  */
26 @NonNullByDefault
27 public class YamahaBridgeConfig {
28
29     /**
30      * The host name of the Yamaha AVR.
31      */
32     private @Nullable String host;
33     /**
34      * Port under which the control interface is exposed on the Yamaha AVR.
35      */
36     private int port = 80;
37     /**
38      * Interval (in seconds) at which state updates are polled.
39      */
40     private int refreshInterval = 60; // Default: Every 1min
41     /**
42      * The default album image placeholder URL used when the source does not provide its own.
43      */
44     private String albumUrl = "";
45     /**
46      * Input source mapping for each command. This is a comma separated list of settings.
47      */
48     private String inputMapping = "";
49
50     public @Nullable String getHost() {
51         return host;
52     }
53
54     public int getPort() {
55         return port;
56     }
57
58     public int getRefreshInterval() {
59         return refreshInterval;
60     }
61
62     public String getAlbumUrl() {
63         return albumUrl;
64     }
65
66     public Optional<String> getHostWithPort() {
67         final String str = host;
68         if (StringUtils.isEmpty(str)) {
69             return Optional.empty();
70         }
71         return Optional.of(str + ":" + port);
72     }
73
74     public String getInputMapping() {
75         return inputMapping;
76     }
77 }