]> git.basschouten.com Git - openhab-addons.git/blob
b6824b9157938382ffe431c3f83d12a2d5786e07
[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.powermax.internal.connector;
14
15 import java.io.IOException;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.powermax.internal.message.PowermaxMessageEventListener;
19
20 /**
21  * Interface for communication with the Visonic alarm panel
22  *
23  * @author Laurent Garnier - Initial contribution
24  */
25 @NonNullByDefault
26 public interface PowermaxConnectorInterface {
27
28     /**
29      * Method for opening a connection to the Visonic alarm panel.
30      */
31     public void open() throws Exception;
32
33     /**
34      * Method for closing a connection to the Visonic alarm panel.
35      */
36     public void close();
37
38     /**
39      * Returns connection status
40      *
41      * @return: true if connected or false if not
42      **/
43     public boolean isConnected();
44
45     /**
46      * Method for sending a message to the Visonic alarm panel
47      *
48      * @param data the message as a table of bytes
49      **/
50     public void sendMessage(byte[] data);
51
52     /**
53      * Method for reading data from the Visonic alarm panel
54      *
55      * @param buffer the buffer into which the data is read
56      **/
57     public int read(byte[] buffer) throws IOException;
58
59     /**
60      * Method for registering an event listener
61      *
62      * @param listener the listener to be registered
63      */
64     public void addEventListener(PowermaxMessageEventListener listener);
65
66     /**
67      * Method for removing an event listener
68      *
69      * @param listener the listener to be removed
70      */
71     public void removeEventListener(PowermaxMessageEventListener listener);
72 }