2 * Copyright (c) 2010-2022 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.yamahareceiver.internal.protocol;
15 import java.util.function.Supplier;
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;
31 * Factory to create an {@link AbstractConnection} connection object based on a feature test.
32 * Also returns implementation objects for all the protocol interfaces.
34 * At the moment only the XML protocol is supported.
36 * @author David Graeff - Initial contribution
37 * @author Tomasz Maruszak - Input mapping fix, refactoring
39 public interface ProtocolFactory {
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.
44 * @param host The host name
45 * @param connectionStateListener
47 void createConnection(String host, ConnectionStateListener connectionStateListener);
49 SystemControl SystemControl(AbstractConnection connection, SystemControlStateListener listener,
50 DeviceInformationState deviceInformationState);
52 InputWithPlayControl InputWithPlayControl(AbstractConnection connection, String currentInputID,
53 PlayInfoStateListener listener, YamahaBridgeConfig settings, DeviceInformationState deviceInformationState);
55 InputWithPresetControl InputWithPresetControl(AbstractConnection connection, String currentInputID,
56 PresetInfoStateListener listener, DeviceInformationState deviceInformationState);
58 InputWithTunerBandControl InputWithDabBandControl(String currentInputID, AbstractConnection connection,
59 DabBandStateListener observerForBand, PresetInfoStateListener observerForPreset,
60 PlayInfoStateListener observerForPlayInfo, DeviceInformationState deviceInformationState);
62 InputWithNavigationControl InputWithNavigationControl(AbstractConnection connection, NavigationControlState state,
63 String inputID, NavigationControlStateListener observer, DeviceInformationState deviceInformationState);
65 ZoneControl ZoneControl(AbstractConnection connection, YamahaZoneConfig zoneSettings,
66 ZoneControlStateListener listener, Supplier<InputConverter> inputConverterSupplier,
67 DeviceInformationState deviceInformationState);
69 ZoneAvailableInputs ZoneAvailableInputs(AbstractConnection connection, YamahaZoneConfig zoneSettings,
70 AvailableInputStateListener listener, Supplier<InputConverter> inputConverterSupplier,
71 DeviceInformationState deviceInformationState);
73 DeviceInformation DeviceInformation(AbstractConnection connection, DeviceInformationState state);
75 InputConverter InputConverter(AbstractConnection connection, String setting);