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.knx.internal.client;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 import tuwien.auto.calimero.DetachEvent;
21 import tuwien.auto.calimero.process.ProcessEvent;
22 import tuwien.auto.calimero.process.ProcessListener;
25 * This implementation of {@link ProcessListener} caches a received frames.
27 * It can be registered to {@link DummyKNXNetworkLink} to receive raw frame data.
29 * @author Holger Friedrich - Initial contribution
33 public class DummyProcessListener implements ProcessListener {
34 private byte[] lastFrame = new byte[0];
35 public static final Logger LOGGER = LoggerFactory.getLogger(DummyProcessListener.class);
37 public DummyProcessListener() {
41 public void detached(@Nullable DetachEvent e) {
42 LOGGER.info("The KNX network link was detached from the process communicator");
46 public void groupWrite(@Nullable ProcessEvent e) {
48 lastFrame = new byte[0];
49 LOGGER.warn("invalid ProcessEvent");
52 LOGGER.info("groupWrite({})", e.toString());
53 lastFrame = e.getASDU(); // clones
57 public void groupReadRequest(@Nullable ProcessEvent e) {
59 lastFrame = new byte[0];
60 LOGGER.warn("invalid ProcessEvent");
63 LOGGER.warn("groupReadRequest({})", e.toString());
64 lastFrame = e.getASDU(); // clones
68 public void groupReadResponse(@Nullable ProcessEvent e) {
70 lastFrame = new byte[0];
71 LOGGER.warn("invalid ProcessEvent");
74 LOGGER.warn("groupReadResponse({})", e.toString());
75 lastFrame = e.getASDU(); // clones
78 public byte[] getLastFrame() {