]> git.basschouten.com Git - openhab-addons.git/blob
78ee8e3034fbaecf1b79b3d562d91fd61e4791ba
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.pioneeravr.internal.protocol.avr;
14
15 import org.openhab.binding.pioneeravr.internal.protocol.Response.ResponseType;
16
17 /**
18  * Represent a response of the AVR.
19  *
20  * @author Antoine Besnard - Initial contribution
21  */
22 public interface AvrResponse {
23
24     /**
25      * Represent the type of a response.
26      */
27     public interface AvrResponseType {
28
29         /**
30          * Return the prefix of the command of this type.
31          *
32          * @param zone
33          * @return
34          */
35         public String getResponsePrefix(int zone);
36
37         /**
38          * Return true if the responses of this type has to have a parameter.
39          *
40          * @return
41          */
42         public boolean hasParameter();
43
44         /**
45          * Return the parameter pattern (RegEx) of the response.
46          *
47          * @return
48          */
49         public String getParameterPattern();
50
51         /**
52          * Return the zone number if the responseData matches a zone of this responseType.
53          *
54          * If any zone matches, return null.
55          *
56          * @param responseData
57          * @return
58          */
59         public Integer match(String responseData);
60
61         /**
62          * Return the parameter value of the given responseData.
63          *
64          * @param responseData
65          * @return
66          */
67         public String parseParameter(String responseData);
68     }
69
70     /**
71      * Return the response type of this response
72      *
73      * @return
74      */
75     public ResponseType getResponseType();
76
77     /**
78      * Return the parameter of this response or null if the resposne has no parameter.
79      *
80      * @return
81      */
82     public String getParameterValue();
83
84     /**
85      * Return true if this response has a parameter.
86      *
87      * @return
88      */
89     public boolean hasParameter();
90
91     /**
92      * Return the zone number which is concerned by this response.
93      *
94      * @return
95      */
96     public Integer getZone();
97 }