]> git.basschouten.com Git - openhab-addons.git/blob
420d780c2ddbec8f841e9efe9118960c6bbdca3b
[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.samsungtv.internal.protocol;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The {@link RemoteController} is the base class for handling remote control keys for the Samsung TV.
20  *
21  * @author Arjan Mels - Initial contribution
22  * @author Nick Waterton - added getArtmodeStatus(), sendKeyPress()
23  */
24 @NonNullByDefault
25 public abstract class RemoteController implements AutoCloseable {
26     protected String host;
27     protected int port;
28     protected String appName;
29     protected String uniqueId;
30
31     public RemoteController(String host, int port, @Nullable String appName, @Nullable String uniqueId) {
32         this.host = host;
33         this.port = port;
34         this.appName = appName != null ? appName : "";
35         this.uniqueId = uniqueId != null ? uniqueId : "";
36     }
37
38     public abstract void openConnection() throws RemoteControllerException;
39
40     public abstract boolean isConnected();
41
42     public abstract void sendUrl(String command);
43
44     public abstract void sendSourceApp(String command);
45
46     public abstract boolean closeApp();
47
48     public abstract void getAppStatus(String id);
49
50     public abstract void updateCurrentApp();
51
52     public abstract boolean noApps();
53
54     public abstract void sendKeyPress(KeyCode key, int duration);
55
56     public abstract void sendKey(Object key);
57
58     public abstract void getArtmodeStatus(String... optionalRequests);
59
60     @Override
61     public abstract void close() throws RemoteControllerException;
62 }