2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.tivo.internal.service;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
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}.
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
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 = "";
40 * {@link toString} returns each of the configuration items as a single concatenated string.
43 * @see java.lang.Object#toString()
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 + "]";
53 * Gets the cfgIdentifier representing the thing name of the TiVo device.
55 * @return the cfgIdentifier
57 public String getCfgIdentifier() {
58 return this.cfgIdentifier;
62 * Sets the cfgIdentifier representing the thing name of the TiVo device.
64 * @param cfgIdentifier the cfgIdentifier to set
66 public void setCfgIdentifier(String cfgIdentifier) {
67 this.cfgIdentifier = cfgIdentifier;
71 * Gets the host representing the host name or IP address of the device.
75 public @Nullable String getHost() {
80 * the host representing the host name or IP address of the device.
82 * @param host the host to set
84 public void setHost(String host) {
89 * Gets the cfgTcp representing the IP port of the Remote Control Protocol service on the device.
93 public int getTcpPort() {
98 * Sets the cfgTcp representing the IP port of the Remote Control Protocol service on the device (31339).
100 * @param tcpPort the tcpPort to set
102 public void setTcpPort(int tcpPort) {
103 this.tcpPort = tcpPort;
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
110 * interval specified in the Command Wait Interval.
112 * @return the numRetry
114 public int getNumRetry() {
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
122 * interval specified in the Command Wait Interval.
124 * @param numRetry the numRetry to set
126 public void setNumRetry(int numRetry) {
127 this.numRetry = numRetry;
131 * Gets the pollInterval representing the interval in seconds between polling attempts to collect any updated
132 * status information.
134 * @return the pollInterval
136 public int getPollInterval() {
141 * Sets the pollInterval representing the interval in seconds between polling attempts to collect any updated
142 * status information.
144 * @param pollInterval the pollInterval to set
146 public void setPollInterval(int pollInterval) {
147 this.pollInterval = pollInterval;
151 * Checks if is cfg poll changes.
153 * @return the pollForChanges
155 public boolean doPollChanges() {
156 return pollForChanges;
160 * Sets the cfg poll changes.
162 * @param pollForChanges the pollForChanges to set
164 public void setPollForChanges(boolean pollForChanges) {
165 this.pollForChanges = pollForChanges;
169 * Checks if is cfg keep conn open.
171 * @return the keepConActive
173 public boolean isKeepConnActive() {
174 return keepConActive;
178 * Sets the cfg keep conn open.
180 * @param keepConActive the keepConActive to set
182 public void setKeepConnActive(boolean keepConActive) {
183 this.keepConActive = keepConActive;
187 * Gets the cfg cmd wait.
189 * @return the cmdWaitInterval
191 public int getCmdWaitInterval() {
192 return cmdWaitInterval;
196 * Sets the cfg cmd wait.
198 * @param cmdWaitInterval the cmdWaitInterval to set
200 public void setCmdWaitInterval(int cmdWaitInterval) {
201 this.cmdWaitInterval = cmdWaitInterval;