]> git.basschouten.com Git - openhab-addons.git/blob
403e97427ea6eb9e245a7d208a1ad45612f90b3b
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.denonmarantz.internal.connector;
14
15 import java.util.concurrent.ScheduledExecutorService;
16
17 import org.eclipse.jetty.client.HttpClient;
18 import org.openhab.binding.denonmarantz.internal.DenonMarantzState;
19 import org.openhab.binding.denonmarantz.internal.config.DenonMarantzConfiguration;
20 import org.openhab.binding.denonmarantz.internal.connector.http.DenonMarantzHttpConnector;
21 import org.openhab.binding.denonmarantz.internal.connector.telnet.DenonMarantzTelnetConnector;
22
23 /**
24  * Returns the connector based on the configuration.
25  * Currently there are 2 types: HTTP and Telnet
26  *
27  * @author Jan-Willem Veldhuis - Initial contribution
28  */
29 public class DenonMarantzConnectorFactory {
30
31     public DenonMarantzConnector getConnector(DenonMarantzConfiguration config, DenonMarantzState state,
32             ScheduledExecutorService scheduler, HttpClient httpClient, String thingUID) {
33         if (config.isTelnet()) {
34             return new DenonMarantzTelnetConnector(config, state, scheduler, thingUID);
35         } else {
36             return new DenonMarantzHttpConnector(config, state, scheduler, httpClient);
37         }
38     }
39 }