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.eep.Base;
15 import static org.openhab.binding.enocean.internal.messages.ESP3Packet.*;
17 import org.openhab.binding.enocean.internal.messages.ERP1Message;
21 * @author Daniel Weber - Initial contribution
23 public class UTEResponse extends _VLDMessage {
25 public static final byte TeachIn_MASK = 0x3f;
26 public static final byte CommunicationType_MASK = (byte) 0x80;
27 public static final byte ResponseNeeded_MASK = 0x40;
28 public static final byte TeachIn_NotSpecified = 0x20;
30 public UTEResponse(ERP1Message packet, boolean teachIn) {
31 int dataLength = packet.getPayload().length - ESP3_SENDERID_LENGTH - ESP3_RORG_LENGTH - ESP3_STATUS_LENGTH;
33 setData(packet.getPayload(ESP3_RORG_LENGTH, dataLength));
34 bytes[0] = (byte) (teachIn ? 0x91 : 0xA1); // bidirectional communication, teach in accepted or teach out, teach
37 setStatus((byte) 0x80);
38 setSuppressRepeating(true);
39 setDestinationId(packet.getSenderId());