]> git.basschouten.com Git - openhab-addons.git/blob
e4a334b7a3c51b84bd2d7121a60ad07e817fd261
[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.nikohomecontrol.internal.protocol.nhc1;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Class {@link NhcMessageCmd1} used as input to gson to send commands to Niko Home Control. Extends
19  * {@link NhcMessageBase1}.
20  * <p>
21  * Example: <code>{"cmd":"executeactions","id":1,"value1":0}</code>
22  *
23  * @author Mark Herwege - Initial Contribution
24  */
25 @SuppressWarnings("unused")
26 @NonNullByDefault
27 class NhcMessageCmd1 extends NhcMessageBase1 {
28
29     private int id;
30     private int value1;
31     private int value2;
32     private int value3;
33     private int mode;
34     private int overrule;
35     private String overruletime = "";
36
37     NhcMessageCmd1(String cmd) {
38         super.setCmd(cmd);
39     }
40
41     NhcMessageCmd1(String cmd, int id) {
42         this(cmd);
43         this.id = id;
44     }
45
46     NhcMessageCmd1(String cmd, int id, int value1) {
47         this(cmd, id);
48         this.value1 = value1;
49     }
50
51     NhcMessageCmd1(String cmd, int id, int value1, int value2, int value3) {
52         this(cmd, id, value1);
53         this.value2 = value2;
54         this.value3 = value3;
55     }
56
57     NhcMessageCmd1 withMode(int mode) {
58         this.mode = mode;
59         return this;
60     }
61
62     NhcMessageCmd1 withOverrule(int overrule) {
63         this.overrule = overrule;
64         return this;
65     }
66
67     NhcMessageCmd1 withOverruletime(String overruletime) {
68         this.overruletime = overruletime;
69         return this;
70     }
71 }