]> git.basschouten.com Git - openhab-addons.git/blob
626ec16eb166f5c9e30d70ef1ab78cd3203b186e
[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 working period command
19  *
20  * @author Stefan Triller - Initial contribution
21  *
22  */
23 @NonNullByDefault
24 public class WorkingPeriodReply extends SensorReply {
25
26     private final byte actionType;
27     private final byte period;
28
29     public WorkingPeriodReply(byte[] bytes) {
30         super(bytes);
31
32         this.actionType = bytes[3];
33         this.period = 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 set working period
47      *
48      * @return working period set on the sensor
49      */
50     public byte getPeriod() {
51         return period;
52     }
53
54     @Override
55     public String toString() {
56         return "WorkingPeriodReply: [Period=" + this.period + "]";
57     }
58 }