]> git.basschouten.com Git - openhab-addons.git/blob
6d2a561c200364a51903c8d250304a78bc2e18dc
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.rotel.internal.communication;
14
15 import static org.openhab.binding.rotel.internal.RotelBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.rotel.internal.RotelException;
20
21 /**
22  * Represents the different kinds of commands
23  *
24  * @author Laurent Garnier - Initial contribution
25  */
26 @NonNullByDefault
27 public enum RotelCommand {
28
29     POWER_TOGGLE("Power Toggle", PRIMARY_CMD, (byte) 0x0A, "power_toggle", "power_toggle"),
30     POWER_OFF("Power Off", PRIMARY_CMD, (byte) 0x4A, "power_off", "power_off"),
31     POWER_ON("Power On", PRIMARY_CMD, (byte) 0x4B, "power_on", "power_on"),
32     POWER("Request current power status", "get_current_power", "power?"),
33     ZONE_SELECT("Zone Select", PRIMARY_CMD, (byte) 0x23),
34     MAIN_ZONE_POWER_TOGGLE("Main Zone Power Toggle", MAIN_ZONE_CMD, (byte) 0x0A),
35     MAIN_ZONE_POWER_OFF("Main Zone Power Off", MAIN_ZONE_CMD, (byte) 0x4A),
36     MAIN_ZONE_POWER_ON("Main Zone Power On", MAIN_ZONE_CMD, (byte) 0x4B),
37     ZONE2_POWER_TOGGLE("Zone 2 Power Toggle", ZONE2_CMD, (byte) 0x0A),
38     ZONE2_POWER_OFF("Zone 2 Power Off", ZONE2_CMD, (byte) 0x4A),
39     ZONE2_POWER_ON("Zone 2 Power On", ZONE2_CMD, (byte) 0x4B),
40     ZONE3_POWER_TOGGLE("Zone 3 Power Toggle", ZONE3_CMD, (byte) 0x0A),
41     ZONE3_POWER_OFF("Zone 3 Power Off", ZONE3_CMD, (byte) 0x4A),
42     ZONE3_POWER_ON("Zone 3 Power On", ZONE3_CMD, (byte) 0x4B),
43     ZONE4_POWER_TOGGLE("Zone 4 Power Toggle", ZONE4_CMD, (byte) 0x0A),
44     ZONE4_POWER_OFF("Zone 4 Power Off", ZONE4_CMD, (byte) 0x4A),
45     ZONE4_POWER_ON("Zone 4 Power On", ZONE4_CMD, (byte) 0x4B),
46     VOLUME_UP("Volume Up", PRIMARY_CMD, (byte) 0x0B, "volume_up", "vol_up"),
47     VOLUME_DOWN("Volume Down", PRIMARY_CMD, (byte) 0x0C, "volume_down", "vol_dwn"),
48     VOLUME_SET("Set Volume to level", VOLUME_CMD, (byte) 0, "volume_", "vol_"),
49     VOLUME_GET("Request current volume level", "get_volume", "volume?"),
50     VOLUME_GET_MIN("Request Min volume level", "get_volume_min", null),
51     VOLUME_GET_MAX("Request Max volume level", "get_volume_max", null),
52     MUTE_TOGGLE("Mute Toggle", PRIMARY_CMD, (byte) 0x1E, "mute", "mute"),
53     MUTE_ON("Mute On", "mute_on", "mute_on"),
54     MUTE_OFF("Mute Off", "mute_off", "mute_off"),
55     MUTE("Request current mute status", "get_mute_status", "mute?"),
56     MAIN_ZONE_VOLUME_UP("Main Zone Volume Up", MAIN_ZONE_CMD, (byte) 0),
57     MAIN_ZONE_VOLUME_DOWN("Main Zone Volume Down", MAIN_ZONE_CMD, (byte) 1),
58     MAIN_ZONE_MUTE_TOGGLE("Main Zone Mute Toggle", MAIN_ZONE_CMD, (byte) 0x1E),
59     MAIN_ZONE_MUTE_ON("Main Zone Mute On", MAIN_ZONE_CMD, (byte) 0x6C),
60     MAIN_ZONE_MUTE_OFF("Main Zone Mute Off", MAIN_ZONE_CMD, (byte) 0x6D),
61     ZONE2_VOLUME_UP("Zone 2 Volume Up", ZONE2_CMD, (byte) 0),
62     ZONE2_VOLUME_DOWN("Zone 2 Volume Down", ZONE2_CMD, (byte) 1),
63     ZONE2_VOLUME_SET("Set Zone 2 Volume to level", ZONE2_VOLUME_CMD, (byte) 0),
64     ZONE2_MUTE_TOGGLE("Zone 2 Mute Toggle", ZONE2_CMD, (byte) 0x1E),
65     ZONE2_MUTE_ON("Zone 2 Mute On", ZONE2_CMD, (byte) 0x6C),
66     ZONE2_MUTE_OFF("Zone 2 Mute Off", ZONE2_CMD, (byte) 0x6D),
67     ZONE3_VOLUME_UP("Zone 3 Volume Up", ZONE3_CMD, (byte) 0),
68     ZONE3_VOLUME_DOWN("Zone 3 Volume Down", ZONE3_CMD, (byte) 1),
69     ZONE3_VOLUME_SET("Set Zone 3 Volume to level", ZONE3_VOLUME_CMD, (byte) 0),
70     ZONE3_MUTE_TOGGLE("Zone 3 Mute Toggle", ZONE3_CMD, (byte) 0x1E),
71     ZONE3_MUTE_ON("Zone 3 Mute On", ZONE3_CMD, (byte) 0x6C),
72     ZONE3_MUTE_OFF("Zone 3 Mute Off", ZONE3_CMD, (byte) 0x6D),
73     ZONE4_VOLUME_UP("Zone 4 Volume Up", ZONE4_CMD, (byte) 0),
74     ZONE4_VOLUME_DOWN("Zone 4 Volume Down", ZONE4_CMD, (byte) 1),
75     ZONE4_VOLUME_SET("Set Zone 4 Volume to level", ZONE4_VOLUME_CMD, (byte) 0),
76     ZONE4_MUTE_TOGGLE("Zone 4 Mute Toggle", ZONE4_CMD, (byte) 0x1E),
77     ZONE4_MUTE_ON("Zone 4 Mute On", ZONE4_CMD, (byte) 0x6C),
78     ZONE4_MUTE_OFF("Zone 4 Mute Off", ZONE4_CMD, (byte) 0x6D),
79     SOURCE_CD("Source CD", PRIMARY_CMD, (byte) 0x02, "cd", "cd"),
80     SOURCE_TUNER("Source Tuner", PRIMARY_CMD, (byte) 0x03, "tuner", "tuner"),
81     SOURCE_TAPE("Source Tape", PRIMARY_CMD, (byte) 0x04, "tape", "tape"),
82     SOURCE_VIDEO1("Source Video 1", PRIMARY_CMD, (byte) 0x05, "video1", "video1"),
83     SOURCE_VIDEO2("Source Video 2", PRIMARY_CMD, (byte) 0x06, "video2", "video2"),
84     SOURCE_VIDEO3("Source Video 3", PRIMARY_CMD, (byte) 0x07, "video3", "video3"),
85     SOURCE_VIDEO4("Source Video 4", PRIMARY_CMD, (byte) 0x08, "video4", "video4"),
86     SOURCE_VIDEO5("Source Video 5", PRIMARY_CMD, (byte) 0x09, "video5", "video5"),
87     SOURCE_VIDEO6("Source Video 6", PRIMARY_CMD, (byte) 0x94, "video6", "video6"),
88     SOURCE_VIDEO7("Source Video 7", "video7", "video7"),
89     SOURCE_VIDEO8("Source Video 8", "video8", "video8"),
90     SOURCE_PHONO("Source Phono", PRIMARY_CMD, (byte) 0x35, "phono", "phono"),
91     SOURCE_USB("Source Front USB", PRIMARY_CMD, (byte) 0x8E, "usb", "usb"),
92     SOURCE_PCUSB("Source PC USB", "pc_usb", "pcusb"),
93     SOURCE_MULTI_INPUT("Source Multi Input", PRIMARY_CMD, (byte) 0x15, "multi_input", "multi_input"),
94     SOURCE_AUX("Source Aux", "aux", "aux"),
95     SOURCE_AUX1("Source Aux 1", "aux1", "aux1"),
96     SOURCE_AUX2("Source Aux 2", "aux2", "aux2"),
97     SOURCE_AUX1_COAX("Source Aux 1 Coax", "aux1_coax", "aux1_coax"),
98     SOURCE_AUX1_OPT("Source Aux 1 Optical", "aux1_opt", "aux1_opt"),
99     SOURCE_COAX1("Source Coax 1", "coax1", "coax1"),
100     SOURCE_COAX2("Source Coax 2", "coax2", "coax2"),
101     SOURCE_COAX3("Source Coax 3", "coax3", "coax3"),
102     SOURCE_OPT1("Source Optical 1", "opt1", "opt1"),
103     SOURCE_OPT2("Source Optical 2", "opt2", "opt2"),
104     SOURCE_OPT3("Source Optical 3", "opt3", "opt3"),
105     SOURCE_BLUETOOTH("Source Bluetooth", "bluetooth", "bluetooth"),
106     SOURCE_ROTEL_CD("Source Rotel CD", "rcd", null),
107     SOURCE_XLR("Source XLR", "bal_xlr", "bal_xlr"),
108     SOURCE_XLR1("Source XLR 1", "bal_xlr1", "bal_xlr1"),
109     SOURCE_XLR2("Source XLR 2", "bal_xlr2", "bal_xlr2"),
110     SOURCE_FM("Source FM", "fm", "fm"),
111     SOURCE_DAB("Source DAB", "dab", "dab"),
112     SOURCE_PLAYFI("Source PlayFi", "playfi", "playfi"),
113     SOURCE_IRADIO("Source iRadio", "iradio", "iradio"),
114     SOURCE_NETWORK("Source Network", "network", "network"),
115     SOURCE("Request current source", "get_current_source", "source?"),
116     MAIN_ZONE_SOURCE_CD("Main Zone Source CD", MAIN_ZONE_CMD, (byte) 0x02, "main_zone_cd", "main_zone_cd"),
117     MAIN_ZONE_SOURCE_TUNER("Main Zone Source Tuner", MAIN_ZONE_CMD, (byte) 0x03, "main_zone_tuner", "main_zone_tuner"),
118     MAIN_ZONE_SOURCE_TAPE("Main Zone Source Tape", MAIN_ZONE_CMD, (byte) 0x04, "main_zone_tape", "main_zone_tape"),
119     MAIN_ZONE_SOURCE_VIDEO1("Main Zone Source Video 1", MAIN_ZONE_CMD, (byte) 0x05, "main_zone_video1",
120             "main_zone_video1"),
121     MAIN_ZONE_SOURCE_VIDEO2("Main Zone Source Video 2", MAIN_ZONE_CMD, (byte) 0x06, "main_zone_video2",
122             "main_zone_video2"),
123     MAIN_ZONE_SOURCE_VIDEO3("Main Zone Source Video 3", MAIN_ZONE_CMD, (byte) 0x07, "main_zone_video3",
124             "main_zone_video3"),
125     MAIN_ZONE_SOURCE_VIDEO4("Main Zone Source Video 4", MAIN_ZONE_CMD, (byte) 0x08, "main_zone_video4",
126             "main_zone_video4"),
127     MAIN_ZONE_SOURCE_VIDEO5("Main Zone Source Video 5", MAIN_ZONE_CMD, (byte) 0x09, "main_zone_video5",
128             "main_zone_video5"),
129     MAIN_ZONE_SOURCE_VIDEO6("Main Zone Source Video 6", MAIN_ZONE_CMD, (byte) 0x94, "main_zone_video6",
130             "main_zone_video6"),
131     MAIN_ZONE_SOURCE_USB("Main Zone Source Front USB", MAIN_ZONE_CMD, (byte) 0x8E, "main_zone_usb", "main_zone_usb"),
132     MAIN_ZONE_SOURCE_MULTI_INPUT("Main Zone Source Multi Input", MAIN_ZONE_CMD, (byte) 0x15, "main_zone_multi_input",
133             "main_zone_multi_input"),
134     RECORD_SOURCE_CD("Record Source CD", RECORD_SRC_CMD, (byte) 0x02, "record_cd", "record_cd"),
135     RECORD_SOURCE_TUNER("Record Source Tuner", RECORD_SRC_CMD, (byte) 0x03, "record_tuner", "record_tuner"),
136     RECORD_SOURCE_TAPE("Record Source Tape", RECORD_SRC_CMD, (byte) 0x04, "record_tape", "record_tape"),
137     RECORD_SOURCE_VIDEO1("Record Source Video 1", RECORD_SRC_CMD, (byte) 0x05, "record_video1", "record_video1"),
138     RECORD_SOURCE_VIDEO2("Record Source Video 2", RECORD_SRC_CMD, (byte) 0x06, "record_video2", "record_video2"),
139     RECORD_SOURCE_VIDEO3("Record Source Video 3", RECORD_SRC_CMD, (byte) 0x07, "record_video3", "record_video3"),
140     RECORD_SOURCE_VIDEO4("Record Source Video 4", RECORD_SRC_CMD, (byte) 0x08, "record_video4", "record_video4"),
141     RECORD_SOURCE_VIDEO5("Record Source Video 5", RECORD_SRC_CMD, (byte) 0x09, "record_video5", "record_video5"),
142     RECORD_SOURCE_VIDEO6("Record Source Video 6", RECORD_SRC_CMD, (byte) 0x94, "record_video6", "record_video6"),
143     RECORD_SOURCE_USB("Record Source Front USB", RECORD_SRC_CMD, (byte) 0x8E, "record_usb", "record_usb"),
144     RECORD_SOURCE_MAIN("Record Follow Main Zone Source", RECORD_SRC_CMD, (byte) 0x6B, "record_follow_main",
145             "record_follow_main"),
146     ZONE2_SOURCE_CD("Zone 2 Source CD", ZONE2_CMD, (byte) 0x02, "zone2_cd", "zone2_cd"),
147     ZONE2_SOURCE_TUNER("Zone 2 Source Tuner", ZONE2_CMD, (byte) 0x03, "zone2_tuner", "zone2_tuner"),
148     ZONE2_SOURCE_TAPE("Zone 2 Source Tape", ZONE2_CMD, (byte) 0x04, "zone2_tape", "zone2_tape"),
149     ZONE2_SOURCE_VIDEO1("Zone 2 Source Video 1", ZONE2_CMD, (byte) 0x05, "zone2_video1", "zone2_video1"),
150     ZONE2_SOURCE_VIDEO2("Zone 2 Source Video 2", ZONE2_CMD, (byte) 0x06, "zone2_video2", "zone2_video2"),
151     ZONE2_SOURCE_VIDEO3("Zone 2 Source Video 3", ZONE2_CMD, (byte) 0x07, "zone2_video3", "zone2_video3"),
152     ZONE2_SOURCE_VIDEO4("Zone 2 Source Video 4", ZONE2_CMD, (byte) 0x08, "zone2_video4", "zone2_video4"),
153     ZONE2_SOURCE_VIDEO5("Zone 2 Source Video 5", ZONE2_CMD, (byte) 0x09, "zone2_video5", "zone2_video5"),
154     ZONE2_SOURCE_VIDEO6("Zone 2 Source Video 6", ZONE2_CMD, (byte) 0x94, "zone2_video6", "zone2_video6"),
155     ZONE2_SOURCE_USB("Zone 2 Source Front USB", ZONE2_CMD, (byte) 0x8E, "zone2_usb", "zone2_usb"),
156     ZONE2_SOURCE_MAIN("Zone 2 Follow Main Zone Source", ZONE2_CMD, (byte) 0x6B, "zone2_follow_main",
157             "zone2_follow_main"),
158     ZONE3_SOURCE_CD("Zone 3 Source CD", ZONE3_CMD, (byte) 0x02, "zone3_cd", "zone3_cd"),
159     ZONE3_SOURCE_TUNER("Zone 3 Source Tuner", ZONE3_CMD, (byte) 0x03, "zone3_tuner", "zone3_tuner"),
160     ZONE3_SOURCE_TAPE("Zone 3 Source Tape", ZONE3_CMD, (byte) 0x04, "zone3_tape", "zone3_tape"),
161     ZONE3_SOURCE_VIDEO1("Zone 3 Source Video 1", ZONE3_CMD, (byte) 0x05, "zone3_video1", "zone3_video1"),
162     ZONE3_SOURCE_VIDEO2("Zone 3 Source Video 2", ZONE3_CMD, (byte) 0x06, "zone3_video2", "zone3_video2"),
163     ZONE3_SOURCE_VIDEO3("Zone 3 Source Video 3", ZONE3_CMD, (byte) 0x07, "zone3_video3", "zone3_video3"),
164     ZONE3_SOURCE_VIDEO4("Zone 3 Source Video 4", ZONE3_CMD, (byte) 0x08, "zone3_video4", "zone3_video4"),
165     ZONE3_SOURCE_VIDEO5("Zone 3 Source Video 5", ZONE3_CMD, (byte) 0x09, "zone3_video5", "zone3_video5"),
166     ZONE3_SOURCE_VIDEO6("Zone 3 Source Video 6", ZONE3_CMD, (byte) 0x94, "zone3_video6", "zone3_video6"),
167     ZONE3_SOURCE_USB("Zone 3 Source Front USB", ZONE3_CMD, (byte) 0x8E, "zone3_usb", "zone3_usb"),
168     ZONE3_SOURCE_MAIN("Zone 3 Follow Main Zone Source", ZONE3_CMD, (byte) 0x6B, "zone3_follow_main",
169             "zone3_follow_main"),
170     ZONE4_SOURCE_CD("Zone 4 Source CD", ZONE4_CMD, (byte) 0x02, "zone4_cd", "zone4_cd"),
171     ZONE4_SOURCE_TUNER("Zone 4 Source Tuner", ZONE4_CMD, (byte) 0x03, "zone4_tuner", "zone4_tuner"),
172     ZONE4_SOURCE_TAPE("Zone 4 Source Tape", ZONE4_CMD, (byte) 0x04, "zone4_tape", "zone4_tape"),
173     ZONE4_SOURCE_VIDEO1("Zone 4 Source Video 1", ZONE4_CMD, (byte) 0x05, "zone4_video1", "zone4_video1"),
174     ZONE4_SOURCE_VIDEO2("Zone 4 Source Video 2", ZONE4_CMD, (byte) 0x06, "zone4_video2", "zone4_video2"),
175     ZONE4_SOURCE_VIDEO3("Zone 4 Source Video 3", ZONE4_CMD, (byte) 0x07, "zone4_video3", "zone4_video3"),
176     ZONE4_SOURCE_VIDEO4("Zone 4 Source Video 4", ZONE4_CMD, (byte) 0x08, "zone4_video4", "zone4_video4"),
177     ZONE4_SOURCE_VIDEO5("Zone 4 Source Video 5", ZONE4_CMD, (byte) 0x09, "zone4_video5", "zone4_video5"),
178     ZONE4_SOURCE_VIDEO6("Zone 4 Source Video 6", ZONE4_CMD, (byte) 0x94, "zone4_video6", "zone4_video6"),
179     ZONE4_SOURCE_USB("Zone 4 Source Front USB", ZONE4_CMD, (byte) 0x8E, "zone4_usb", "zone4_usb"),
180     ZONE4_SOURCE_MAIN("Zone 4 Follow Main Zone Source", ZONE4_CMD, (byte) 0x6B, "zone4_follow_main",
181             "zone4_follow_main"),
182     STEREO("Stereo", PRIMARY_CMD, (byte) 0x11, "2channel", "2channel"),
183     STEREO3("Dolby 3 Stereo ", PRIMARY_CMD, (byte) 0x12, "3channel", "3channel"),
184     STEREO5("5 Channel Stereo", PRIMARY_CMD, (byte) 0x5B, "5channel", "5channel"),
185     STEREO7("7 Channel Stereo", PRIMARY_CMD, (byte) 0x5C, "7channel", "7channel"),
186     STEREO9("9 Channel Stereo", "9channel", "9channel"),
187     STEREO11("11 Channel Stereo", "11channel", "11channel"),
188     DSP1("DSP 1", PRIMARY_CMD, (byte) 0x57),
189     DSP2("DSP 2", PRIMARY_CMD, (byte) 0x58),
190     DSP3("DSP 3", PRIMARY_CMD, (byte) 0x59),
191     DSP4("DSP 4", PRIMARY_CMD, (byte) 0x5A),
192     PROLOGIC("Dolby Pro Logic", PRIMARY_CMD, (byte) 0x5F),
193     PLII_CINEMA("Dolby PLII Cinema", PRIMARY_CMD, (byte) 0x5D, "prologic_movie", "prologic_movie"),
194     PLII_MUSIC("Dolby PLII Music", PRIMARY_CMD, (byte) 0x5E, "prologic_music", "prologic_music"),
195     PLII_GAME("Dolby PLII Game", PRIMARY_CMD, (byte) 0x74, "prologic_game", "prologic_game"),
196     PLIIZ("Dolby PLIIz", PRIMARY_CMD, (byte) 0x92, "prologic_iiz", "prologic_iiz"),
197     NEO6_MUSIC("dts Neo:6 Music", PRIMARY_CMD, (byte) 0x60, "neo6_music", "neo6_music"),
198     NEO6_CINEMA("dts Neo:6 Cinema", PRIMARY_CMD, (byte) 0x61, "neo6_cinema", "neo6_cinema"),
199     ATMOS("Dolby Atmos", "dolby_atmos", "dolby_atmos"),
200     NEURAL_X("dts Neural:X", "dts_neural", "dts_neural"),
201     BYPASS("Analog Bypass", PRIMARY_CMD, (byte) 0x11, "bypass", "bypass"),
202     DSP_MODE("Request current DSP mode", "get_dsp_mode", null),
203     TONE_MAX("Request Max tone level", "get_tone_max", null),
204     TONE_CONTROL_SELECT("Tone Control Select", PRIMARY_CMD, (byte) 0x67),
205     TREBLE_UP("Treble Up", PRIMARY_CMD, (byte) 0x0D, "treble_up", "treble_up"),
206     TREBLE_DOWN("Treble Down", PRIMARY_CMD, (byte) 0x0E, "treble_down", "treble_down"),
207     TREBLE_SET("Set Treble to level", "treble_", "treble_"),
208     TREBLE("Request current treble level", "get_treble", "treble?"),
209     BASS_UP("Bass Up", PRIMARY_CMD, (byte) 0x0F, "bass_up", "bass_up"),
210     BASS_DOWN("Bass Down", PRIMARY_CMD, (byte) 0x10, "bass_down", "bass_down"),
211     BASS_SET("Set Bass to level", "bass_", "bass_"),
212     BASS("Request current bass level", "get_bass", "bass?"),
213     RECORD_FONCTION_SELECT("Record Function Select", PRIMARY_CMD, (byte) 0x17),
214     PLAY("Play Source", PRIMARY_CMD, (byte) 0x04, "play", "play"),
215     STOP("Stop Source", PRIMARY_CMD, (byte) 0x06, "stop", "stop"),
216     PAUSE("Pause Source", PRIMARY_CMD, (byte) 0x05, "pause", "pause"),
217     CD_PLAY_STATUS("Request CD play status", "get_cd_play_status", null),
218     PLAY_STATUS("Request source play status", "get_play_status", "status?"),
219     TRACK_FORWARD("Track Forward", PRIMARY_CMD, (byte) 0x09, "track_fwd", "trkf"),
220     TRACK_BACKWORD("Track Backward", PRIMARY_CMD, (byte) 0x08, "track_back", "trkb"),
221     TRACK("Request current CD track number", null, "track?"),
222     FREQUENCY("Request current frequency for digital source input", "get_current_freq", "freq?"),
223     DISPLAY_REFRESH("Display Refresh", PRIMARY_CMD, (byte) 0xFF),
224     DIMMER_LEVEL_GET("Request current front display dimmer level", "get_current_dimmer", "dimmer?"),
225     DIMMER_LEVEL_SET("Set front display dimmer to level", "dimmer_", "dimmer_"),
226     UPDATE_AUTO("Set Update to Auto", "display_update_auto", "rs232_update_on"),
227     UPDATE_MANUAL("Set Update to Manual", "display_update_manual", "rs232_update_off"),
228     TONE_CONTROLS_ON("Tone Controls On", "tone_on", null),
229     TONE_CONTROLS_OFF("Tone Controls Off", "tone_off", null),
230     TONE_CONTROLS("Request current tone control state", "get_tone", null),
231     TCBYPASS_ON("Bypass On", null, "bypass_on"),
232     TCBYPASS_OFF("Bypass Off", null, "bypass_off"),
233     TCBYPASS("Request current tone bypass state", null, "bypass?"),
234     BALANCE_RIGHT("Balance Right", "balance_right", "balance_r"),
235     BALANCE_LEFT("Balance Left", "balance_left", "balance_l"),
236     BALANCE_SET("Set Balance to level", "balance_", "balance_"),
237     BALANCE("Request current balance setting", "get_balance", "balance?"),
238     SPEAKER_A_TOGGLE("Toggle Speaker A Output", PRIMARY_CMD, (byte) 0x50, "speaker_a", "speaker_a"),
239     SPEAKER_A_ON("Set Speaker A Output", "speaker_a_on", "speaker_a_on"),
240     SPEAKER_A_OFF("Unset Speaker A Output", "speaker_a_off", "speaker_a_off"),
241     SPEAKER_B_TOGGLE("Toggle Speaker B Output", PRIMARY_CMD, (byte) 0x51, "speaker_b", "speaker_b"),
242     SPEAKER_B_ON("Set Speaker B Output", "speaker_b_on", "speaker_b_on"),
243     SPEAKER_B_OFF("Unset Speaker B Output", "speaker_b_off", "speaker_b_off"),
244     SPEAKER("Request current active speaker outputs", "get_current_speaker", "speaker?");
245
246     public static final byte PRIMARY_COMMAND = (byte) 0x10;
247
248     private String name;
249     private byte hexType;
250     private byte hexKey;
251     private @Nullable String asciiCommandV1;
252     private @Nullable String asciiCommandV2;
253
254     /**
255      * Constructor when the textual commands are undefined
256      *
257      * @param name the command name
258      * @param hexType the the command type (HEX protocol)
259      * @param hexKey the the command key (HEX protocol)
260      */
261     private RotelCommand(String name, byte hexType, byte hexKey) {
262         this(name, hexType, hexKey, null, null);
263     }
264
265     /**
266      * Constructor when the HEX command is undefined
267      *
268      * @param name the command name
269      * @param asciiCommandV1 the textual command (ASCII protocol V1)
270      * @param asciiCommandV2 the textual command (ASCII protocol V2)
271      */
272     private RotelCommand(String name, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
273         this(name, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
274     }
275
276     /**
277      * Constructor
278      *
279      * @param name the command name
280      * @param hexType the the command type (HEX protocol)
281      * @param hexKey the the command key (HEX protocol)
282      * @param asciiCommandV1 the textual command (ASCII protocol V1)
283      * @param asciiCommandV2 the textual command (ASCII protocol V2)
284      */
285     private RotelCommand(String name, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
286             @Nullable String asciiCommandV2) {
287         this.name = name;
288         this.hexType = hexType;
289         this.hexKey = hexKey;
290         this.asciiCommandV1 = asciiCommandV1;
291         this.asciiCommandV2 = asciiCommandV2;
292     }
293
294     /**
295      * Get the command name
296      *
297      * @return the command name
298      */
299     public String getName() {
300         return name;
301     }
302
303     /**
304      * Get the command type (HEX protocol)
305      *
306      * @return the command type
307      */
308     public byte getHexType() {
309         return hexType;
310     }
311
312     /**
313      * Get the command key (HEX protocol)
314      *
315      * @return the command key
316      */
317     public byte getHexKey() {
318         return hexKey;
319     }
320
321     /**
322      * Get the textual command (ASCII protocol V1)
323      *
324      * @return the textual command
325      */
326     public @Nullable String getAsciiCommandV1() {
327         return asciiCommandV1;
328     }
329
330     /**
331      * Get the textual command (ASCII protocol V2)
332      *
333      * @return the textual command
334      */
335     public @Nullable String getAsciiCommandV2() {
336         return asciiCommandV2;
337     }
338
339     /**
340      * Get the command associated to a textual command
341      *
342      * @param text the textual command used to identify the command
343      *
344      * @return the command associated to the searched textual command
345      *
346      * @throws RotelException - If no command is associated to the searched textual command
347      */
348     public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
349         for (RotelCommand value : RotelCommand.values()) {
350             if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
351                 return value;
352             }
353         }
354         throw new RotelException("Invalid textual command: " + text);
355     }
356 }