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