]> git.basschouten.com Git - openhab-addons.git/blob
c239b0911ee41d8a69c94738387423dd38c39454
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.dali.internal.protocol;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.dali.internal.handler.DaliException;
17
18 /**
19  * The {@link DaliStandardCommand} represents different types of commands for
20  * controlling DALI equipment.
21  *
22  * @author Robert Schmid - Initial contribution
23  */
24 @NonNullByDefault
25 public class DaliStandardCommand extends DaliGearCommandBase {
26
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)) })),
29                 sendTwice);
30     }
31
32     public static DaliStandardCommand createOffCommand(DaliAddress target) throws DaliException {
33         return new DaliStandardCommand(target, 0x00, 0, false);
34     }
35
36     public static DaliStandardCommand createUpCommand(DaliAddress target) throws DaliException {
37         return new DaliStandardCommand(target, 0x01, 0, false);
38     }
39
40     public static DaliStandardCommand createDownCommand(DaliAddress target) throws DaliException {
41         return new DaliStandardCommand(target, 0x02, 0, false);
42     }
43
44     public static DaliStandardCommand createStepUpCommand(DaliAddress target) throws DaliException {
45         return new DaliStandardCommand(target, 0x03, 0, false);
46     }
47
48     public static DaliStandardCommand createStepDownCommand(DaliAddress target) throws DaliException {
49         return new DaliStandardCommand(target, 0x04, 0, false);
50     }
51
52     public static DaliStandardCommand createRecallMaxLevelCommand(DaliAddress target) throws DaliException {
53         return new DaliStandardCommand(target, 0x05, 0, false);
54     }
55
56     public static DaliStandardCommand createRecallMinLevelCommand(DaliAddress target) throws DaliException {
57         return new DaliStandardCommand(target, 0x06, 0, false);
58     }
59
60     public static DaliStandardCommand createStepDownAndOffCommand(DaliAddress target) throws DaliException {
61         return new DaliStandardCommand(target, 0x07, 0, false);
62     }
63
64     public static DaliStandardCommand createOnAndStepUpCommand(DaliAddress target) throws DaliException {
65         return new DaliStandardCommand(target, 0x08, 0, false);
66     }
67
68     public static DaliStandardCommand createEnableDAPCSequenceCommand(DaliAddress target) throws DaliException {
69         return new DaliStandardCommand(target, 0x09, 0, false);
70     }
71
72     public static DaliStandardCommand createGoToSceneCommand(DaliAddress target, int scene) throws DaliException {
73         return new DaliStandardCommand(target, 0x10, scene, false);
74     }
75
76     public static DaliStandardCommand createResetCommand(DaliAddress target) throws DaliException {
77         return new DaliStandardCommand(target, 0x20, 0, true);
78     }
79
80     public static DaliStandardCommand createQueryStatusCommand(DaliAddress target) throws DaliException {
81         return new DaliStandardCommand(target, 0x90, 0, false);
82     }
83
84     public static DaliStandardCommand createQueryActualLevelCommand(DaliAddress target) throws DaliException {
85         return new DaliStandardCommand(target, 0xa0, 0, false);
86     }
87 }