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.pioneeravr.internal.protocol.avr;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.openhab.binding.pioneeravr.internal.protocol.Response.ResponseType;
19 * Represent a response of the AVR.
21 * @author Antoine Besnard - Initial contribution
23 public interface AvrResponse {
26 * Represent the type of a response.
28 interface AvrResponseType {
31 * Return the prefix of the command of this type.
36 public String getResponsePrefix(int zone);
39 * Return true if the responses of this type has to have a parameter.
43 public boolean hasParameter();
46 * Return the parameter pattern (RegEx) of the response.
50 public @Nullable String getParameterPattern();
53 * Return the zone number if the responseData matches a zone of this responseType.
55 * If any zone matches, return null.
60 public Integer match(String responseData);
63 * Return the parameter value of the given responseData.
68 public String parseParameter(String responseData);
72 * Return the response type of this response
76 ResponseType getResponseType();
79 * Return the parameter of this response or null if the resposne has no parameter.
83 String getParameterValue();
86 * Return true if this response has a parameter.
90 boolean hasParameter();
93 * Return the zone number which is concerned by this response.