]> git.basschouten.com Git - openhab-addons.git/blob
51b4b20c4fc25d3e5d9b5e58f65b2270a284475d
[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.tivo.internal.service;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The Class {@link TivoConfigData} stores the dynamic configuration parameters used within the
20  * {@link org.openhab.binding.tivo.internal.handler.TiVoHandler} and
21  * {@link TivoStatusProvider}.
22  *
23  * @author Jayson Kubilis (DigitalBytes) - Initial contribution
24  * @author Andrew Black (AndyXMB) - minor updates, removal of unused DiscoveryService functionality.
25  * @author Michael Lobstein - Updated for OH3
26  */
27
28 @NonNullByDefault
29 public class TivoConfigData {
30     private @Nullable String host = null;
31     private int tcpPort = 31339;
32     private int numRetry = 0;
33     private int pollInterval = 30;
34     private boolean pollForChanges = false;
35     private boolean keepConActive = false;
36     private int cmdWaitInterval = 0;
37     private String cfgIdentifier = "";
38
39     /**
40      * {@link toString} returns each of the configuration items as a single concatenated string.
41      *
42      * @return string
43      * @see java.lang.Object#toString()
44      */
45     @Override
46     public String toString() {
47         return "TivoConfigData [host=" + host + ", tcpPort=" + tcpPort + ", numRetry=" + numRetry + ", pollInterval="
48                 + pollInterval + ", pollForChanges=" + pollForChanges + ", keepConActive=" + keepConActive
49                 + ", cmdWaitInterval=" + cmdWaitInterval + ", cfgIdentifier=" + cfgIdentifier + "]";
50     }
51
52     /**
53      * Gets the cfgIdentifier representing the thing name of the TiVo device.
54      *
55      * @return the cfgIdentifier
56      */
57     public String getCfgIdentifier() {
58         return this.cfgIdentifier;
59     }
60
61     /**
62      * Sets the cfgIdentifier representing the thing name of the TiVo device.
63      *
64      * @param cfgIdentifier the cfgIdentifier to set
65      */
66     public void setCfgIdentifier(String cfgIdentifier) {
67         this.cfgIdentifier = cfgIdentifier;
68     }
69
70     /**
71      * Gets the host representing the host name or IP address of the device.
72      *
73      * @return the host
74      */
75     public @Nullable String getHost() {
76         return host;
77     }
78
79     /**
80      * the host representing the host name or IP address of the device.
81      *
82      * @param host the host to set
83      */
84     public void setHost(String host) {
85         this.host = host;
86     }
87
88     /**
89      * Gets the cfgTcp representing the IP port of the Remote Control Protocol service on the device.
90      *
91      * @return the tcpPort
92      */
93     public int getTcpPort() {
94         return tcpPort;
95     }
96
97     /**
98      * Sets the cfgTcp representing the IP port of the Remote Control Protocol service on the device (31339).
99      *
100      * @param tcpPort the tcpPort to set
101      */
102     public void setTcpPort(int tcpPort) {
103         this.tcpPort = tcpPort;
104     }
105
106     /**
107      * Gets the numRetry value. This determines the number of connection attempts made to the IP/Port of the
108      * service and the number of read attempts that are made when a command is submitted to the device, separated by
109      * the
110      * interval specified in the Command Wait Interval.
111      *
112      * @return the numRetry
113      */
114     public int getNumRetry() {
115         return numRetry;
116     }
117
118     /**
119      * Sets the numRetry value. This determines the number of connection attempts made to the IP/Port of the
120      * service and the number of read attempts that are made when a command is submitted to the device, separated by
121      * the
122      * interval specified in the Command Wait Interval.
123      *
124      * @param numRetry the numRetry to set
125      */
126     public void setNumRetry(int numRetry) {
127         this.numRetry = numRetry;
128     }
129
130     /**
131      * Gets the pollInterval representing the interval in seconds between polling attempts to collect any updated
132      * status information.
133      *
134      * @return the pollInterval
135      */
136     public int getPollInterval() {
137         return pollInterval;
138     }
139
140     /**
141      * Sets the pollInterval representing the interval in seconds between polling attempts to collect any updated
142      * status information.
143      *
144      * @param pollInterval the pollInterval to set
145      */
146     public void setPollInterval(int pollInterval) {
147         this.pollInterval = pollInterval;
148     }
149
150     /**
151      * Checks if is cfg poll changes.
152      *
153      * @return the pollForChanges
154      */
155     public boolean doPollChanges() {
156         return pollForChanges;
157     }
158
159     /**
160      * Sets the cfg poll changes.
161      *
162      * @param pollForChanges the pollForChanges to set
163      */
164     public void setPollForChanges(boolean pollForChanges) {
165         this.pollForChanges = pollForChanges;
166     }
167
168     /**
169      * Checks if is cfg keep conn open.
170      *
171      * @return the keepConActive
172      */
173     public boolean isKeepConnActive() {
174         return keepConActive;
175     }
176
177     /**
178      * Sets the cfg keep conn open.
179      *
180      * @param keepConActive the keepConActive to set
181      */
182     public void setKeepConnActive(boolean keepConActive) {
183         this.keepConActive = keepConActive;
184     }
185
186     /**
187      * Gets the cfg cmd wait.
188      *
189      * @return the cmdWaitInterval
190      */
191     public int getCmdWaitInterval() {
192         return cmdWaitInterval;
193     }
194
195     /**
196      * Sets the cfg cmd wait.
197      *
198      * @param cmdWaitInterval the cmdWaitInterval to set
199      */
200     public void setCmdWaitInterval(int cmdWaitInterval) {
201         this.cmdWaitInterval = cmdWaitInterval;
202     }
203 }