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.lcn.internal.connection;
15 import java.io.IOException;
16 import java.io.OutputStream;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
21 * Base class for a packet to be send to LCN-PCHK.
23 * @author Tobias Jüttner - Initial Contribution
24 * @author Fabian Wolter - Migration to OH2
27 public abstract class SendData {
29 * Writes the packet's data into the given buffer.
30 * Called right before the packet is actually sent to LCN-PCHK.
32 * @param buffer the target buffer
33 * @param localSegId the local segment id
34 * @return true if everything was set-up correctly and data was written
35 * @throws IOException if an I/O error occurs
37 abstract boolean write(OutputStream buffer, int localSegId) throws IOException;