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 org.openhab.binding.enocean.internal.Helper;
19 * @author Daniel Weber - Initial contribution
21 public class RDBaseIdResponse extends Response {
23 private byte[] baseId = null;
24 private int remainingWriteCycles = 0;
26 public RDBaseIdResponse(Response response) {
27 this(response.getPayload().length, response.getOptionalPayload().length,
28 Helper.concatAll(response.getPayload(), response.getOptionalPayload()));
31 RDBaseIdResponse(int dataLength, int optionalDataLength, byte[] payload) {
32 super(dataLength, optionalDataLength, payload);
34 if (this.data == null || this.data.length != 5 || this.optionalData == null || this.optionalData.length != 1) {
38 baseId = getPayload(1, 4);
39 remainingWriteCycles = optionalData[0] & 0xFF;
44 public final byte[] getBaseId() {
48 public int getRemainingWriteCycles() {
49 return remainingWriteCycles;