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.NonNullByDefault;
18 import org.openhab.binding.enocean.internal.messages.Response;
19 import org.openhab.core.library.types.StringType;
23 * @author Daniel Weber - Initial contribution
26 public class RDRepeaterResponse extends Response {
28 protected String repeaterLevel = "";
30 public RDRepeaterResponse(Response response) {
31 this(response.getPayload().length, 0, response.getPayload());
34 RDRepeaterResponse(int dataLength, int optionalDataLength, byte[] payload) {
35 super(dataLength, optionalDataLength, payload);
37 if (payload.length < 3) {
41 if (payload[1] == 0) {
42 repeaterLevel = REPEATERMODE_OFF;
43 } else if (payload[1] == 1 || payload[1] == 2) {
46 repeaterLevel = REPEATERMODE_LEVEL_1;
49 repeaterLevel = REPEATERMODE_LEVEL_2;
52 repeaterLevel = REPEATERMODE_OFF;
62 public StringType getRepeaterLevel() {
63 return StringType.valueOf(repeaterLevel);