]> git.basschouten.com Git - openhab-addons.git/blob
b226cf061398892dd2de29cd54674203cad4db55
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * Main settings.
22  *
23  * @author Tomasz Maruszak - Initial contribution.
24  */
25 @NonNullByDefault
26 public class YamahaBridgeConfig {
27
28     /**
29      * The host name of the Yamaha AVR.
30      */
31     private @Nullable String host;
32     /**
33      * Port under which the control interface is exposed on the Yamaha AVR.
34      */
35     private int port = 80;
36     /**
37      * Interval (in seconds) at which state updates are polled.
38      */
39     private int refreshInterval = 60; // Default: Every 1min
40     /**
41      * The default album image placeholder URL used when the source does not provide its own.
42      */
43     private String albumUrl = "";
44     /**
45      * Input source mapping for each command. This is a comma separated list of settings.
46      */
47     private String inputMapping = "";
48
49     public @Nullable String getHost() {
50         return host;
51     }
52
53     public int getPort() {
54         return port;
55     }
56
57     public int getRefreshInterval() {
58         return refreshInterval;
59     }
60
61     public String getAlbumUrl() {
62         return albumUrl;
63     }
64
65     public Optional<String> getHostWithPort() {
66         final String str = host;
67         if (str == null || str.isEmpty()) {
68             return Optional.empty();
69         }
70         return Optional.of(str + ":" + port);
71     }
72
73     public String getInputMapping() {
74         return inputMapping;
75     }
76 }