]> git.basschouten.com Git - openhab-addons.git/blob
79d130d032bcad5e30c6a05d0fcdb27b536152d6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.lgtvserial.internal.protocol.serial;
14
15 import java.io.IOException;
16
17 import org.openhab.core.thing.ChannelUID;
18
19 /**
20  * This interface represents an LG serial command.
21  *
22  * @author Richard Lavoie - Initial contribution
23  */
24 public interface LGSerialCommand {
25
26     /**
27      * Parse the response string into a response object. If null is returned, it means the result cannot be used to
28      * update a linked item state. This is useful to have one way commands.
29      *
30      * @param response Response to parse
31      * @return Response object
32      */
33     LGSerialResponse parseResponse(String response);
34
35     /**
36      * This method is used to send the serial protocol command to the communicator.
37      *
38      * @param channel Channel related to the command
39      * @param comm Communicator linked to the serial port
40      * @param data Data related to this command to send over the wire. If null, this means we should send an FF state
41      *            read command.
42      * @throws IOException
43      */
44     void execute(ChannelUID channel, LGSerialCommunicator comm, Object data) throws IOException;
45 }