2 * Copyright (c) 2010-2022 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.dali.internal.protocol;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.dali.internal.handler.DaliException;
19 * The {@link DaliStandardCommand} represents different types of commands for
20 * controlling DALI equipment.
22 * @author Robert Schmid - Initial contribution
25 public class DaliStandardCommand extends DaliGearCommandBase {
27 private DaliStandardCommand(DaliAddress target, int cmdval, int param, boolean sendTwice) throws DaliException {
28 super(target.addToFrame(new DaliForwardFrame(16, new byte[] { 0x1, (byte) (cmdval | (param & 0b1111)) })),
32 public static DaliStandardCommand createOffCommand(DaliAddress target) throws DaliException {
33 return new DaliStandardCommand(target, 0x00, 0, false);
36 public static DaliStandardCommand createUpCommand(DaliAddress target) throws DaliException {
37 return new DaliStandardCommand(target, 0x01, 0, false);
40 public static DaliStandardCommand createDownCommand(DaliAddress target) throws DaliException {
41 return new DaliStandardCommand(target, 0x02, 0, false);
44 public static DaliStandardCommand createStepUpCommand(DaliAddress target) throws DaliException {
45 return new DaliStandardCommand(target, 0x03, 0, false);
48 public static DaliStandardCommand createStepDownCommand(DaliAddress target) throws DaliException {
49 return new DaliStandardCommand(target, 0x04, 0, false);
52 public static DaliStandardCommand createRecallMaxLevelCommand(DaliAddress target) throws DaliException {
53 return new DaliStandardCommand(target, 0x05, 0, false);
56 public static DaliStandardCommand createRecallMinLevelCommand(DaliAddress target) throws DaliException {
57 return new DaliStandardCommand(target, 0x06, 0, false);
60 public static DaliStandardCommand createStepDownAndOffCommand(DaliAddress target) throws DaliException {
61 return new DaliStandardCommand(target, 0x07, 0, false);
64 public static DaliStandardCommand createOnAndStepUpCommand(DaliAddress target) throws DaliException {
65 return new DaliStandardCommand(target, 0x08, 0, false);
68 public static DaliStandardCommand createEnableDAPCSequenceCommand(DaliAddress target) throws DaliException {
69 return new DaliStandardCommand(target, 0x09, 0, false);
72 public static DaliStandardCommand createGoToSceneCommand(DaliAddress target, int scene) throws DaliException {
73 return new DaliStandardCommand(target, 0x10, scene, false);
76 public static DaliStandardCommand createResetCommand(DaliAddress target) throws DaliException {
77 return new DaliStandardCommand(target, 0x20, 0, true);
80 public static DaliStandardCommand createQueryStatusCommand(DaliAddress target) throws DaliException {
81 return new DaliStandardCommand(target, 0x90, 0, false);
84 public static DaliStandardCommand createQueryActualLevelCommand(DaliAddress target) throws DaliException {
85 return new DaliStandardCommand(target, 0xa0, 0, false);