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.openhab.binding.enocean.internal.Helper;
16 import org.openhab.binding.enocean.internal.messages.Response;
20 * @author Daniel Weber - Initial contribution
22 public class RDBaseIdResponse extends Response {
24 private byte[] baseId = null;
25 private int remainingWriteCycles = 0;
27 public RDBaseIdResponse(Response response) {
28 this(response.getPayload().length, response.getOptionalPayload().length,
29 Helper.concatAll(response.getPayload(), response.getOptionalPayload()));
32 RDBaseIdResponse(int dataLength, int optionalDataLength, byte[] payload) {
33 super(dataLength, optionalDataLength, payload);
35 if (this.data == null || this.data.length != 5 || this.optionalData == null || this.optionalData.length != 1) {
39 baseId = getPayload(1, 4);
40 remainingWriteCycles = optionalData[0] & 0xFF;
45 public final byte[] getBaseId() {
49 public int getRemainingWriteCycles() {
50 return remainingWriteCycles;