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.lutron.internal.radiora.protocol;
15 import java.util.ArrayList;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * Button Press (BP) Command.
23 * Trigger a Phantom Button Press on the RadioRA Serial Device.
25 * @author Jeff Lauterbach - Initial Contribution
29 public class ButtonPressCommand extends RadioRACommand {
31 public enum ButtonState {
37 private int buttonNumber; // 1 to 15, 16 ALL ON, 17 ALL OFF
38 private ButtonState state; // ON/OFF/TOG
39 private @Nullable Integer fadeSec; // 0 to 240 (optional)
40 private int system; // 1 or 2, or 0 for none
42 public ButtonPressCommand(int buttonNumber, ButtonState state, int system) {
43 this.buttonNumber = buttonNumber;
48 public void setFadeSeconds(int seconds) {
49 this.fadeSec = seconds;
53 public String getCommand() {
58 public List<String> getArgs() {
59 List<String> args = new ArrayList<>();
60 args.add(String.valueOf(buttonNumber));
61 args.add(String.valueOf(state));
63 if (fadeSec != null) {
64 args.add(String.valueOf(fadeSec));
67 if (system == 1 || system == 2) {
68 args.add("S" + String.valueOf(system));