]> git.basschouten.com Git - openhab-addons.git/blob
5208c988e786ba2da9632255b78f776b8be8c91e
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.satel.internal.config;
14
15 import java.nio.charset.Charset;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * The {@link SatelBridgeConfig} contains common configuration values for Satel bridge things.
22  *
23  * @author Krzysztof Goworek - Initial contribution
24  */
25 @NonNullByDefault
26 public class SatelBridgeConfig {
27
28     private int timeout;
29     private int refresh;
30     private @Nullable String userCode;
31     private @Nullable String encoding;
32     private boolean extCommands;
33
34     /**
35      * @return value of timeout in milliseconds
36      */
37     public int getTimeout() {
38         return timeout;
39     }
40
41     /**
42      * @return polling interval in milliseconds
43      */
44     public int getRefresh() {
45         return refresh;
46     }
47
48     /**
49      * @return user code in behalf of all the commands will be executed
50      */
51     public String getUserCode() {
52         final String userCode = this.userCode;
53         return userCode == null ? "" : userCode;
54     }
55
56     /**
57      * @return encoding for texts received from the bridge (names, descriptions)
58      */
59     public Charset getEncoding() {
60         final String encoding = this.encoding;
61         return encoding == null ? Charset.defaultCharset() : Charset.forName(encoding);
62     }
63
64     /**
65      * @return <code>true</code> if the module supports extended commands
66      */
67     public boolean hasExtCommandsSupport() {
68         return extCommands;
69     }
70 }