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.russound.internal.rio.system;
16 * Configuration class for the {@link RioSystemHandler}
18 * @author Tim Roberts - Initial contribution
20 public class RioSystemConfig {
23 * Constant defined for the "ipAddress" configuration field
25 public static final String IP_ADDRESS = "ipAddress";
28 * Constant defined for the "ping" configuration field
30 public static final String PING = "ping";
33 * Constant defined for the "retryPolling" configuration field
35 public static final String RETRY_POLLING = "retryPolling";
38 * Constant defined for the "scanDevice" configuration field
40 public static final String SCAN_DEVICE = "scanDevice";
43 * IP Address (or host name) of system
45 private String ipAddress;
48 * Ping time (in seconds) to keep the connection alive.
53 * Polling time (in seconds) to attempt a reconnect if the socket session has failed
55 private int retryPolling;
58 * Whether to scan the device at startup (and create zones, source, etc dynamically)
60 private boolean scanDevice;
63 * Returns the IP address or host name
65 * @return the IP address or host name
67 public String getIpAddress() {
72 * Sets the IP address or host name
74 * @param ipAddress the IP Address or host name
76 public void setIpAddress(String ipAddress) {
77 this.ipAddress = ipAddress;
81 * Gets the polling (in seconds) to reconnect
83 * @return the polling (in seconds) to reconnect
85 public int getRetryPolling() {
90 * Sets the polling (in seconds) to reconnect
92 * @param retryPolling the polling (in seconds to reconnect)
94 public void setRetryPolling(int retryPolling) {
95 this.retryPolling = retryPolling;
99 * Gets the ping interval (in seconds)
101 * @return the ping interval (in seconds)
103 public int getPing() {
108 * Sets the ping interval (in seconds)
110 * @param ping the ping interval (in seconds)
112 public void setPing(int ping) {
117 * Whether the device should be scanned at startup
119 * @return true to scan, false otherwise
121 public boolean isScanDevice() {
126 * Sets whether the device should be scanned at startup
128 * @param scanDevice true to scan, false otherwise
130 public void setScanDevice(boolean scanDevice) {
131 this.scanDevice = scanDevice;
135 public int hashCode() {
136 final int prime = 31;
138 result = prime * result + ((ipAddress == null) ? 0 : ipAddress.hashCode());
139 result = prime * result + ping;
140 result = prime * result + retryPolling;
141 result = prime * result + (scanDevice ? 1231 : 1237);
145 @SuppressWarnings("PMD.SimplifyBooleanReturns")
147 public boolean equals(Object obj) {
154 if (getClass() != obj.getClass()) {
157 final RioSystemConfig other = (RioSystemConfig) obj;
158 if (ipAddress == null) {
159 if (other.ipAddress != null) {
162 } else if (!ipAddress.equals(other.ipAddress)) {
165 if (ping != other.ping) {
168 if (retryPolling != other.retryPolling) {
171 if (scanDevice != other.scanDevice) {