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.elerotransmitterstick.internal.stick;
15 import java.util.Arrays;
18 * @author Volker Bier - Initial contribution
20 public class ResponseUtil {
22 public static Response createResponse(byte upperChannelByte, byte lowerChannelByte) {
23 return new Response(getChannelIds(upperChannelByte, lowerChannelByte));
26 public static Response createResponse(byte upperChannelByte, byte lowerChannelByte, byte responseType) {
27 return new Response(ResponseStatus.getFor(responseType), getChannelIds(upperChannelByte, lowerChannelByte));
31 * returns the list of channels (starting with 1)
33 public static int[] getChannelIds(byte upperChannelByte, byte lowerChannelByte) {
34 int[] result = new int[16];
37 byte b = lowerChannelByte;
38 for (int i = 0; i < 8; i++) {
40 result[idx++] = i + 1;
46 for (int i = 0; i < 8; i++) {
48 result[idx++] = i + 9;
53 return Arrays.copyOfRange(result, 0, idx);