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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.enocean.internal.Helper;
17 import org.openhab.binding.enocean.internal.messages.Response;
21 * @author Daniel Weber - Initial contribution
24 public class RDBaseIdResponse extends Response {
26 private byte[] baseId = new byte[0];
27 private int remainingWriteCycles = 0;
29 public RDBaseIdResponse(Response response) {
30 this(response.getPayload().length, response.getOptionalPayload().length,
31 Helper.concatAll(response.getPayload(), response.getOptionalPayload()));
34 RDBaseIdResponse(int dataLength, int optionalDataLength, byte[] payload) {
35 super(dataLength, optionalDataLength, payload);
37 if (this.data.length != 5 || this.optionalData.length != 1) {
41 baseId = getPayload(1, 4);
42 remainingWriteCycles = optionalData[0] & 0xFF;
47 public final byte[] getBaseId() {
51 public int getRemainingWriteCycles() {
52 return remainingWriteCycles;