]> git.basschouten.com Git - openhab-addons.git/blob
b1f9da02228d1e1fcb116f6101091c6023e67742
[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.vizio.internal.enums;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@link KeyCommand} class provides enum values for remote control button press commands.
19  *
20  * @author Michael Lobstein - Initial contribution
21  */
22 @NonNullByDefault
23 public enum KeyCommand {
24     SEEKFWD(2, 0),
25     SEEKBACK(2, 1),
26     PAUSE(2, 2),
27     PLAY(2, 3),
28     DOWN(3, 0),
29     LEFT(3, 1),
30     OK(3, 2),
31     LEFT2(3, 4),
32     RIGHT(3, 7),
33     UP(3, 8),
34     BACK(4, 0),
35     SMARTCAST(4, 3),
36     CCTOGGLE(4, 4),
37     INFO(4, 6),
38     MENU(4, 8),
39     HOME(4, 15),
40     VOLUMEDOWN(5, 0),
41     VOLUMEUP(5, 1),
42     MUTEOFF(5, 2),
43     MUTEON(5, 3),
44     MUTETOGGLE(5, 4),
45     PICTUREMODE(6, 0),
46     WIDEMODE(6, 1),
47     WIDETOGGLE(6, 2),
48     INPUTTOGGLE(7, 1),
49     CHANNELDOWN(8, 0),
50     CHANNELUP(8, 1),
51     PREVIOUSCH(8, 2),
52     EXIT(9, 0),
53     POWEROFF(11, 0),
54     POWERON(11, 1),
55     POWERTOGGLE(11, 2);
56
57     private static final String KEY_COMMAND_STR = "{\"KEYLIST\": [{\"CODESET\": %d,\"CODE\": %d,\"ACTION\":\"KEYPRESS\"}]}";
58
59     private final int codeSet;
60     private final int code;
61
62     KeyCommand(int codeSet, int code) {
63         this.codeSet = codeSet;
64         this.code = code;
65     }
66
67     public String getJson() {
68         return String.format(KEY_COMMAND_STR, codeSet, code);
69     }
70 }