]> git.basschouten.com Git - openhab-addons.git/blob
87f1e96d7bdceafed60b0c1eeba8dfdf3ac33490
[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.yamahareceiver.internal.protocol;
14
15 import java.util.function.Supplier;
16
17 import org.openhab.binding.yamahareceiver.internal.config.YamahaBridgeConfig;
18 import org.openhab.binding.yamahareceiver.internal.config.YamahaZoneConfig;
19 import org.openhab.binding.yamahareceiver.internal.protocol.xml.XMLConnection;
20 import org.openhab.binding.yamahareceiver.internal.state.AvailableInputStateListener;
21 import org.openhab.binding.yamahareceiver.internal.state.DabBandStateListener;
22 import org.openhab.binding.yamahareceiver.internal.state.DeviceInformationState;
23 import org.openhab.binding.yamahareceiver.internal.state.NavigationControlState;
24 import org.openhab.binding.yamahareceiver.internal.state.NavigationControlStateListener;
25 import org.openhab.binding.yamahareceiver.internal.state.PlayInfoStateListener;
26 import org.openhab.binding.yamahareceiver.internal.state.PresetInfoStateListener;
27 import org.openhab.binding.yamahareceiver.internal.state.SystemControlStateListener;
28 import org.openhab.binding.yamahareceiver.internal.state.ZoneControlStateListener;
29
30 /**
31  * Factory to create an {@link AbstractConnection} connection object based on a feature test.
32  * Also returns implementation objects for all the protocol interfaces.
33  * <p>
34  * At the moment only the XML protocol is supported.
35  *
36  * @author David Graeff - Initial contribution
37  * @author Tomasz Maruszak - Input mapping fix, refactoring
38  */
39 public interface ProtocolFactory {
40     /**
41      * Asynchronous method to create and return a connection object. Depending
42      * on the feature test it might be either an {@link XMLConnection} or a JsonConnection.
43      *
44      * @param host The host name
45      * @param connectionStateListener
46      */
47     void createConnection(String host, ConnectionStateListener connectionStateListener);
48
49     SystemControl SystemControl(AbstractConnection connection, SystemControlStateListener listener,
50             DeviceInformationState deviceInformationState);
51
52     InputWithPlayControl InputWithPlayControl(AbstractConnection connection, String currentInputID,
53             PlayInfoStateListener listener, YamahaBridgeConfig settings, DeviceInformationState deviceInformationState);
54
55     InputWithPresetControl InputWithPresetControl(AbstractConnection connection, String currentInputID,
56             PresetInfoStateListener listener, DeviceInformationState deviceInformationState);
57
58     InputWithTunerBandControl InputWithDabBandControl(String currentInputID, AbstractConnection connection,
59             DabBandStateListener observerForBand, PresetInfoStateListener observerForPreset,
60             PlayInfoStateListener observerForPlayInfo, DeviceInformationState deviceInformationState);
61
62     InputWithNavigationControl InputWithNavigationControl(AbstractConnection connection, NavigationControlState state,
63             String inputID, NavigationControlStateListener observer, DeviceInformationState deviceInformationState);
64
65     ZoneControl ZoneControl(AbstractConnection connection, YamahaZoneConfig zoneSettings,
66             ZoneControlStateListener listener, Supplier<InputConverter> inputConverterSupplier,
67             DeviceInformationState deviceInformationState);
68
69     ZoneAvailableInputs ZoneAvailableInputs(AbstractConnection connection, YamahaZoneConfig zoneSettings,
70             AvailableInputStateListener listener, Supplier<InputConverter> inputConverterSupplier,
71             DeviceInformationState deviceInformationState);
72
73     DeviceInformation DeviceInformation(AbstractConnection connection, DeviceInformationState state);
74
75     InputConverter InputConverter(AbstractConnection connection, String setting);
76 }