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.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.enocean.internal.messages.ERP1Message;
22 * @author Daniel Weber - Initial contribution
25 public class UTEResponse extends _VLDMessage {
27 public static final byte TEACHIN_MASK = 0x3f;
28 public static final byte COMMUNICATION_TYPE_MASK = (byte) 0x80;
29 public static final byte RESPONSE_NEEDED_MASK = 0x40;
30 public static final byte TEACHIN_NPTSPECIFIED = 0x20;
32 public UTEResponse(ERP1Message packet, boolean teachIn) {
33 int dataLength = packet.getPayload().length - ESP3_SENDERID_LENGTH - ESP3_RORG_LENGTH - ESP3_STATUS_LENGTH;
35 setData(packet.getPayload(ESP3_RORG_LENGTH, dataLength));
36 bytes[0] = (byte) (teachIn ? 0x91 : 0xA1); // bidirectional communication, teach in accepted or teach out, teach
39 setStatus((byte) 0x80);
40 setSuppressRepeating(true);
41 setDestinationId(packet.getSenderId());