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