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.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
21 * The {@link PLCPulseConfiguration} is a class for configuration
22 * of Siemens LOGO! PLC memory input/outputs blocks.
24 * @author Alexander Falkenstern - Initial contribution
27 public class PLCPulseConfiguration extends PLCMemoryConfiguration {
29 private @Nullable String observe;
30 private Integer pulse = 150;
33 * Get observed Siemens LOGO! block name or memory address.
35 * @return Observed Siemens LOGO! block name or memory address
37 public String getObservedBlock() {
38 String result = observe;
40 result = getBlockName();
47 * Set Siemens LOGO! block name or memory address to observe.
49 * @param name Siemens LOGO! memory block name or memory address
51 public void setObservedBlock(final String name) {
55 public String getObservedChannelType() {
56 String kind = getObservedBlockKind();
57 boolean isInput = kind.equalsIgnoreCase(I_DIGITAL) || kind.equalsIgnoreCase(NI_DIGITAL);
58 return isInput ? DIGITAL_INPUT_ITEM : DIGITAL_OUTPUT_ITEM;
61 public String getObservedBlockKind() {
62 String result = observe;
64 result = getBlockName();
67 return getBlockKind(result);
70 public Integer getPulseLength() {
74 public void setPulseLength(Integer pulse) {