2 * Copyright (c) 2010-2024 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.samsungtv.internal.protocol;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * The {@link RemoteController} is the base class for handling remote control keys for the Samsung TV.
21 * @author Arjan Mels - Initial contribution
22 * @author Nick Waterton - added getArtmodeStatus(), sendKeyPress()
25 public abstract class RemoteController implements AutoCloseable {
26 protected String host;
28 protected String appName;
29 protected String uniqueId;
31 public RemoteController(String host, int port, @Nullable String appName, @Nullable String uniqueId) {
34 this.appName = appName != null ? appName : "";
35 this.uniqueId = uniqueId != null ? uniqueId : "";
38 public abstract void openConnection() throws RemoteControllerException;
40 public abstract boolean isConnected();
42 public abstract void sendUrl(String command);
44 public abstract void sendSourceApp(String command);
46 public abstract boolean closeApp();
48 public abstract void getAppStatus(String id);
50 public abstract void updateCurrentApp();
52 public abstract boolean noApps();
54 public abstract void sendKeyPress(KeyCode key, int duration);
56 public abstract void sendKey(Object key);
58 public abstract void getArtmodeStatus(String... optionalRequests);
61 public abstract void close() throws RemoteControllerException;