]> git.basschouten.com Git - openhab-addons.git/blob
621c9cbaefabe8dfd4ff234197987eb25d8cbb41
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.lcn.internal.connection;
14
15 import java.io.IOException;
16 import java.io.OutputStream;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19
20 /**
21  * Base class for a packet to be send to LCN-PCHK.
22  *
23  * @author Tobias Jüttner - Initial Contribution
24  * @author Fabian Wolter - Migration to OH2
25  */
26 @NonNullByDefault
27 public abstract class SendData {
28     /**
29      * Writes the packet's data into the given buffer.
30      * Called right before the packet is actually sent to LCN-PCHK.
31      *
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
36      */
37     abstract boolean write(OutputStream buffer, int localSegId) throws IOException;
38 }