]> git.basschouten.com Git - openhab-addons.git/blob
8c3ef86a25bb3b44dbc1f132ecfb7d7fe8c3586b
[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.novafinedust.internal.sds011protocol.messages;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Reply from sensor to a set sleep command
19  *
20  * @author Stefan Triller - Initial contribution
21  *
22  */
23 @NonNullByDefault
24 public class SleepReply extends SensorReply {
25
26     private final byte actionType;
27     private final byte sleep;
28
29     public SleepReply(byte[] bytes) {
30         super(bytes);
31
32         this.actionType = bytes[3];
33         this.sleep = bytes[4];
34     }
35
36     /**
37      * Get the type of action
38      *
39      * @return 0 = query 1 = set mode
40      */
41     public byte getActionType() {
42         return actionType;
43     }
44
45     /**
46      * Get the info whether this is a sleep or wakeup reply
47      *
48      * @return 0 = sleep 1 = work
49      */
50     public byte getSleep() {
51         return sleep;
52     }
53
54     @Override
55     public String toString() {
56         return "SleepReply: [sleep=" + sleep + "]";
57     }
58 }