2 * Copyright (c) 2010-2020 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.enocean.internal.messages;
15 import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.openhab.core.library.types.StringType;
22 * @author Daniel Weber - Initial contribution
24 public class RDRepeaterResponse extends Response {
26 protected String repeaterLevel;
28 public RDRepeaterResponse(Response response) {
29 this(response.getPayload().length, 0, response.getPayload());
32 RDRepeaterResponse(int dataLength, int optionalDataLength, byte[] payload) {
33 super(dataLength, optionalDataLength, payload);
35 if (payload == null || payload.length < 3) {
39 if (payload[1] == 0) {
40 repeaterLevel = REPEATERMODE_OFF;
41 } else if (payload[1] == 1 || payload[1] == 2) {
44 repeaterLevel = REPEATERMODE_LEVEL_1;
47 repeaterLevel = REPEATERMODE_LEVEL_2;
50 repeaterLevel = REPEATERMODE_OFF;
61 public StringType getRepeaterLevel() {
62 return StringType.valueOf(repeaterLevel);