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.plclogo.internal.config;
15 import static org.openhab.binding.plclogo.internal.PLCLogoBindingConstants.NOT_SUPPORTED;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.plclogo.internal.PLCLogoBindingConstants;
22 * The {@link PLCLogoBridgeConfiguration} hold configuration of Siemens LOGO! PLCs.
24 * @author Alexander Falkenstern - Initial contribution
27 public class PLCLogoBridgeConfiguration {
29 private String address = "";
30 private String family = NOT_SUPPORTED;
31 private String localTSAP = "0x3000";
32 private String remoteTSAP = "0x2000";
33 private Integer refresh = 100;
36 * Get configured Siemens LOGO! device IP address.
38 * @return Configured Siemens LOGO! IP address
40 public String getAddress() {
45 * Set IP address for Siemens LOGO! device.
47 * @param address IP address of Siemens LOGO! device
49 public void setAddress(final String address) {
50 this.address = address.trim();
54 * Get configured Siemens LOGO! device family.
56 * @see PLCLogoBindingConstants#LOGO_0BA7
57 * @see PLCLogoBindingConstants#LOGO_0BA8
58 * @return Configured Siemens LOGO! device family
60 public String getFamily() {
65 * Set Siemens LOGO! device family.
67 * @param family Family of Siemens LOGO! device
68 * @see PLCLogoBindingConstants#LOGO_0BA7
69 * @see PLCLogoBindingConstants#LOGO_0BA8
71 public void setFamily(final String family) {
72 this.family = family.trim();
76 * Get configured local TSAP of Siemens LOGO! device.
78 * @return Configured local TSAP of Siemens LOGO!
80 public @Nullable Integer getLocalTSAP() {
81 Integer result = null;
82 if (localTSAP.startsWith("0x")) {
83 result = Integer.decode(localTSAP);
89 * Set local TSAP of Siemens LOGO! device.
91 * @param tsap Local TSAP of Siemens LOGO! device
93 public void setLocalTSAP(final String tsap) {
94 this.localTSAP = tsap.trim();
98 * Get configured remote TSAP of Siemens LOGO! device.
100 * @return Configured local TSAP of Siemens LOGO!
102 public @Nullable Integer getRemoteTSAP() {
103 Integer result = null;
104 if (remoteTSAP.startsWith("0x")) {
105 result = Integer.decode(remoteTSAP);
111 * Set remote TSAP of Siemens LOGO! device.
113 * @param tsap Remote TSAP of Siemens LOGO! device
115 public void setRemoteTSAP(final String tsap) {
116 this.remoteTSAP = tsap.trim();
120 * Get configured refresh rate of Siemens LOGO! device blocks in milliseconds.
122 * @return Configured refresh rate of Siemens LOGO! device blocks
124 public Integer getRefreshRate() {
129 * Set refresh rate of Siemens LOGO! device blocks in milliseconds.
131 * @param rate Refresh rate of Siemens LOGO! device blocks
133 public void setRefreshRate(final Integer rate) {