]> git.basschouten.com Git - openhab-addons.git/blob
b403c9166aec1048c8f3401f8c568e476fcbe154
[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.qbus.internal.protocol;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Class {@link QbusMessageCmd} used as input to gson to send commands to Qbus. Extends
19  * {@link QbusMessageBase}.
20  * <p>
21  * Example: <code>{"cmd":"executebistabiel","id":1,"value1":0}</code>
22  *
23  * @author Koen Schockaert - Initial Contribution
24  */
25
26 @NonNullByDefault
27 class QbusMessageCmd extends QbusMessageBase {
28
29     QbusMessageCmd(String CTD) {
30         super.setSn(CTD);
31     }
32
33     QbusMessageCmd(String CTD, String cmd) {
34         this(CTD);
35         this.cmd = cmd;
36     }
37
38     QbusMessageCmd withId(Integer id) {
39         this.setId(id);
40         return this;
41     }
42
43     QbusMessageCmd withState(int state) {
44         this.setState(state);
45         return this;
46     }
47
48     QbusMessageCmd withMode(int mode) {
49         this.setMode(mode);
50         return this;
51     }
52
53     QbusMessageCmd withSetPoint(Double setpoint) {
54         this.setSetPoint(setpoint);
55         return this;
56     }
57
58     QbusMessageCmd withSlatState(int slatState) {
59         this.setSlatState(slatState);
60         return this;
61     }
62 }