2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.novafinedust.internal.sds011protocol.messages;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.novafinedust.internal.sds011protocol.WorkMode;
19 * Reply from sensor to a set mode command
21 * @author Stefan Triller - Initial contribution
25 public class ModeReply extends SensorReply {
27 private final byte actionType;
28 private final WorkMode mode;
30 public ModeReply(byte[] bytes) {
33 this.actionType = bytes[3];
34 if (bytes[4] == (byte) 1) {
35 this.mode = WorkMode.POLLING;
37 this.mode = WorkMode.REPORTING;
42 * Get the type of action
44 * @return 0 = query 1 = set mode
46 public byte getActionType() {
51 * Get the set work mode
53 * @return work mode set on the sensor
55 public WorkMode getMode() {
60 public String toString() {
61 return "ModeReply: [mode=" + mode + "]";