]> git.basschouten.com Git - openhab-addons.git/blob
48cce171f789c5eb249ce51df0302df1ee9132f2
[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     ZONE1_VOLUME_UP("Zone 1 Volume Up", null, "z1:vol_up"),
62     ZONE1_VOLUME_DOWN("Zone 1 Volume Down", null, "z1:vol_dwn"),
63     ZONE1_VOLUME_SET("Set Zone 1 Volume to level", null, "z1:vol_"),
64     ZONE1_MUTE_TOGGLE("Zone 1 Mute Toggle", null, "z1:mute"),
65     ZONE1_MUTE_ON("Zone 1 Mute On", null, "z1:mute_on"),
66     ZONE1_MUTE_OFF("Zone 1 Mute Off", null, "z1:mute_off"),
67     ZONE2_VOLUME_UP("Zone 2 Volume Up", ZONE2_CMD, (byte) 0, null, "z2:vol_up"),
68     ZONE2_VOLUME_DOWN("Zone 2 Volume Down", ZONE2_CMD, (byte) 1, null, "z2:vol_dwn"),
69     ZONE2_VOLUME_SET("Set Zone 2 Volume to level", ZONE2_VOLUME_CMD, (byte) 0, null, "z2:vol_"),
70     ZONE2_MUTE_TOGGLE("Zone 2 Mute Toggle", ZONE2_CMD, (byte) 0x1E, null, "z2:mute"),
71     ZONE2_MUTE_ON("Zone 2 Mute On", ZONE2_CMD, (byte) 0x6C, null, "z2:mute_on"),
72     ZONE2_MUTE_OFF("Zone 2 Mute Off", ZONE2_CMD, (byte) 0x6D, null, "z2:mute_off"),
73     ZONE3_VOLUME_UP("Zone 3 Volume Up", ZONE3_CMD, (byte) 0, null, "z3:vol_up"),
74     ZONE3_VOLUME_DOWN("Zone 3 Volume Down", ZONE3_CMD, (byte) 1, null, "z3:vol_dwn"),
75     ZONE3_VOLUME_SET("Set Zone 3 Volume to level", ZONE3_VOLUME_CMD, (byte) 0, null, "z3:vol_"),
76     ZONE3_MUTE_TOGGLE("Zone 3 Mute Toggle", ZONE3_CMD, (byte) 0x1E, null, "z3:mute"),
77     ZONE3_MUTE_ON("Zone 3 Mute On", ZONE3_CMD, (byte) 0x6C, null, "z3:mute_on"),
78     ZONE3_MUTE_OFF("Zone 3 Mute Off", ZONE3_CMD, (byte) 0x6D, null, "z3:mute_off"),
79     ZONE4_VOLUME_UP("Zone 4 Volume Up", ZONE4_CMD, (byte) 0, null, "z4:vol_up"),
80     ZONE4_VOLUME_DOWN("Zone 4 Volume Down", ZONE4_CMD, (byte) 1, null, "z4:vol_dwn"),
81     ZONE4_VOLUME_SET("Set Zone 4 Volume to level", ZONE4_VOLUME_CMD, (byte) 0, null, "z4:vol_"),
82     ZONE4_MUTE_TOGGLE("Zone 4 Mute Toggle", ZONE4_CMD, (byte) 0x1E, null, "z4:mute"),
83     ZONE4_MUTE_ON("Zone 4 Mute On", ZONE4_CMD, (byte) 0x6C, null, "z4:mute_on"),
84     ZONE4_MUTE_OFF("Zone 4 Mute Off", ZONE4_CMD, (byte) 0x6D, null, "z4:mute_off"),
85     SOURCE_CD("Source CD", PRIMARY_CMD, (byte) 0x02, "cd", "cd"),
86     SOURCE_TUNER("Source Tuner", PRIMARY_CMD, (byte) 0x03, "tuner", "tuner"),
87     SOURCE_TAPE("Source Tape", PRIMARY_CMD, (byte) 0x04, "tape", "tape"),
88     SOURCE_VIDEO1("Source Video 1", PRIMARY_CMD, (byte) 0x05, "video1", "video1"),
89     SOURCE_VIDEO2("Source Video 2", PRIMARY_CMD, (byte) 0x06, "video2", "video2"),
90     SOURCE_VIDEO3("Source Video 3", PRIMARY_CMD, (byte) 0x07, "video3", "video3"),
91     SOURCE_VIDEO4("Source Video 4", PRIMARY_CMD, (byte) 0x08, "video4", "video4"),
92     SOURCE_VIDEO5("Source Video 5", PRIMARY_CMD, (byte) 0x09, "video5", "video5"),
93     SOURCE_VIDEO6("Source Video 6", PRIMARY_CMD, (byte) 0x94, "video6", "video6"),
94     SOURCE_VIDEO7("Source Video 7", "video7", "video7"),
95     SOURCE_VIDEO8("Source Video 8", "video8", "video8"),
96     SOURCE_PHONO("Source Phono", PRIMARY_CMD, (byte) 0x35, "phono", "phono"),
97     SOURCE_USB("Source Front USB", PRIMARY_CMD, (byte) 0x8E, "usb", "usb"),
98     SOURCE_PCUSB("Source PC USB", "pc_usb", "pcusb"),
99     SOURCE_MULTI_INPUT("Source Multi Input", PRIMARY_CMD, (byte) 0x15, "multi_input", "multi_input"),
100     SOURCE_AUX("Source Aux", "aux", "aux"),
101     SOURCE_AUX1("Source Aux 1", "aux1", "aux1"),
102     SOURCE_AUX2("Source Aux 2", "aux2", "aux2"),
103     SOURCE_AUX1_COAX("Source Aux 1 Coax", "aux1_coax", "aux1_coax"),
104     SOURCE_AUX1_OPT("Source Aux 1 Optical", "aux1_opt", "aux1_opt"),
105     SOURCE_COAX1("Source Coax 1", "coax1", "coax1"),
106     SOURCE_COAX2("Source Coax 2", "coax2", "coax2"),
107     SOURCE_COAX3("Source Coax 3", "coax3", "coax3"),
108     SOURCE_OPT1("Source Optical 1", "opt1", "opt1"),
109     SOURCE_OPT2("Source Optical 2", "opt2", "opt2"),
110     SOURCE_OPT3("Source Optical 3", "opt3", "opt3"),
111     SOURCE_BLUETOOTH("Source Bluetooth", "bluetooth", "bluetooth"),
112     SOURCE_ROTEL_CD("Source Rotel CD", "rcd", null),
113     SOURCE_XLR("Source XLR", "bal_xlr", "bal_xlr"),
114     SOURCE_XLR1("Source XLR 1", "bal_xlr1", "bal_xlr1"),
115     SOURCE_XLR2("Source XLR 2", "bal_xlr2", "bal_xlr2"),
116     SOURCE_FM("Source FM", "fm", "fm"),
117     SOURCE_DAB("Source DAB", "dab", "dab"),
118     SOURCE_PLAYFI("Source PlayFi", "playfi", "playfi"),
119     SOURCE_IRADIO("Source iRadio", "iradio", "iradio"),
120     SOURCE_NETWORK("Source Network", "network", "network"),
121     SOURCE_INPUT_A("Source Input A", null, "input_a"),
122     SOURCE_INPUT_B("Source Input B", null, "input_b"),
123     SOURCE_INPUT_C("Source Input C", null, "input_c"),
124     SOURCE_INPUT_D("Source Input D", null, "input_d"),
125     SOURCE("Request current source", "get_current_source", "source?"),
126     INPUT("Request current source", null, "input?"),
127     MAIN_ZONE_SOURCE_CD("Main Zone Source CD", MAIN_ZONE_CMD, (byte) 0x02, "main_zone_cd", "main_zone_cd"),
128     MAIN_ZONE_SOURCE_TUNER("Main Zone Source Tuner", MAIN_ZONE_CMD, (byte) 0x03, "main_zone_tuner", "main_zone_tuner"),
129     MAIN_ZONE_SOURCE_TAPE("Main Zone Source Tape", MAIN_ZONE_CMD, (byte) 0x04, "main_zone_tape", "main_zone_tape"),
130     MAIN_ZONE_SOURCE_VIDEO1("Main Zone Source Video 1", MAIN_ZONE_CMD, (byte) 0x05, "main_zone_video1",
131             "main_zone_video1"),
132     MAIN_ZONE_SOURCE_VIDEO2("Main Zone Source Video 2", MAIN_ZONE_CMD, (byte) 0x06, "main_zone_video2",
133             "main_zone_video2"),
134     MAIN_ZONE_SOURCE_VIDEO3("Main Zone Source Video 3", MAIN_ZONE_CMD, (byte) 0x07, "main_zone_video3",
135             "main_zone_video3"),
136     MAIN_ZONE_SOURCE_VIDEO4("Main Zone Source Video 4", MAIN_ZONE_CMD, (byte) 0x08, "main_zone_video4",
137             "main_zone_video4"),
138     MAIN_ZONE_SOURCE_VIDEO5("Main Zone Source Video 5", MAIN_ZONE_CMD, (byte) 0x09, "main_zone_video5",
139             "main_zone_video5"),
140     MAIN_ZONE_SOURCE_VIDEO6("Main Zone Source Video 6", MAIN_ZONE_CMD, (byte) 0x94, "main_zone_video6",
141             "main_zone_video6"),
142     MAIN_ZONE_SOURCE_USB("Main Zone Source Front USB", MAIN_ZONE_CMD, (byte) 0x8E, "main_zone_usb", "main_zone_usb"),
143     MAIN_ZONE_SOURCE_MULTI_INPUT("Main Zone Source Multi Input", MAIN_ZONE_CMD, (byte) 0x15, "main_zone_multi_input",
144             "main_zone_multi_input"),
145     ZONE1_SOURCE_INPUT_A("Zone 1 Source Input A", null, "z1:input_a"),
146     ZONE1_SOURCE_INPUT_B("Zone 1 Source Input B", null, "z1:input_b"),
147     ZONE1_SOURCE_INPUT_C("Zone 1 Source Input C", null, "z1:input_c"),
148     ZONE1_SOURCE_INPUT_D("Zone 1 Source Input D", null, "z1:input_d"),
149     RECORD_SOURCE_CD("Record Source CD", RECORD_SRC_CMD, (byte) 0x02, "record_cd", "record_cd"),
150     RECORD_SOURCE_TUNER("Record Source Tuner", RECORD_SRC_CMD, (byte) 0x03, "record_tuner", "record_tuner"),
151     RECORD_SOURCE_TAPE("Record Source Tape", RECORD_SRC_CMD, (byte) 0x04, "record_tape", "record_tape"),
152     RECORD_SOURCE_VIDEO1("Record Source Video 1", RECORD_SRC_CMD, (byte) 0x05, "record_video1", "record_video1"),
153     RECORD_SOURCE_VIDEO2("Record Source Video 2", RECORD_SRC_CMD, (byte) 0x06, "record_video2", "record_video2"),
154     RECORD_SOURCE_VIDEO3("Record Source Video 3", RECORD_SRC_CMD, (byte) 0x07, "record_video3", "record_video3"),
155     RECORD_SOURCE_VIDEO4("Record Source Video 4", RECORD_SRC_CMD, (byte) 0x08, "record_video4", "record_video4"),
156     RECORD_SOURCE_VIDEO5("Record Source Video 5", RECORD_SRC_CMD, (byte) 0x09, "record_video5", "record_video5"),
157     RECORD_SOURCE_VIDEO6("Record Source Video 6", RECORD_SRC_CMD, (byte) 0x94, "record_video6", "record_video6"),
158     RECORD_SOURCE_USB("Record Source Front USB", RECORD_SRC_CMD, (byte) 0x8E, "record_usb", "record_usb"),
159     RECORD_SOURCE_MAIN("Record Follow Main Zone Source", RECORD_SRC_CMD, (byte) 0x6B, "record_follow_main",
160             "record_follow_main"),
161     ZONE2_SOURCE_CD("Zone 2 Source CD", ZONE2_CMD, (byte) 0x02, "zone2_cd", "zone2_cd"),
162     ZONE2_SOURCE_TUNER("Zone 2 Source Tuner", ZONE2_CMD, (byte) 0x03, "zone2_tuner", "zone2_tuner"),
163     ZONE2_SOURCE_TAPE("Zone 2 Source Tape", ZONE2_CMD, (byte) 0x04, "zone2_tape", "zone2_tape"),
164     ZONE2_SOURCE_VIDEO1("Zone 2 Source Video 1", ZONE2_CMD, (byte) 0x05, "zone2_video1", "zone2_video1"),
165     ZONE2_SOURCE_VIDEO2("Zone 2 Source Video 2", ZONE2_CMD, (byte) 0x06, "zone2_video2", "zone2_video2"),
166     ZONE2_SOURCE_VIDEO3("Zone 2 Source Video 3", ZONE2_CMD, (byte) 0x07, "zone2_video3", "zone2_video3"),
167     ZONE2_SOURCE_VIDEO4("Zone 2 Source Video 4", ZONE2_CMD, (byte) 0x08, "zone2_video4", "zone2_video4"),
168     ZONE2_SOURCE_VIDEO5("Zone 2 Source Video 5", ZONE2_CMD, (byte) 0x09, "zone2_video5", "zone2_video5"),
169     ZONE2_SOURCE_VIDEO6("Zone 2 Source Video 6", ZONE2_CMD, (byte) 0x94, "zone2_video6", "zone2_video6"),
170     ZONE2_SOURCE_USB("Zone 2 Source Front USB", ZONE2_CMD, (byte) 0x8E, "zone2_usb", "zone2_usb"),
171     ZONE2_SOURCE_MAIN("Zone 2 Follow Main Zone Source", ZONE2_CMD, (byte) 0x6B, "zone2_follow_main",
172             "zone2_follow_main"),
173     ZONE2_SOURCE_INPUT_A("Zone 2 Source Input A", null, "z2:input_a"),
174     ZONE2_SOURCE_INPUT_B("Zone 2 Source Input B", null, "z2:input_b"),
175     ZONE2_SOURCE_INPUT_C("Zone 2 Source Input C", null, "z2:input_c"),
176     ZONE2_SOURCE_INPUT_D("Zone 2 Source Input D", null, "z2:input_d"),
177     ZONE3_SOURCE_CD("Zone 3 Source CD", ZONE3_CMD, (byte) 0x02, "zone3_cd", "zone3_cd"),
178     ZONE3_SOURCE_TUNER("Zone 3 Source Tuner", ZONE3_CMD, (byte) 0x03, "zone3_tuner", "zone3_tuner"),
179     ZONE3_SOURCE_TAPE("Zone 3 Source Tape", ZONE3_CMD, (byte) 0x04, "zone3_tape", "zone3_tape"),
180     ZONE3_SOURCE_VIDEO1("Zone 3 Source Video 1", ZONE3_CMD, (byte) 0x05, "zone3_video1", "zone3_video1"),
181     ZONE3_SOURCE_VIDEO2("Zone 3 Source Video 2", ZONE3_CMD, (byte) 0x06, "zone3_video2", "zone3_video2"),
182     ZONE3_SOURCE_VIDEO3("Zone 3 Source Video 3", ZONE3_CMD, (byte) 0x07, "zone3_video3", "zone3_video3"),
183     ZONE3_SOURCE_VIDEO4("Zone 3 Source Video 4", ZONE3_CMD, (byte) 0x08, "zone3_video4", "zone3_video4"),
184     ZONE3_SOURCE_VIDEO5("Zone 3 Source Video 5", ZONE3_CMD, (byte) 0x09, "zone3_video5", "zone3_video5"),
185     ZONE3_SOURCE_VIDEO6("Zone 3 Source Video 6", ZONE3_CMD, (byte) 0x94, "zone3_video6", "zone3_video6"),
186     ZONE3_SOURCE_USB("Zone 3 Source Front USB", ZONE3_CMD, (byte) 0x8E, "zone3_usb", "zone3_usb"),
187     ZONE3_SOURCE_MAIN("Zone 3 Follow Main Zone Source", ZONE3_CMD, (byte) 0x6B, "zone3_follow_main",
188             "zone3_follow_main"),
189     ZONE3_SOURCE_INPUT_A("Zone 3 Source Input A", null, "z3:input_a"),
190     ZONE3_SOURCE_INPUT_B("Zone 3 Source Input B", null, "z3:input_b"),
191     ZONE3_SOURCE_INPUT_C("Zone 3 Source Input C", null, "z3:input_c"),
192     ZONE3_SOURCE_INPUT_D("Zone 3 Source Input D", null, "z3:input_d"),
193     ZONE4_SOURCE_CD("Zone 4 Source CD", ZONE4_CMD, (byte) 0x02, "zone4_cd", "zone4_cd"),
194     ZONE4_SOURCE_TUNER("Zone 4 Source Tuner", ZONE4_CMD, (byte) 0x03, "zone4_tuner", "zone4_tuner"),
195     ZONE4_SOURCE_TAPE("Zone 4 Source Tape", ZONE4_CMD, (byte) 0x04, "zone4_tape", "zone4_tape"),
196     ZONE4_SOURCE_VIDEO1("Zone 4 Source Video 1", ZONE4_CMD, (byte) 0x05, "zone4_video1", "zone4_video1"),
197     ZONE4_SOURCE_VIDEO2("Zone 4 Source Video 2", ZONE4_CMD, (byte) 0x06, "zone4_video2", "zone4_video2"),
198     ZONE4_SOURCE_VIDEO3("Zone 4 Source Video 3", ZONE4_CMD, (byte) 0x07, "zone4_video3", "zone4_video3"),
199     ZONE4_SOURCE_VIDEO4("Zone 4 Source Video 4", ZONE4_CMD, (byte) 0x08, "zone4_video4", "zone4_video4"),
200     ZONE4_SOURCE_VIDEO5("Zone 4 Source Video 5", ZONE4_CMD, (byte) 0x09, "zone4_video5", "zone4_video5"),
201     ZONE4_SOURCE_VIDEO6("Zone 4 Source Video 6", ZONE4_CMD, (byte) 0x94, "zone4_video6", "zone4_video6"),
202     ZONE4_SOURCE_USB("Zone 4 Source Front USB", ZONE4_CMD, (byte) 0x8E, "zone4_usb", "zone4_usb"),
203     ZONE4_SOURCE_MAIN("Zone 4 Follow Main Zone Source", ZONE4_CMD, (byte) 0x6B, "zone4_follow_main",
204             "zone4_follow_main"),
205     ZONE4_SOURCE_INPUT_A("Zone 4 Source Input A", null, "z4:input_a"),
206     ZONE4_SOURCE_INPUT_B("Zone 4 Source Input B", null, "z4:input_b"),
207     ZONE4_SOURCE_INPUT_C("Zone 4 Source Input C", null, "z4:input_c"),
208     ZONE4_SOURCE_INPUT_D("Zone 4 Source Input D", null, "z4:input_d"),
209     STEREO("Stereo", PRIMARY_CMD, (byte) 0x11, "2channel", "2channel"),
210     STEREO3("Dolby 3 Stereo ", PRIMARY_CMD, (byte) 0x12, "3channel", "3channel"),
211     STEREO5("5 Channel Stereo", PRIMARY_CMD, (byte) 0x5B, "5channel", "5channel"),
212     STEREO7("7 Channel Stereo", PRIMARY_CMD, (byte) 0x5C, "7channel", "7channel"),
213     STEREO9("9 Channel Stereo", "9channel", "9channel"),
214     STEREO11("11 Channel Stereo", "11channel", "11channel"),
215     DSP1("DSP 1", PRIMARY_CMD, (byte) 0x57),
216     DSP2("DSP 2", PRIMARY_CMD, (byte) 0x58),
217     DSP3("DSP 3", PRIMARY_CMD, (byte) 0x59),
218     DSP4("DSP 4", PRIMARY_CMD, (byte) 0x5A),
219     PROLOGIC("Dolby Pro Logic", PRIMARY_CMD, (byte) 0x5F),
220     PLII_CINEMA("Dolby PLII Cinema", PRIMARY_CMD, (byte) 0x5D, "prologic_movie", "prologic_movie"),
221     PLII_MUSIC("Dolby PLII Music", PRIMARY_CMD, (byte) 0x5E, "prologic_music", "prologic_music"),
222     PLII_GAME("Dolby PLII Game", PRIMARY_CMD, (byte) 0x74, "prologic_game", "prologic_game"),
223     PLIIZ("Dolby PLIIz", PRIMARY_CMD, (byte) 0x92, "prologic_iiz", "prologic_iiz"),
224     NEO6_MUSIC("dts Neo:6 Music", PRIMARY_CMD, (byte) 0x60, "neo6_music", "neo6_music"),
225     NEO6_CINEMA("dts Neo:6 Cinema", PRIMARY_CMD, (byte) 0x61, "neo6_cinema", "neo6_cinema"),
226     ATMOS("Dolby Atmos", "dolby_atmos", "dolby_atmos"),
227     NEURAL_X("dts Neural:X", "dts_neural", "dts_neural"),
228     BYPASS("Analog Bypass", PRIMARY_CMD, (byte) 0x11, "bypass", "bypass"),
229     DSP_MODE("Request current DSP mode", "get_dsp_mode", null),
230     TONE_MAX("Request Max tone level", "get_tone_max", null),
231     TONE_CONTROL_SELECT("Tone Control Select", PRIMARY_CMD, (byte) 0x67),
232     TREBLE_UP("Treble Up", PRIMARY_CMD, (byte) 0x0D, "treble_up", "treble_up"),
233     TREBLE_DOWN("Treble Down", PRIMARY_CMD, (byte) 0x0E, "treble_down", "treble_down"),
234     TREBLE_SET("Set Treble to level", "treble_", "treble_"),
235     TREBLE("Request current treble level", "get_treble", "treble?"),
236     BASS_UP("Bass Up", PRIMARY_CMD, (byte) 0x0F, "bass_up", "bass_up"),
237     BASS_DOWN("Bass Down", PRIMARY_CMD, (byte) 0x10, "bass_down", "bass_down"),
238     BASS_SET("Set Bass to level", "bass_", "bass_"),
239     BASS("Request current bass level", "get_bass", "bass?"),
240     ZONE1_TREBLE_UP("Zone 1 Treble Up", null, "z1:treble_up"),
241     ZONE1_TREBLE_DOWN("Zone 1 Treble Down", null, "z1:treble_down"),
242     ZONE1_TREBLE_SET("Set Zone 1 Treble to level", null, "z1:treble_"),
243     ZONE1_BASS_UP("Zone 1 Bass Up", null, "z1:bass_up"),
244     ZONE1_BASS_DOWN("Zone 1 Bass Down", null, "z1:bass_down"),
245     ZONE1_BASS_SET("Set Zone 1 Bass to level", null, "z1:bass_"),
246     ZONE2_TREBLE_UP("Zone 2 Treble Up", null, "z2:treble_up"),
247     ZONE2_TREBLE_DOWN("Zone 2 Treble Down", null, "z2:treble_down"),
248     ZONE2_TREBLE_SET("Set Zone 2 Treble to level", null, "z2:treble_"),
249     ZONE2_BASS_UP("Zone 2 Bass Up", null, "z2:bass_up"),
250     ZONE2_BASS_DOWN("Zone 2 Bass Down", null, "z2:bass_down"),
251     ZONE2_BASS_SET("Set Zone 2 Bass to level", null, "z2:bass_"),
252     ZONE3_TREBLE_UP("Zone 3 Treble Up", null, "z3:treble_up"),
253     ZONE3_TREBLE_DOWN("Zone 3 Treble Down", null, "z3:treble_down"),
254     ZONE3_TREBLE_SET("Set Zone 3 Treble to level", null, "z3:treble_"),
255     ZONE3_BASS_UP("Zone 3 Bass Up", null, "z3:bass_up"),
256     ZONE3_BASS_DOWN("Zone 3 Bass Down", null, "z3:bass_down"),
257     ZONE3_BASS_SET("Set Zone 3 Bass to level", null, "z3:bass_"),
258     ZONE4_TREBLE_UP("Zone 4 Treble Up", null, "z4:treble_up"),
259     ZONE4_TREBLE_DOWN("Zone 4 Treble Down", null, "z4:treble_down"),
260     ZONE4_TREBLE_SET("Set Zone 4 Treble to level", null, "z4:treble_"),
261     ZONE4_BASS_UP("Zone 4 Bass Up", null, "z4:bass_up"),
262     ZONE4_BASS_DOWN("Zone 4 Bass Down", null, "z4:bass_down"),
263     ZONE4_BASS_SET("Set Zone 4 Bass to level", null, "z4:bass_"),
264     RECORD_FONCTION_SELECT("Record Function Select", PRIMARY_CMD, (byte) 0x17),
265     PLAY("Play Source", PRIMARY_CMD, (byte) 0x04, "play", "play"),
266     STOP("Stop Source", PRIMARY_CMD, (byte) 0x06, "stop", "stop"),
267     PAUSE("Pause Source", PRIMARY_CMD, (byte) 0x05, "pause", "pause"),
268     CD_PLAY_STATUS("Request CD play status", "get_cd_play_status", null),
269     PLAY_STATUS("Request source play status", "get_play_status", "status?"),
270     TRACK_FORWARD("Track Forward", PRIMARY_CMD, (byte) 0x09, "track_fwd", "trkf"),
271     TRACK_BACKWORD("Track Backward", PRIMARY_CMD, (byte) 0x08, "track_back", "trkb"),
272     TRACK("Request current CD track number", null, "track?"),
273     FREQUENCY("Request current frequency for digital source input", "get_current_freq", "freq?"),
274     DISPLAY_REFRESH("Display Refresh", PRIMARY_CMD, (byte) 0xFF),
275     DIMMER_LEVEL_GET("Request current front display dimmer level", "get_current_dimmer", "dimmer?"),
276     DIMMER_LEVEL_SET("Set front display dimmer to level", "dimmer_", "dimmer_"),
277     UPDATE_AUTO("Set Update to Auto", "display_update_auto", "rs232_update_on"),
278     UPDATE_MANUAL("Set Update to Manual", "display_update_manual", "rs232_update_off"),
279     TONE_CONTROLS_ON("Tone Controls On", "tone_on", null),
280     TONE_CONTROLS_OFF("Tone Controls Off", "tone_off", null),
281     TONE_CONTROLS("Request current tone control state", "get_tone", null),
282     TCBYPASS_ON("Bypass On", null, "bypass_on"),
283     TCBYPASS_OFF("Bypass Off", null, "bypass_off"),
284     TCBYPASS("Request current tone bypass state", null, "bypass?"),
285     BALANCE_RIGHT("Balance Right", "balance_right", "balance_r"),
286     BALANCE_LEFT("Balance Left", "balance_left", "balance_l"),
287     BALANCE_SET("Set Balance to level", "balance_", "balance_"),
288     ZONE1_BALANCE_RIGHT("Zone 1 Balance Right", null, "z1:balance_r"),
289     ZONE1_BALANCE_LEFT("Zone 1 Balance Left", null, "z1:balance_l"),
290     ZONE1_BALANCE_SET("Set Zone 1 Balance to level", null, "z1:balance_"),
291     ZONE2_BALANCE_RIGHT("Zone 2 Balance Right", null, "z2:balance_r"),
292     ZONE2_BALANCE_LEFT("Zone 2 Balance Left", null, "z2:balance_l"),
293     ZONE2_BALANCE_SET("Set Zone 2 Balance to level", null, "z2:balance_"),
294     ZONE3_BALANCE_RIGHT("Zone 3 Balance Right", null, "z3:balance_r"),
295     ZONE3_BALANCE_LEFT("Zone 3 Balance Left", null, "z3:balance_l"),
296     ZONE3_BALANCE_SET("Set Zone 3 Balance to level", null, "z3:balance_"),
297     ZONE4_BALANCE_RIGHT("Zone 4 Balance Right", null, "z4:balance_r"),
298     ZONE4_BALANCE_LEFT("Zone 4 Balance Left", null, "z4:balance_l"),
299     ZONE4_BALANCE_SET("Set Zone 4 Balance to level", null, "z4:balance_"),
300     BALANCE("Request current balance setting", "get_balance", "balance?"),
301     SPEAKER_A_TOGGLE("Toggle Speaker A Output", PRIMARY_CMD, (byte) 0x50, "speaker_a", "speaker_a"),
302     SPEAKER_A_ON("Set Speaker A Output", "speaker_a_on", "speaker_a_on"),
303     SPEAKER_A_OFF("Unset Speaker A Output", "speaker_a_off", "speaker_a_off"),
304     SPEAKER_B_TOGGLE("Toggle Speaker B Output", PRIMARY_CMD, (byte) 0x51, "speaker_b", "speaker_b"),
305     SPEAKER_B_ON("Set Speaker B Output", "speaker_b_on", "speaker_b_on"),
306     SPEAKER_B_OFF("Unset Speaker B Output", "speaker_b_off", "speaker_b_off"),
307     SPEAKER("Request current active speaker outputs", "get_current_speaker", "speaker?"),
308     MODEL("Request the model number", null, "model?"),
309     VERSION("Request the main CPU software version", null, "version?");
310
311     public static final byte PRIMARY_COMMAND = (byte) 0x10;
312
313     private String name;
314     private byte hexType;
315     private byte hexKey;
316     private @Nullable String asciiCommandV1;
317     private @Nullable String asciiCommandV2;
318
319     /**
320      * Constructor when the textual commands are undefined
321      *
322      * @param name the command name
323      * @param hexType the the command type (HEX protocol)
324      * @param hexKey the the command key (HEX protocol)
325      */
326     private RotelCommand(String name, byte hexType, byte hexKey) {
327         this(name, hexType, hexKey, null, null);
328     }
329
330     /**
331      * Constructor when the HEX command is undefined
332      *
333      * @param name the command name
334      * @param asciiCommandV1 the textual command (ASCII protocol V1)
335      * @param asciiCommandV2 the textual command (ASCII protocol V2)
336      */
337     private RotelCommand(String name, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
338         this(name, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
339     }
340
341     /**
342      * Constructor
343      *
344      * @param name the command name
345      * @param hexType the the command type (HEX protocol)
346      * @param hexKey the the command key (HEX protocol)
347      * @param asciiCommandV1 the textual command (ASCII protocol V1)
348      * @param asciiCommandV2 the textual command (ASCII protocol V2)
349      */
350     private RotelCommand(String name, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
351             @Nullable String asciiCommandV2) {
352         this.name = name;
353         this.hexType = hexType;
354         this.hexKey = hexKey;
355         this.asciiCommandV1 = asciiCommandV1;
356         this.asciiCommandV2 = asciiCommandV2;
357     }
358
359     /**
360      * Get the command name
361      *
362      * @return the command name
363      */
364     public String getName() {
365         return name;
366     }
367
368     /**
369      * Get the command type (HEX protocol)
370      *
371      * @return the command type
372      */
373     public byte getHexType() {
374         return hexType;
375     }
376
377     /**
378      * Get the command key (HEX protocol)
379      *
380      * @return the command key
381      */
382     public byte getHexKey() {
383         return hexKey;
384     }
385
386     /**
387      * Get the textual command (ASCII protocol V1)
388      *
389      * @return the textual command
390      */
391     public @Nullable String getAsciiCommandV1() {
392         return asciiCommandV1;
393     }
394
395     /**
396      * Get the textual command (ASCII protocol V2)
397      *
398      * @return the textual command
399      */
400     public @Nullable String getAsciiCommandV2() {
401         return asciiCommandV2;
402     }
403
404     /**
405      * Get the command associated to a textual command
406      *
407      * @param text the textual command used to identify the command
408      *
409      * @return the command associated to the searched textual command
410      *
411      * @throws RotelException - If no command is associated to the searched textual command
412      */
413     public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
414         for (RotelCommand value : RotelCommand.values()) {
415             if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
416                 return value;
417             }
418         }
419         throw new RotelException("Invalid textual command: " + text);
420     }
421 }