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.enocean.internal.messages.Responses;
15 import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.openhab.binding.enocean.internal.messages.Response;
19 import org.openhab.core.library.types.StringType;
23 * @author Daniel Weber - Initial contribution
25 public class RDRepeaterResponse extends Response {
27 protected String repeaterLevel;
29 public RDRepeaterResponse(Response response) {
30 this(response.getPayload().length, 0, response.getPayload());
33 RDRepeaterResponse(int dataLength, int optionalDataLength, byte[] payload) {
34 super(dataLength, optionalDataLength, payload);
36 if (payload == null || payload.length < 3) {
40 if (payload[1] == 0) {
41 repeaterLevel = REPEATERMODE_OFF;
42 } else if (payload[1] == 1 || payload[1] == 2) {
45 repeaterLevel = REPEATERMODE_LEVEL_1;
48 repeaterLevel = REPEATERMODE_LEVEL_2;
51 repeaterLevel = REPEATERMODE_OFF;
62 public StringType getRepeaterLevel() {
63 return StringType.valueOf(repeaterLevel);