2 * Copyright (c) 2010-2024 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.luxom.internal.protocol;
15 import java.util.Arrays;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
22 * @author Kris Jespers - Initial contribution
25 public enum LuxomAction {
26 HEARTBEAT("*U", false),
27 ACKNOWLEDGE("@1*V", false),
30 MODULE_INFORMATION("*!", false),
31 PASSWORD_REQUEST("@1*PW-", false),
32 CLEAR_RESPONSE("@1*C", true),
33 SET_RESPONSE("@1*S", true),
34 DATA_RESPONSE("@1*A", true, true),
35 DATA_BYTE_RESPONSE("@1*Z", false),
36 DATA("*A", true, true),
37 DATA_BYTE("*Z", false),
40 REQUEST_FOR_INFORMATION("*?", false),
41 INVALID_ACTION("-INVALID-", false); // this is not part of the luxom api, it's for internal use.;
43 private final String command;
44 private final boolean hasAddress;
45 private final boolean needsData;
47 LuxomAction(String command, boolean hasAddress) {
48 this(command, hasAddress, false);
51 LuxomAction(String command, boolean hasAddress, boolean needsData) {
52 this.command = command;
53 this.hasAddress = hasAddress;
54 this.needsData = needsData;
57 public static LuxomAction of(String command) {
58 return Arrays.stream(LuxomAction.values()).filter(a -> a.getCommand().equals(command)).findFirst()
59 .orElse(INVALID_ACTION);
62 public String getCommand() {
66 public boolean isHasAddress() {
70 public boolean isNeedsData() {