]> git.basschouten.com Git - openhab-addons.git/blob
ba7f514fa7f667bdc3db2dd2c1e4e60aeda31d51
[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 java.util.Collection;
18 import java.util.List;
19 import java.util.stream.Collectors;
20 import java.util.stream.Stream;
21
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.eclipse.jdt.annotation.Nullable;
24 import org.openhab.binding.rotel.internal.RotelException;
25
26 /**
27  * Represents the different kinds of commands
28  *
29  * @author Laurent Garnier - Initial contribution
30  */
31 @NonNullByDefault
32 public enum RotelCommand {
33
34     POWER_TOGGLE("Power Toggle", PRIMARY_CMD, (byte) 0x0A, "power_toggle", "power_toggle"),
35     POWER_OFF("Power Off", PRIMARY_CMD, (byte) 0x4A, "power_off", "power_off"),
36     POWER_ON("Power On", PRIMARY_CMD, (byte) 0x4B, "power_on", "power_on"),
37     POWER_OFF_ALL_ZONES("Power Off All Zones", PRIMARY_CMD, (byte) 0x71),
38     POWER("Request current power status", "get_current_power", "power?"),
39     ZONE_SELECT("Zone Select", PRIMARY_CMD, (byte) 0x23),
40     MAIN_ZONE_POWER_TOGGLE("Main Zone Power Toggle", MAIN_ZONE_CMD, (byte) 0x0A),
41     MAIN_ZONE_POWER_OFF("Main Zone Power Off", MAIN_ZONE_CMD, (byte) 0x4A),
42     MAIN_ZONE_POWER_ON("Main Zone Power On", MAIN_ZONE_CMD, (byte) 0x4B),
43     ZONE2_POWER_TOGGLE("Zone 2 Power Toggle", ZONE2_CMD, (byte) 0x0A),
44     ZONE2_POWER_OFF("Zone 2 Power Off", ZONE2_CMD, (byte) 0x4A),
45     ZONE2_POWER_ON("Zone 2 Power On", ZONE2_CMD, (byte) 0x4B),
46     ZONE3_POWER_TOGGLE("Zone 3 Power Toggle", ZONE3_CMD, (byte) 0x0A),
47     ZONE3_POWER_OFF("Zone 3 Power Off", ZONE3_CMD, (byte) 0x4A),
48     ZONE3_POWER_ON("Zone 3 Power On", ZONE3_CMD, (byte) 0x4B),
49     ZONE4_POWER_TOGGLE("Zone 4 Power Toggle", ZONE4_CMD, (byte) 0x0A),
50     ZONE4_POWER_OFF("Zone 4 Power Off", ZONE4_CMD, (byte) 0x4A),
51     ZONE4_POWER_ON("Zone 4 Power On", ZONE4_CMD, (byte) 0x4B),
52     VOLUME_UP("Volume Up", PRIMARY_CMD, (byte) 0x0B, "volume_up", "vol_up"),
53     VOLUME_DOWN("Volume Down", PRIMARY_CMD, (byte) 0x0C, "volume_down", "vol_dwn"),
54     VOLUME_SET("Set Volume to level", VOLUME_CMD, (byte) 0, "volume_", "vol_"),
55     VOLUME_GET("Request current volume level", "get_volume", "volume?"),
56     VOLUME_GET_MIN("Request Min volume level", "get_volume_min", null),
57     VOLUME_GET_MAX("Request Max volume level", "get_volume_max", null),
58     REMOTE_VOLUME_UP("Remote Volume Up", PRIMARY_CMD, (byte) 0x00),
59     REMOTE_VOLUME_DOWN("Remote Volume Down", PRIMARY_CMD, (byte) 0x01),
60     MUTE_TOGGLE("Mute Toggle", PRIMARY_CMD, (byte) 0x1E, "mute", "mute"),
61     MUTE_ON("Mute On", "mute_on", "mute_on"),
62     MUTE_OFF("Mute Off", "mute_off", "mute_off"),
63     MUTE("Request current mute status", "get_mute_status", "mute?"),
64     MAIN_ZONE_VOLUME_UP("Main Zone Volume Up", MAIN_ZONE_CMD, (byte) 0),
65     MAIN_ZONE_VOLUME_DOWN("Main Zone Volume Down", MAIN_ZONE_CMD, (byte) 1),
66     MAIN_ZONE_MUTE_TOGGLE("Main Zone Mute Toggle", MAIN_ZONE_CMD, (byte) 0x1E),
67     MAIN_ZONE_MUTE_ON("Main Zone Mute On", MAIN_ZONE_CMD, (byte) 0x6C),
68     MAIN_ZONE_MUTE_OFF("Main Zone Mute Off", MAIN_ZONE_CMD, (byte) 0x6D),
69     ZONE1_VOLUME_UP("Zone 1 Volume Up", null, "z1:vol_up"),
70     ZONE1_VOLUME_DOWN("Zone 1 Volume Down", null, "z1:vol_dwn"),
71     ZONE1_VOLUME_SET("Set Zone 1 Volume to level", null, "z1:vol_"),
72     ZONE1_MUTE_TOGGLE("Zone 1 Mute Toggle", null, "z1:mute"),
73     ZONE1_MUTE_ON("Zone 1 Mute On", null, "z1:mute_on"),
74     ZONE1_MUTE_OFF("Zone 1 Mute Off", null, "z1:mute_off"),
75     ZONE2_VOLUME_UP("Zone 2 Volume Up", ZONE2_CMD, (byte) 0, null, "z2:vol_up"),
76     ZONE2_VOLUME_DOWN("Zone 2 Volume Down", ZONE2_CMD, (byte) 1, null, "z2:vol_dwn"),
77     ZONE2_VOLUME_SET("Set Zone 2 Volume to level", ZONE2_VOLUME_CMD, (byte) 0, null, "z2:vol_"),
78     ZONE2_MUTE_TOGGLE("Zone 2 Mute Toggle", ZONE2_CMD, (byte) 0x1E, null, "z2:mute"),
79     ZONE2_MUTE_ON("Zone 2 Mute On", ZONE2_CMD, (byte) 0x6C, null, "z2:mute_on"),
80     ZONE2_MUTE_OFF("Zone 2 Mute Off", ZONE2_CMD, (byte) 0x6D, null, "z2:mute_off"),
81     ZONE3_VOLUME_UP("Zone 3 Volume Up", ZONE3_CMD, (byte) 0, null, "z3:vol_up"),
82     ZONE3_VOLUME_DOWN("Zone 3 Volume Down", ZONE3_CMD, (byte) 1, null, "z3:vol_dwn"),
83     ZONE3_VOLUME_SET("Set Zone 3 Volume to level", ZONE3_VOLUME_CMD, (byte) 0, null, "z3:vol_"),
84     ZONE3_MUTE_TOGGLE("Zone 3 Mute Toggle", ZONE3_CMD, (byte) 0x1E, null, "z3:mute"),
85     ZONE3_MUTE_ON("Zone 3 Mute On", ZONE3_CMD, (byte) 0x6C, null, "z3:mute_on"),
86     ZONE3_MUTE_OFF("Zone 3 Mute Off", ZONE3_CMD, (byte) 0x6D, null, "z3:mute_off"),
87     ZONE4_VOLUME_UP("Zone 4 Volume Up", ZONE4_CMD, (byte) 0, null, "z4:vol_up"),
88     ZONE4_VOLUME_DOWN("Zone 4 Volume Down", ZONE4_CMD, (byte) 1, null, "z4:vol_dwn"),
89     ZONE4_VOLUME_SET("Set Zone 4 Volume to level", ZONE4_VOLUME_CMD, (byte) 0, null, "z4:vol_"),
90     ZONE4_MUTE_TOGGLE("Zone 4 Mute Toggle", ZONE4_CMD, (byte) 0x1E, null, "z4:mute"),
91     ZONE4_MUTE_ON("Zone 4 Mute On", ZONE4_CMD, (byte) 0x6C, null, "z4:mute_on"),
92     ZONE4_MUTE_OFF("Zone 4 Mute Off", ZONE4_CMD, (byte) 0x6D, null, "z4:mute_off"),
93     SOURCE_CD("Source CD", PRIMARY_CMD, (byte) 0x02, "cd", "cd"),
94     SOURCE_TUNER("Source Tuner", PRIMARY_CMD, (byte) 0x03, "tuner", "tuner"),
95     SOURCE_TAPE("Source Tape", PRIMARY_CMD, (byte) 0x04, "tape", "tape"),
96     SOURCE_VIDEO1("Source Video 1", PRIMARY_CMD, (byte) 0x05, "video1", "video1"),
97     SOURCE_VIDEO2("Source Video 2", PRIMARY_CMD, (byte) 0x06, "video2", "video2"),
98     SOURCE_VIDEO3("Source Video 3", PRIMARY_CMD, (byte) 0x07, "video3", "video3"),
99     SOURCE_VIDEO4("Source Video 4", PRIMARY_CMD, (byte) 0x08, "video4", "video4"),
100     SOURCE_VIDEO5("Source Video 5", PRIMARY_CMD, (byte) 0x09, "video5", "video5"),
101     SOURCE_VIDEO6("Source Video 6", PRIMARY_CMD, (byte) 0x94, "video6", "video6"),
102     SOURCE_VIDEO7("Source Video 7", "video7", "video7"),
103     SOURCE_VIDEO8("Source Video 8", "video8", "video8"),
104     SOURCE_PHONO("Source Phono", PRIMARY_CMD, (byte) 0x35, "phono", "phono"),
105     SOURCE_USB("Source Front USB", PRIMARY_CMD, (byte) 0x8E, "usb", "usb"),
106     SOURCE_PCUSB("Source PC USB", "pc_usb", "pcusb"),
107     SOURCE_MULTI_INPUT("Source Multi Input", PRIMARY_CMD, (byte) 0x15, "multi_input", "multi_input"),
108     SOURCE_AUX("Source Aux", "aux", "aux"),
109     SOURCE_AUX1("Source Aux 1", "aux1", "aux1"),
110     SOURCE_AUX2("Source Aux 2", "aux2", "aux2"),
111     SOURCE_AUX1_COAX("Source Aux 1 Coax", "aux1_coax", "aux1_coax"),
112     SOURCE_AUX1_OPT("Source Aux 1 Optical", "aux1_opt", "aux1_opt"),
113     SOURCE_COAX1("Source Coax 1", "coax1", "coax1"),
114     SOURCE_COAX2("Source Coax 2", "coax2", "coax2"),
115     SOURCE_COAX3("Source Coax 3", "coax3", "coax3"),
116     SOURCE_OPT1("Source Optical 1", "opt1", "opt1"),
117     SOURCE_OPT2("Source Optical 2", "opt2", "opt2"),
118     SOURCE_OPT3("Source Optical 3", "opt3", "opt3"),
119     SOURCE_BLUETOOTH("Source Bluetooth", "bluetooth", "bluetooth"),
120     SOURCE_ROTEL_CD("Source Rotel CD", "rcd", null),
121     SOURCE_XLR("Source XLR", "bal_xlr", "bal_xlr"),
122     SOURCE_XLR1("Source XLR 1", "bal_xlr1", "bal_xlr1"),
123     SOURCE_XLR2("Source XLR 2", "bal_xlr2", "bal_xlr2"),
124     SOURCE_FM("Source FM", "fm", "fm"),
125     SOURCE_DAB("Source DAB", "dab", "dab"),
126     SOURCE_PLAYFI("Source PlayFi", "playfi", "playfi"),
127     SOURCE_IRADIO("Source iRadio", "iradio", "iradio"),
128     SOURCE_NETWORK("Source Network", "network", "network"),
129     SOURCE_INPUT_A("Source Input A", null, "input_a"),
130     SOURCE_INPUT_B("Source Input B", null, "input_b"),
131     SOURCE_INPUT_C("Source Input C", null, "input_c"),
132     SOURCE_INPUT_D("Source Input D", null, "input_d"),
133     SOURCE("Request current source", "get_current_source", "source?"),
134     INPUT("Request current source", null, "input?"),
135     MAIN_ZONE_SOURCE_CD("Main Zone Source CD", MAIN_ZONE_CMD, (byte) 0x02, "main_zone_cd", "main_zone_cd"),
136     MAIN_ZONE_SOURCE_TUNER("Main Zone Source Tuner", MAIN_ZONE_CMD, (byte) 0x03, "main_zone_tuner", "main_zone_tuner"),
137     MAIN_ZONE_SOURCE_TAPE("Main Zone Source Tape", MAIN_ZONE_CMD, (byte) 0x04, "main_zone_tape", "main_zone_tape"),
138     MAIN_ZONE_SOURCE_VIDEO1("Main Zone Source Video 1", MAIN_ZONE_CMD, (byte) 0x05, "main_zone_video1",
139             "main_zone_video1"),
140     MAIN_ZONE_SOURCE_VIDEO2("Main Zone Source Video 2", MAIN_ZONE_CMD, (byte) 0x06, "main_zone_video2",
141             "main_zone_video2"),
142     MAIN_ZONE_SOURCE_VIDEO3("Main Zone Source Video 3", MAIN_ZONE_CMD, (byte) 0x07, "main_zone_video3",
143             "main_zone_video3"),
144     MAIN_ZONE_SOURCE_VIDEO4("Main Zone Source Video 4", MAIN_ZONE_CMD, (byte) 0x08, "main_zone_video4",
145             "main_zone_video4"),
146     MAIN_ZONE_SOURCE_VIDEO5("Main Zone Source Video 5", MAIN_ZONE_CMD, (byte) 0x09, "main_zone_video5",
147             "main_zone_video5"),
148     MAIN_ZONE_SOURCE_VIDEO6("Main Zone Source Video 6", MAIN_ZONE_CMD, (byte) 0x94, "main_zone_video6",
149             "main_zone_video6"),
150     MAIN_ZONE_SOURCE_USB("Main Zone Source Front USB", MAIN_ZONE_CMD, (byte) 0x8E, "main_zone_usb", "main_zone_usb"),
151     MAIN_ZONE_SOURCE_MULTI_INPUT("Main Zone Source Multi Input", MAIN_ZONE_CMD, (byte) 0x15, "main_zone_multi_input",
152             "main_zone_multi_input"),
153     ZONE1_SOURCE_INPUT_A("Zone 1 Source Input A", null, "z1:input_a"),
154     ZONE1_SOURCE_INPUT_B("Zone 1 Source Input B", null, "z1:input_b"),
155     ZONE1_SOURCE_INPUT_C("Zone 1 Source Input C", null, "z1:input_c"),
156     ZONE1_SOURCE_INPUT_D("Zone 1 Source Input D", null, "z1:input_d"),
157     RECORD_SOURCE_CD("Record Source CD", RECORD_SRC_CMD, (byte) 0x02, "record_cd", "record_cd"),
158     RECORD_SOURCE_TUNER("Record Source Tuner", RECORD_SRC_CMD, (byte) 0x03, "record_tuner", "record_tuner"),
159     RECORD_SOURCE_TAPE("Record Source Tape", RECORD_SRC_CMD, (byte) 0x04, "record_tape", "record_tape"),
160     RECORD_SOURCE_VIDEO1("Record Source Video 1", RECORD_SRC_CMD, (byte) 0x05, "record_video1", "record_video1"),
161     RECORD_SOURCE_VIDEO2("Record Source Video 2", RECORD_SRC_CMD, (byte) 0x06, "record_video2", "record_video2"),
162     RECORD_SOURCE_VIDEO3("Record Source Video 3", RECORD_SRC_CMD, (byte) 0x07, "record_video3", "record_video3"),
163     RECORD_SOURCE_VIDEO4("Record Source Video 4", RECORD_SRC_CMD, (byte) 0x08, "record_video4", "record_video4"),
164     RECORD_SOURCE_VIDEO5("Record Source Video 5", RECORD_SRC_CMD, (byte) 0x09, "record_video5", "record_video5"),
165     RECORD_SOURCE_VIDEO6("Record Source Video 6", RECORD_SRC_CMD, (byte) 0x94, "record_video6", "record_video6"),
166     RECORD_SOURCE_USB("Record Source Front USB", RECORD_SRC_CMD, (byte) 0x8E, "record_usb", "record_usb"),
167     RECORD_SOURCE_MAIN("Record Follow Main Zone Source", RECORD_SRC_CMD, (byte) 0x6B, "record_follow_main",
168             "record_follow_main"),
169     ZONE2_SOURCE_CD("Zone 2 Source CD", ZONE2_CMD, (byte) 0x02, "zone2_cd", "zone2_cd"),
170     ZONE2_SOURCE_TUNER("Zone 2 Source Tuner", ZONE2_CMD, (byte) 0x03, "zone2_tuner", "zone2_tuner"),
171     ZONE2_SOURCE_TAPE("Zone 2 Source Tape", ZONE2_CMD, (byte) 0x04, "zone2_tape", "zone2_tape"),
172     ZONE2_SOURCE_VIDEO1("Zone 2 Source Video 1", ZONE2_CMD, (byte) 0x05, "zone2_video1", "zone2_video1"),
173     ZONE2_SOURCE_VIDEO2("Zone 2 Source Video 2", ZONE2_CMD, (byte) 0x06, "zone2_video2", "zone2_video2"),
174     ZONE2_SOURCE_VIDEO3("Zone 2 Source Video 3", ZONE2_CMD, (byte) 0x07, "zone2_video3", "zone2_video3"),
175     ZONE2_SOURCE_VIDEO4("Zone 2 Source Video 4", ZONE2_CMD, (byte) 0x08, "zone2_video4", "zone2_video4"),
176     ZONE2_SOURCE_VIDEO5("Zone 2 Source Video 5", ZONE2_CMD, (byte) 0x09, "zone2_video5", "zone2_video5"),
177     ZONE2_SOURCE_VIDEO6("Zone 2 Source Video 6", ZONE2_CMD, (byte) 0x94, "zone2_video6", "zone2_video6"),
178     ZONE2_SOURCE_USB("Zone 2 Source Front USB", ZONE2_CMD, (byte) 0x8E, "zone2_usb", "zone2_usb"),
179     ZONE2_SOURCE_MAIN("Zone 2 Follow Main Zone Source", ZONE2_CMD, (byte) 0x6B, "zone2_follow_main",
180             "zone2_follow_main"),
181     ZONE2_SOURCE_INPUT_A("Zone 2 Source Input A", null, "z2:input_a"),
182     ZONE2_SOURCE_INPUT_B("Zone 2 Source Input B", null, "z2:input_b"),
183     ZONE2_SOURCE_INPUT_C("Zone 2 Source Input C", null, "z2:input_c"),
184     ZONE2_SOURCE_INPUT_D("Zone 2 Source Input D", null, "z2:input_d"),
185     ZONE3_SOURCE_CD("Zone 3 Source CD", ZONE3_CMD, (byte) 0x02, "zone3_cd", "zone3_cd"),
186     ZONE3_SOURCE_TUNER("Zone 3 Source Tuner", ZONE3_CMD, (byte) 0x03, "zone3_tuner", "zone3_tuner"),
187     ZONE3_SOURCE_TAPE("Zone 3 Source Tape", ZONE3_CMD, (byte) 0x04, "zone3_tape", "zone3_tape"),
188     ZONE3_SOURCE_VIDEO1("Zone 3 Source Video 1", ZONE3_CMD, (byte) 0x05, "zone3_video1", "zone3_video1"),
189     ZONE3_SOURCE_VIDEO2("Zone 3 Source Video 2", ZONE3_CMD, (byte) 0x06, "zone3_video2", "zone3_video2"),
190     ZONE3_SOURCE_VIDEO3("Zone 3 Source Video 3", ZONE3_CMD, (byte) 0x07, "zone3_video3", "zone3_video3"),
191     ZONE3_SOURCE_VIDEO4("Zone 3 Source Video 4", ZONE3_CMD, (byte) 0x08, "zone3_video4", "zone3_video4"),
192     ZONE3_SOURCE_VIDEO5("Zone 3 Source Video 5", ZONE3_CMD, (byte) 0x09, "zone3_video5", "zone3_video5"),
193     ZONE3_SOURCE_VIDEO6("Zone 3 Source Video 6", ZONE3_CMD, (byte) 0x94, "zone3_video6", "zone3_video6"),
194     ZONE3_SOURCE_USB("Zone 3 Source Front USB", ZONE3_CMD, (byte) 0x8E, "zone3_usb", "zone3_usb"),
195     ZONE3_SOURCE_MAIN("Zone 3 Follow Main Zone Source", ZONE3_CMD, (byte) 0x6B, "zone3_follow_main",
196             "zone3_follow_main"),
197     ZONE3_SOURCE_INPUT_A("Zone 3 Source Input A", null, "z3:input_a"),
198     ZONE3_SOURCE_INPUT_B("Zone 3 Source Input B", null, "z3:input_b"),
199     ZONE3_SOURCE_INPUT_C("Zone 3 Source Input C", null, "z3:input_c"),
200     ZONE3_SOURCE_INPUT_D("Zone 3 Source Input D", null, "z3:input_d"),
201     ZONE4_SOURCE_CD("Zone 4 Source CD", ZONE4_CMD, (byte) 0x02, "zone4_cd", "zone4_cd"),
202     ZONE4_SOURCE_TUNER("Zone 4 Source Tuner", ZONE4_CMD, (byte) 0x03, "zone4_tuner", "zone4_tuner"),
203     ZONE4_SOURCE_TAPE("Zone 4 Source Tape", ZONE4_CMD, (byte) 0x04, "zone4_tape", "zone4_tape"),
204     ZONE4_SOURCE_VIDEO1("Zone 4 Source Video 1", ZONE4_CMD, (byte) 0x05, "zone4_video1", "zone4_video1"),
205     ZONE4_SOURCE_VIDEO2("Zone 4 Source Video 2", ZONE4_CMD, (byte) 0x06, "zone4_video2", "zone4_video2"),
206     ZONE4_SOURCE_VIDEO3("Zone 4 Source Video 3", ZONE4_CMD, (byte) 0x07, "zone4_video3", "zone4_video3"),
207     ZONE4_SOURCE_VIDEO4("Zone 4 Source Video 4", ZONE4_CMD, (byte) 0x08, "zone4_video4", "zone4_video4"),
208     ZONE4_SOURCE_VIDEO5("Zone 4 Source Video 5", ZONE4_CMD, (byte) 0x09, "zone4_video5", "zone4_video5"),
209     ZONE4_SOURCE_VIDEO6("Zone 4 Source Video 6", ZONE4_CMD, (byte) 0x94, "zone4_video6", "zone4_video6"),
210     ZONE4_SOURCE_USB("Zone 4 Source Front USB", ZONE4_CMD, (byte) 0x8E, "zone4_usb", "zone4_usb"),
211     ZONE4_SOURCE_MAIN("Zone 4 Follow Main Zone Source", ZONE4_CMD, (byte) 0x6B, "zone4_follow_main",
212             "zone4_follow_main"),
213     ZONE4_SOURCE_INPUT_A("Zone 4 Source Input A", null, "z4:input_a"),
214     ZONE4_SOURCE_INPUT_B("Zone 4 Source Input B", null, "z4:input_b"),
215     ZONE4_SOURCE_INPUT_C("Zone 4 Source Input C", null, "z4:input_c"),
216     ZONE4_SOURCE_INPUT_D("Zone 4 Source Input D", null, "z4:input_d"),
217     STEREO("Stereo", PRIMARY_CMD, (byte) 0x11, "2channel", "2channel"),
218     STEREO_BYPASS_TOGGLE("Stereo / Bypass Toggle", PRIMARY_CMD, (byte) 0x11),
219     STEREO3("Dolby 3 Stereo ", PRIMARY_CMD, (byte) 0x12, "3channel", "3channel"),
220     STEREO5("5 Channel Stereo", PRIMARY_CMD, (byte) 0x5B, "5channel", "5channel"),
221     STEREO7("7 Channel Stereo", PRIMARY_CMD, (byte) 0x5C, "7channel", "7channel"),
222     STEREO9("9 Channel Stereo", "9channel", "9channel"),
223     STEREO11("11 Channel Stereo", "11channel", "11channel"),
224     PROLOGIC_TOGGLE("Dolby Pro Logic Toggle", PRIMARY_CMD, (byte) 0x13),
225     DSP_TOGGLE("DSP Music Mode Toggle", PRIMARY_CMD, (byte) 0x14),
226     DSP1("DSP 1", PRIMARY_CMD, (byte) 0x57),
227     DSP2("DSP 2", PRIMARY_CMD, (byte) 0x58),
228     DSP3("DSP 3", PRIMARY_CMD, (byte) 0x59),
229     DSP4("DSP 4", PRIMARY_CMD, (byte) 0x5A),
230     DOLBY_TOGGLE("Dolby 3 Stereo / Pro Logic Toggle", PRIMARY_CMD, (byte) 0x53),
231     PROLOGIC("Dolby Pro Logic", PRIMARY_CMD, (byte) 0x5F),
232     PLII_CINEMA("Dolby PLII Cinema", PRIMARY_CMD, (byte) 0x5D, "prologic_movie", "prologic_movie"),
233     PLII_MUSIC("Dolby PLII Music", PRIMARY_CMD, (byte) 0x5E, "prologic_music", "prologic_music"),
234     PLII_GAME("Dolby PLII Game", PRIMARY_CMD, (byte) 0x74, "prologic_game", "prologic_game"),
235     PLIIZ("Dolby PLIIz", PRIMARY_CMD, (byte) 0x92, "prologic_iiz", "prologic_iiz"),
236     PLII_PANORAMA_TOGGLE("PLII Panorama Toggle", PRIMARY_CMD, (byte) 0x62),
237     PLII_DIMENSION_UP("PLII Dimension Up", PRIMARY_CMD, (byte) 0x63),
238     PLII_DIMENSION_DOWN("PLII Dimension Down", PRIMARY_CMD, (byte) 0x64),
239     PLII_CENTER_WIDTH_UP("PLII Center Width Up", PRIMARY_CMD, (byte) 0x65),
240     PLII_CENTER_WIDTH_DOWN("PLII Center Width Down", PRIMARY_CMD, (byte) 0x66),
241     DDEX_TOGGLE("Dolby Digital EX Toggle", PRIMARY_CMD, (byte) 0x68),
242     NEO6_TOGGLE("dts Neo:6 Music/Cinema Toggle", PRIMARY_CMD, (byte) 0x54),
243     NEO6_MUSIC("dts Neo:6 Music", PRIMARY_CMD, (byte) 0x60, "neo6_music", "neo6_music"),
244     NEO6_CINEMA("dts Neo:6 Cinema", PRIMARY_CMD, (byte) 0x61, "neo6_cinema", "neo6_cinema"),
245     ATMOS("Dolby Atmos", "dolby_atmos", "dolby_atmos"),
246     NEURAL_X("dts Neural:X", "dts_neural", "dts_neural"),
247     BYPASS("Analog Bypass", "bypass", "bypass"),
248     NEXT_MODE("Next Surround Mode", PRIMARY_CMD, (byte) 0x22),
249     DSP_MODE("Request current DSP mode", "get_dsp_mode", null),
250     TONE_MAX("Request Max tone level", "get_tone_max", null),
251     TONE_CONTROL_SELECT("Tone Control Select", PRIMARY_CMD, (byte) 0x67),
252     TREBLE_UP("Treble Up", PRIMARY_CMD, (byte) 0x0D, "treble_up", "treble_up"),
253     TREBLE_DOWN("Treble Down", PRIMARY_CMD, (byte) 0x0E, "treble_down", "treble_down"),
254     TREBLE_SET("Set Treble to level", "treble_", "treble_"),
255     TREBLE("Request current treble level", "get_treble", "treble?"),
256     BASS_UP("Bass Up", PRIMARY_CMD, (byte) 0x0F, "bass_up", "bass_up"),
257     BASS_DOWN("Bass Down", PRIMARY_CMD, (byte) 0x10, "bass_down", "bass_down"),
258     BASS_SET("Set Bass to level", "bass_", "bass_"),
259     BASS("Request current bass level", "get_bass", "bass?"),
260     ZONE1_TREBLE_UP("Zone 1 Treble Up", null, "z1:treble_up"),
261     ZONE1_TREBLE_DOWN("Zone 1 Treble Down", null, "z1:treble_down"),
262     ZONE1_TREBLE_SET("Set Zone 1 Treble to level", null, "z1:treble_"),
263     ZONE1_BASS_UP("Zone 1 Bass Up", null, "z1:bass_up"),
264     ZONE1_BASS_DOWN("Zone 1 Bass Down", null, "z1:bass_down"),
265     ZONE1_BASS_SET("Set Zone 1 Bass to level", null, "z1:bass_"),
266     ZONE2_TREBLE_UP("Zone 2 Treble Up", null, "z2:treble_up"),
267     ZONE2_TREBLE_DOWN("Zone 2 Treble Down", null, "z2:treble_down"),
268     ZONE2_TREBLE_SET("Set Zone 2 Treble to level", null, "z2:treble_"),
269     ZONE2_BASS_UP("Zone 2 Bass Up", null, "z2:bass_up"),
270     ZONE2_BASS_DOWN("Zone 2 Bass Down", null, "z2:bass_down"),
271     ZONE2_BASS_SET("Set Zone 2 Bass to level", null, "z2:bass_"),
272     ZONE3_TREBLE_UP("Zone 3 Treble Up", null, "z3:treble_up"),
273     ZONE3_TREBLE_DOWN("Zone 3 Treble Down", null, "z3:treble_down"),
274     ZONE3_TREBLE_SET("Set Zone 3 Treble to level", null, "z3:treble_"),
275     ZONE3_BASS_UP("Zone 3 Bass Up", null, "z3:bass_up"),
276     ZONE3_BASS_DOWN("Zone 3 Bass Down", null, "z3:bass_down"),
277     ZONE3_BASS_SET("Set Zone 3 Bass to level", null, "z3:bass_"),
278     ZONE4_TREBLE_UP("Zone 4 Treble Up", null, "z4:treble_up"),
279     ZONE4_TREBLE_DOWN("Zone 4 Treble Down", null, "z4:treble_down"),
280     ZONE4_TREBLE_SET("Set Zone 4 Treble to level", null, "z4:treble_"),
281     ZONE4_BASS_UP("Zone 4 Bass Up", null, "z4:bass_up"),
282     ZONE4_BASS_DOWN("Zone 4 Bass Down", null, "z4:bass_down"),
283     ZONE4_BASS_SET("Set Zone 4 Bass to level", null, "z4:bass_"),
284     RECORD_FONCTION_SELECT("Record Function Select", PRIMARY_CMD, (byte) 0x17),
285     PLAY("Play Source", PRIMARY_CMD, (byte) 0x04, "play", "play"),
286     STOP("Stop Source", PRIMARY_CMD, (byte) 0x06, "stop", "stop"),
287     PAUSE("Pause Source", PRIMARY_CMD, (byte) 0x05, "pause", "pause"),
288     CD_PLAY_STATUS("Request CD play status", "get_cd_play_status", null),
289     PLAY_STATUS("Request source play status", "get_play_status", "status?"),
290     RANDOM_TOGGLE("Random Play Mode Toggle", PRIMARY_CMD, (byte) 0x25, "random", "rnd"),
291     RANDOM_MODE("Request current random play mode", null, "rnd?"),
292     REPEAT_TOGGLE("Repeat Play Mode Toggle", PRIMARY_CMD, (byte) 0x26, "repeat", "rpt"),
293     REPEAT_MODE("Request current repeat play mode", null, "rpt?"),
294     TRACK_FWD("Track Forward/Tune Up", PRIMARY_CMD, (byte) 0x09, "track_fwd", "trkf"),
295     TRACK_BACK("Track Backward/Tune Down", PRIMARY_CMD, (byte) 0x08, "track_back", "trkb"),
296     FAST_FWD("Fast Forward/Search Forward", PRIMARY_CMD, (byte) 0x0B, "fast_fwd", "ff"),
297     FAST_BACK("Fast Backward/Search Backward", PRIMARY_CMD, (byte) 0x0A, "fast_back", "fb"),
298     TRACK("Request current CD track number", null, "track?"),
299     EJECT("Eject CD", "eject", "eject"),
300     TIME_TOGGLE("Toggle CD Time Display", "time", "time"),
301     FREQUENCY("Request current frequency for digital source input", "get_current_freq", "freq?"),
302     DISPLAY_REFRESH("Display Refresh", PRIMARY_CMD, (byte) 0xFF),
303     DIMMER_LEVEL_GET("Request current front display dimmer level", "get_current_dimmer", "dimmer?"),
304     DIMMER_LEVEL_SET("Set front display dimmer to level", "dimmer_", "dimmer_"),
305     UPDATE_AUTO("Set Update to Auto", "display_update_auto", "rs232_update_on"),
306     UPDATE_MANUAL("Set Update to Manual", "display_update_manual", "rs232_update_off"),
307     TONE_CONTROLS_ON("Tone Controls On", "tone_on", null),
308     TONE_CONTROLS_OFF("Tone Controls Off", "tone_off", null),
309     TONE_CONTROLS("Request current tone control state", "get_tone", null),
310     TCBYPASS_ON("Bypass On", null, "bypass_on"),
311     TCBYPASS_OFF("Bypass Off", null, "bypass_off"),
312     TCBYPASS("Request current tone bypass state", null, "bypass?"),
313     BALANCE_RIGHT("Balance Right", "balance_right", "balance_r"),
314     BALANCE_LEFT("Balance Left", "balance_left", "balance_l"),
315     BALANCE_SET("Set Balance to level", "balance_", "balance_"),
316     ZONE1_BALANCE_RIGHT("Zone 1 Balance Right", null, "z1:balance_r"),
317     ZONE1_BALANCE_LEFT("Zone 1 Balance Left", null, "z1:balance_l"),
318     ZONE1_BALANCE_SET("Set Zone 1 Balance to level", null, "z1:balance_"),
319     ZONE2_BALANCE_RIGHT("Zone 2 Balance Right", null, "z2:balance_r"),
320     ZONE2_BALANCE_LEFT("Zone 2 Balance Left", null, "z2:balance_l"),
321     ZONE2_BALANCE_SET("Set Zone 2 Balance to level", null, "z2:balance_"),
322     ZONE3_BALANCE_RIGHT("Zone 3 Balance Right", null, "z3:balance_r"),
323     ZONE3_BALANCE_LEFT("Zone 3 Balance Left", null, "z3:balance_l"),
324     ZONE3_BALANCE_SET("Set Zone 3 Balance to level", null, "z3:balance_"),
325     ZONE4_BALANCE_RIGHT("Zone 4 Balance Right", null, "z4:balance_r"),
326     ZONE4_BALANCE_LEFT("Zone 4 Balance Left", null, "z4:balance_l"),
327     ZONE4_BALANCE_SET("Set Zone 4 Balance to level", null, "z4:balance_"),
328     BALANCE("Request current balance setting", "get_balance", "balance?"),
329     SPEAKER_A_TOGGLE("Toggle Speaker A Output", PRIMARY_CMD, (byte) 0x50, "speaker_a", "speaker_a"),
330     SPEAKER_A_ON("Set Speaker A Output", "speaker_a_on", "speaker_a_on"),
331     SPEAKER_A_OFF("Unset Speaker A Output", "speaker_a_off", "speaker_a_off"),
332     SPEAKER_B_TOGGLE("Toggle Speaker B Output", PRIMARY_CMD, (byte) 0x51, "speaker_b", "speaker_b"),
333     SPEAKER_B_ON("Set Speaker B Output", "speaker_b_on", "speaker_b_on"),
334     SPEAKER_B_OFF("Unset Speaker B Output", "speaker_b_off", "speaker_b_off"),
335     SPEAKER("Request current active speaker outputs", "get_current_speaker", "speaker?"),
336     TUNE_UP("Tune Up", PRIMARY_CMD, (byte) 0x28),
337     TUNE_DOWN("Tune Down", PRIMARY_CMD, (byte) 0x29),
338     PRESET_UP("Preset Up", PRIMARY_CMD, (byte) 0x6F),
339     PRESET_DOWN("Preset Down", PRIMARY_CMD, (byte) 0x70),
340     FREQUENCY_UP("Frequency Up", PRIMARY_CMD, (byte) 0x72),
341     FREQUENCY_DOWN("Frequency Down", PRIMARY_CMD, (byte) 0x73),
342     MEMORY("Memory", PRIMARY_CMD, (byte) 0x27),
343     BAND_TOGGLE("Band Toggle", PRIMARY_CMD, (byte) 0x24),
344     AM("AM", PRIMARY_CMD, (byte) 0x56),
345     FM("FM", PRIMARY_CMD, (byte) 0x55),
346     TUNE_PRESET_TOGGLE("Tune / Preset", PRIMARY_CMD, (byte) 0x20),
347     TUNING_MODE_SELECT("Tuning Mode Select", PRIMARY_CMD, (byte) 0x69),
348     PRESET_MODE_SELECT("Preset Mode Select", PRIMARY_CMD, (byte) 0x6A),
349     FREQUENCY_DIRECT("Frequency Direct", PRIMARY_CMD, (byte) 0x25),
350     PRESET_SCAN("Preset Scan", PRIMARY_CMD, (byte) 0x21),
351     TUNER_DISPLAY("Tuner Display", PRIMARY_CMD, (byte) 0x44),
352     RDS_PTY("RDS PTY", PRIMARY_CMD, (byte) 0x45),
353     RDS_TP("RDS TP", PRIMARY_CMD, (byte) 0x46),
354     RDS_TA("RDS TA", PRIMARY_CMD, (byte) 0x47),
355     FM_MONO_TOGGLE("FM Mono", PRIMARY_CMD, (byte) 0x26),
356     ZONE2_TUNE_UP("Zone 2 Tune Up", ZONE2_CMD, (byte) 0x28),
357     ZONE2_TUNE_DOWN("Zone 2 Tune Down", ZONE2_CMD, (byte) 0x29),
358     ZONE2_PRESET_UP("Zone 2 Preset Up", ZONE2_CMD, (byte) 0x6F),
359     ZONE2_PRESET_DOWN("Zone 2 Preset Down", ZONE2_CMD, (byte) 0x70),
360     ZONE2_FREQUENCY_UP("Zone 2 Frequency Up", ZONE2_CMD, (byte) 0x72),
361     ZONE2_FREQUENCY_DOWN("Zone 2 Frequency Down", ZONE2_CMD, (byte) 0x73),
362     ZONE2_BAND_TOGGLE("Zone 2 Band Toggle", ZONE2_CMD, (byte) 0x24),
363     ZONE2_AM("Zone 2 AM", ZONE2_CMD, (byte) 0x56),
364     ZONE2_FM("Zone 2 FM", ZONE2_CMD, (byte) 0x55),
365     ZONE2_TUNE_PRESET_TOGGLE("Zone 2 Tune / Preset", ZONE2_CMD, (byte) 0x20),
366     ZONE2_TUNING_MODE_SELECT("Zone 2 Tuning Mode Select", ZONE2_CMD, (byte) 0x69),
367     ZONE2_PRESET_MODE_SELECT("Zone 2 Preset Mode Select", ZONE2_CMD, (byte) 0x6A),
368     ZONE2_PRESET_SCAN("Zone 2 Preset Scan", ZONE2_CMD, (byte) 0x21),
369     ZONE2_FM_MONO_TOGGLE("Zone 2 FM Mono", ZONE2_CMD, (byte) 0x26),
370     ZONE3_TUNE_UP("Zone 3 Tune Up", ZONE3_CMD, (byte) 0x28),
371     ZONE3_TUNE_DOWN("Zone 3 Tune Down", ZONE3_CMD, (byte) 0x29),
372     ZONE3_PRESET_UP("Zone 3 Preset Up", ZONE3_CMD, (byte) 0x6F),
373     ZONE3_PRESET_DOWN("Zone 3 Preset Down", ZONE3_CMD, (byte) 0x70),
374     ZONE3_FREQUENCY_UP("Zone 3 Frequency Up", ZONE3_CMD, (byte) 0x72),
375     ZONE3_FREQUENCY_DOWN("Zone 3 Frequency Down", ZONE3_CMD, (byte) 0x73),
376     ZONE3_BAND_TOGGLE("Zone 3 Band Toggle", ZONE3_CMD, (byte) 0x24),
377     ZONE3_AM("Zone 3 AM", ZONE3_CMD, (byte) 0x56),
378     ZONE3_FM("Zone 3 FM", ZONE3_CMD, (byte) 0x55),
379     ZONE3_TUNE_PRESET_TOGGLE("Zone 3 Tune / Preset", ZONE3_CMD, (byte) 0x20),
380     ZONE3_TUNING_MODE_SELECT("Zone 3 Tuning Mode Select", ZONE3_CMD, (byte) 0x69),
381     ZONE3_PRESET_MODE_SELECT("Zone 3 Preset Mode Select", ZONE3_CMD, (byte) 0x6A),
382     ZONE3_PRESET_SCAN("Zone 3 Preset Scan", ZONE3_CMD, (byte) 0x21),
383     ZONE3_FM_MONO_TOGGLE("Zone 3 FM Mono", ZONE3_CMD, (byte) 0x26),
384     ZONE4_TUNE_UP("Zone 4 Tune Up", ZONE4_CMD, (byte) 0x28),
385     ZONE4_TUNE_DOWN("Zone 4 Tune Down", ZONE4_CMD, (byte) 0x29),
386     ZONE4_PRESET_UP("Zone 4 Preset Up", ZONE4_CMD, (byte) 0x6F),
387     ZONE4_PRESET_DOWN("Zone 4 Preset Down", ZONE4_CMD, (byte) 0x70),
388     ZONE4_FREQUENCY_UP("Zone 4 Frequency Up", ZONE4_CMD, (byte) 0x72),
389     ZONE4_FREQUENCY_DOWN("Zone 4 Frequency Down", ZONE4_CMD, (byte) 0x73),
390     ZONE4_BAND_TOGGLE("Zone 4 Band Toggle", ZONE4_CMD, (byte) 0x24),
391     ZONE4_AM("Zone 4 AM", ZONE4_CMD, (byte) 0x56),
392     ZONE4_FM("Zone 4 FM", ZONE4_CMD, (byte) 0x55),
393     ZONE4_TUNE_PRESET_TOGGLE("Zone 4 Tune / Preset", ZONE4_CMD, (byte) 0x20),
394     ZONE4_TUNING_MODE_SELECT("Zone 4 Tuning Mode Select", ZONE4_CMD, (byte) 0x69),
395     ZONE4_PRESET_MODE_SELECT("Zone 4 Preset Mode Select", ZONE4_CMD, (byte) 0x6A),
396     ZONE4_PRESET_SCAN("Zone 4 Preset Scan", ZONE4_CMD, (byte) 0x21),
397     ZONE4_FM_MONO_TOGGLE("Zone 4 FM Mono", ZONE4_CMD, (byte) 0x26),
398     MENU("Display the Menu", PRIMARY_CMD, (byte) 0x18, "menu", null),
399     EXIT("Exit Key", PRIMARY_CMD, (byte) 0x90, "exit", null),
400     UP("Cursor Up", PRIMARY_CMD, (byte) 0x1C, "up", null),
401     UP_PRESSED("Cursor Up â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1C),
402     UP_RELEASED("Cursor Up â€“ Key Released", (byte) 0x11, (byte) 0x1C),
403     DOWN("Cursor Down", PRIMARY_CMD, (byte) 0x1D, "down", null),
404     DOWN_PRESSED("Cursor Down â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1D),
405     DOWN_RELEASED("Cursor Down â€“ Key Released", (byte) 0x11, (byte) 0x1D),
406     LEFT("Cursor Left", PRIMARY_CMD, (byte) 0x1B, "left", null),
407     LEFT_PRESSED("Cursor Left â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1B),
408     LEFT_RELEASED("Cursor Left â€“ Key Released", (byte) 0x11, (byte) 0x1B),
409     RIGHT("Cursor Right", PRIMARY_CMD, (byte) 0x1A, "right", null),
410     ENTER("Enter Key", PRIMARY_CMD, (byte) 0x19, "enter", null),
411     RIGHT_PRESSED("Cursor Right â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1A),
412     RIGHT_RELEASED("Cursor Right â€“ Key Released", (byte) 0x11, (byte) 0x1A),
413     KEY1("Number Key 1", PRIMARY_CMD, (byte) 0x2A, "1", "1"),
414     KEY2("Number Key 2", PRIMARY_CMD, (byte) 0x2B, "2", "2"),
415     KEY3("Number Key 3", PRIMARY_CMD, (byte) 0x2C, "3", "3"),
416     KEY4("Number Key 4", PRIMARY_CMD, (byte) 0x2D, "4", "4"),
417     KEY5("Number Key 5", PRIMARY_CMD, (byte) 0x2E, "5", "5"),
418     KEY6("Number Key 6", PRIMARY_CMD, (byte) 0x2F, "6", "6"),
419     KEY7("Number Key 7", PRIMARY_CMD, (byte) 0x30, "7", "7"),
420     KEY8("Number Key 8", PRIMARY_CMD, (byte) 0x31, "8", "8"),
421     KEY9("Number Key 9", PRIMARY_CMD, (byte) 0x32, "9", "9"),
422     KEY0("Number Key 0", PRIMARY_CMD, (byte) 0x33, "0", "0"),
423     ZONE2_KEY1("Zone 2 Number Key 1", ZONE2_CMD, (byte) 0x2A),
424     ZONE2_KEY2("Zone 2 Number Key 2", ZONE2_CMD, (byte) 0x2B),
425     ZONE2_KEY3("Zone 2 Number Key 3", ZONE2_CMD, (byte) 0x2C),
426     ZONE2_KEY4("Zone 2 Number Key 4", ZONE2_CMD, (byte) 0x2D),
427     ZONE2_KEY5("Zone 2 Number Key 5", ZONE2_CMD, (byte) 0x2E),
428     ZONE2_KEY6("Zone 2 Number Key 6", ZONE2_CMD, (byte) 0x2F),
429     ZONE2_KEY7("Zone 2 Number Key 7", ZONE2_CMD, (byte) 0x30),
430     ZONE2_KEY8("Zone 2 Number Key 8", ZONE2_CMD, (byte) 0x31),
431     ZONE2_KEY9("Zone 2 Number Key 9", ZONE2_CMD, (byte) 0x32),
432     ZONE2_KEY0("Zone 2 Number Key 0", ZONE2_CMD, (byte) 0x33),
433     ZONE3_KEY1("Zone 3 Number Key 1", ZONE3_CMD, (byte) 0x2A),
434     ZONE3_KEY2("Zone 3 Number Key 2", ZONE3_CMD, (byte) 0x2B),
435     ZONE3_KEY3("Zone 3 Number Key 3", ZONE3_CMD, (byte) 0x2C),
436     ZONE3_KEY4("Zone 3 Number Key 4", ZONE3_CMD, (byte) 0x2D),
437     ZONE3_KEY5("Zone 3 Number Key 5", ZONE3_CMD, (byte) 0x2E),
438     ZONE3_KEY6("Zone 3 Number Key 6", ZONE3_CMD, (byte) 0x2F),
439     ZONE3_KEY7("Zone 3 Number Key 7", ZONE3_CMD, (byte) 0x30),
440     ZONE3_KEY8("Zone 3 Number Key 8", ZONE3_CMD, (byte) 0x31),
441     ZONE3_KEY9("Zone 3 Number Key 9", ZONE3_CMD, (byte) 0x32),
442     ZONE3_KEY0("Zone 3 Number Key 0", ZONE3_CMD, (byte) 0x33),
443     ZONE4_KEY1("Zone 4 Number Key 1", ZONE4_CMD, (byte) 0x2A),
444     ZONE4_KEY2("Zone 4 Number Key 2", ZONE4_CMD, (byte) 0x2B),
445     ZONE4_KEY3("Zone 4 Number Key 3", ZONE4_CMD, (byte) 0x2C),
446     ZONE4_KEY4("Zone 4 Number Key 4", ZONE4_CMD, (byte) 0x2D),
447     ZONE4_KEY5("Zone 4 Number Key 5", ZONE4_CMD, (byte) 0x2E),
448     ZONE4_KEY6("Zone 4 Number Key 6", ZONE4_CMD, (byte) 0x2F),
449     ZONE4_KEY7("Zone 4 Number Key 7", ZONE4_CMD, (byte) 0x30),
450     ZONE4_KEY8("Zone 4 Number Key 8", ZONE4_CMD, (byte) 0x31),
451     ZONE4_KEY9("Zone 4 Number Key 9", ZONE4_CMD, (byte) 0x32),
452     ZONE4_KEY0("Zone 4 Number Key 0", ZONE4_CMD, (byte) 0x33),
453     PROGRAM("Program Key", "program", null),
454     PCUSB_CLASS_1("Set PC-USB Audio Class to 1.0", "pcusb_class_1", "pcusb_class_1"),
455     PCUSB_CLASS_2("Set PC-USB Audio Class to 2.0", "pcusb_class_2", "pcusb_class_2"),
456     PCUSB_CLASS_GET("Request current PC-USB class", "get_pcusb_class", "pcusb?"),
457     RESET_FACTORY("Reset unit to factory defaults", PRIMARY_CMD, (byte) 0x93, "factory_default_on",
458             "factory_default_on"),
459     DYNAMIC_RANGE("Dynamic Range", PRIMARY_CMD, (byte) 0x16),
460     DIGITAL_INPUT_SELECT("Digital Input Select", PRIMARY_CMD, (byte) 0x1F),
461     ZONE_TOGGLE("Zone Toggle", PRIMARY_CMD, (byte) 0x23),
462     CENTER_TRIM("Temporary Center Trim", PRIMARY_CMD, (byte) 0x4C),
463     SUB_TRIM("Temporary Subwoofer  Trim", PRIMARY_CMD, (byte) 0x4D),
464     SURROUND_TRIM("Temporary Surround  Trim", PRIMARY_CMD, (byte) 0x4E),
465     CINEMA_EQ_TOGGLE("Cinema EQ Toggle", PRIMARY_CMD, (byte) 0x4F),
466     DISPLAY_TOGGLE("Front Display On/Off", PRIMARY_CMD, (byte) 0x52),
467     PARTY_MODE_TOGGLE("Party Mode Toggle", PRIMARY_CMD, (byte) 0x6E),
468     ZONE2_PARTY_MODE_TOGGLE("Zone 2 Party Mode Toggle", ZONE2_CMD, (byte) 0x6E),
469     ZONE3_PARTY_MODE_TOGGLE("Zone 3 Party Mode Toggle", ZONE3_CMD, (byte) 0x6E),
470     ZONE4_PARTY_MODE_TOGGLE("Zone 4 Party Mode Toggle", ZONE4_CMD, (byte) 0x6E),
471     OUTPUT_RESOLUTION("Output Resolution", PRIMARY_CMD, (byte) 0x75),
472     HDMI_AMP_MODE("HDMI Amp Mode", PRIMARY_CMD, (byte) 0x78),
473     HDMI_TV_MODE("HDMI TV Mode", PRIMARY_CMD, (byte) 0x79),
474     ROOM_EQ_TOGGLE("Temporary Room EQ Toggle", PRIMARY_CMD, (byte) 0x67),
475     SPEAKER_SETTING_TOGGLE("Speaker Level Setting Toggle", PRIMARY_CMD, (byte) 0xA1),
476     MODEL("Request the model number", null, "model?"),
477     VERSION("Request the main CPU software version", null, "version?");
478
479     public static final List<RotelCommand> DSP_CMDS_SET1 = List.of(DSP_TOGGLE, PROLOGIC_TOGGLE, DOLBY_TOGGLE,
480             PLII_PANORAMA_TOGGLE, PLII_DIMENSION_UP, PLII_DIMENSION_DOWN, PLII_CENTER_WIDTH_UP, PLII_CENTER_WIDTH_DOWN,
481             DDEX_TOGGLE, NEO6_TOGGLE, NEXT_MODE);
482     public static final List<RotelCommand> DSP_CMDS_SET2 = List.of(STEREO_BYPASS_TOGGLE, DSP_TOGGLE, PROLOGIC_TOGGLE,
483             DOLBY_TOGGLE, PLII_PANORAMA_TOGGLE, PLII_DIMENSION_UP, PLII_DIMENSION_DOWN, PLII_CENTER_WIDTH_UP,
484             PLII_CENTER_WIDTH_DOWN, DDEX_TOGGLE, NEO6_TOGGLE, NEXT_MODE);
485
486     public static final List<RotelCommand> SRC_CTRL_CMDS_SET1 = List.of(PLAY, STOP, PAUSE, TRACK_FWD, TRACK_BACK);
487     public static final List<RotelCommand> SRC_CTRL_CMDS_SET2 = List.of(FAST_FWD, FAST_BACK, RANDOM_TOGGLE,
488             REPEAT_TOGGLE);
489     public static final List<RotelCommand> SRC_CTRL_CMDS_SET3 = List.of(FAST_FWD, FAST_BACK, EJECT, TIME_TOGGLE);
490
491     public static final List<RotelCommand> TUNER_CMDS_SET1 = List.of(TUNE_UP, TUNE_DOWN, MEMORY, BAND_TOGGLE, AM, FM,
492             TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT, PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY,
493             RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
494     public static final List<RotelCommand> TUNER_CMDS_SET2 = List.of(TUNE_UP, TUNE_DOWN, PRESET_UP, PRESET_DOWN,
495             FREQUENCY_UP, FREQUENCY_DOWN, MEMORY, BAND_TOGGLE, AM, FM, TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT,
496             PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY, RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
497     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
498             ZONE2_BAND_TOGGLE, ZONE2_AM, ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT,
499             ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN, ZONE2_FM_MONO_TOGGLE);
500     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET2 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
501             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
502             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
503             ZONE2_FM_MONO_TOGGLE);
504     public static final List<RotelCommand> ZONE234_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
505             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
506             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
507             ZONE2_FM_MONO_TOGGLE, ZONE3_TUNE_UP, ZONE3_TUNE_DOWN, ZONE3_PRESET_UP, ZONE3_PRESET_DOWN,
508             ZONE3_FREQUENCY_UP, ZONE3_FREQUENCY_DOWN, ZONE3_BAND_TOGGLE, ZONE3_AM, ZONE3_FM, ZONE3_TUNE_PRESET_TOGGLE,
509             ZONE3_TUNING_MODE_SELECT, ZONE3_PRESET_MODE_SELECT, ZONE3_PRESET_SCAN, ZONE3_FM_MONO_TOGGLE, ZONE4_TUNE_UP,
510             ZONE4_TUNE_DOWN, ZONE4_PRESET_UP, ZONE4_PRESET_DOWN, ZONE4_FREQUENCY_UP, ZONE4_FREQUENCY_DOWN,
511             ZONE4_BAND_TOGGLE, ZONE4_AM, ZONE4_FM, ZONE4_TUNE_PRESET_TOGGLE, ZONE4_TUNING_MODE_SELECT,
512             ZONE4_PRESET_MODE_SELECT, ZONE4_PRESET_SCAN, ZONE4_FM_MONO_TOGGLE);
513
514     public static final List<RotelCommand> MENU_CTRL_CMDS = List.of(MENU, EXIT, UP, DOWN, LEFT, RIGHT, ENTER);
515     public static final List<RotelCommand> MENU2_CTRL_CMDS = List.of(MENU, UP, DOWN, LEFT, RIGHT, ENTER);
516     public static final List<RotelCommand> MENU3_CTRL_CMDS = List.of(MENU, EXIT, UP_PRESSED, UP_RELEASED, DOWN_PRESSED,
517             DOWN_RELEASED, LEFT_PRESSED, LEFT_RELEASED, RIGHT_PRESSED, RIGHT_RELEASED, ENTER);
518
519     public static final List<RotelCommand> NUMERIC_KEY_CMDS = List.of(KEY1, KEY2, KEY3, KEY4, KEY5, KEY6, KEY7, KEY8,
520             KEY9, KEY0);
521     public static final List<RotelCommand> ZONE2_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
522             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0);
523     public static final List<RotelCommand> ZONE234_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
524             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0, ZONE3_KEY1, ZONE3_KEY2,
525             ZONE3_KEY3, ZONE3_KEY4, ZONE3_KEY5, ZONE3_KEY6, ZONE3_KEY7, ZONE3_KEY8, ZONE3_KEY9, ZONE3_KEY0, ZONE4_KEY1,
526             ZONE4_KEY2, ZONE4_KEY3, ZONE4_KEY4, ZONE4_KEY5, ZONE4_KEY6, ZONE4_KEY7, ZONE4_KEY8, ZONE4_KEY9, ZONE4_KEY0);
527
528     public static final List<RotelCommand> PCUSB_CLASS_CMDS = List.of(PCUSB_CLASS_1, PCUSB_CLASS_2);
529
530     public static final List<RotelCommand> OTHER_CMDS_SET1 = List.of(RECORD_FONCTION_SELECT, TONE_CONTROL_SELECT,
531             DYNAMIC_RANGE, DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
532     public static final List<RotelCommand> OTHER_CMDS_SET2 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
533             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
534             HDMI_TV_MODE);
535     public static final List<RotelCommand> OTHER_CMDS_SET3 = List.of(RECORD_FONCTION_SELECT, DYNAMIC_RANGE,
536             DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
537     public static final List<RotelCommand> OTHER_CMDS_SET4 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
538             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
539             HDMI_TV_MODE, ROOM_EQ_TOGGLE, SPEAKER_SETTING_TOGGLE, RESET_FACTORY);
540
541     public static final byte PRIMARY_COMMAND = (byte) 0x10;
542
543     private String label;
544     private byte hexType;
545     private byte hexKey;
546     private @Nullable String asciiCommandV1;
547     private @Nullable String asciiCommandV2;
548
549     /**
550      * Constructor when the textual commands are undefined
551      *
552      * @param label the command label
553      * @param hexType the the command type (HEX protocol)
554      * @param hexKey the the command key (HEX protocol)
555      */
556     private RotelCommand(String label, byte hexType, byte hexKey) {
557         this(label, hexType, hexKey, null, null);
558     }
559
560     /**
561      * Constructor when the HEX command is undefined
562      *
563      * @param label the command label
564      * @param asciiCommandV1 the textual command (ASCII protocol V1)
565      * @param asciiCommandV2 the textual command (ASCII protocol V2)
566      */
567     private RotelCommand(String label, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
568         this(label, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
569     }
570
571     /**
572      * Constructor
573      *
574      * @param label the command label
575      * @param hexType the the command type (HEX protocol)
576      * @param hexKey the the command key (HEX protocol)
577      * @param asciiCommandV1 the textual command (ASCII protocol V1)
578      * @param asciiCommandV2 the textual command (ASCII protocol V2)
579      */
580     private RotelCommand(String label, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
581             @Nullable String asciiCommandV2) {
582         this.label = label;
583         this.hexType = hexType;
584         this.hexKey = hexKey;
585         this.asciiCommandV1 = asciiCommandV1;
586         this.asciiCommandV2 = asciiCommandV2;
587     }
588
589     /**
590      * Get the command label
591      *
592      * @return the command label
593      */
594     public String getLabel() {
595         return label;
596     }
597
598     /**
599      * Get the command type (HEX protocol)
600      *
601      * @return the command type
602      */
603     public byte getHexType() {
604         return hexType;
605     }
606
607     /**
608      * Get the command key (HEX protocol)
609      *
610      * @return the command key
611      */
612     public byte getHexKey() {
613         return hexKey;
614     }
615
616     /**
617      * Get the textual command (ASCII protocol V1)
618      *
619      * @return the textual command
620      */
621     public @Nullable String getAsciiCommandV1() {
622         return asciiCommandV1;
623     }
624
625     /**
626      * Get the textual command (ASCII protocol V2)
627      *
628      * @return the textual command
629      */
630     public @Nullable String getAsciiCommandV2() {
631         return asciiCommandV2;
632     }
633
634     /**
635      * Indicate if the command is relative to a particular zone
636      *
637      * @param numZone the zone number
638      *
639      * @return true if the command is relative to the zone
640      */
641     public boolean isCommandForZone(int numZone) {
642         String prefix = String.format("ZONE%d", numZone);
643         return name().startsWith(prefix);
644     }
645
646     @Override
647     public String toString() {
648         return label;
649     }
650
651     /**
652      * Get the command associated to a textual command
653      *
654      * @param text the textual command used to identify the command
655      *
656      * @return the command associated to the searched textual command
657      *
658      * @throws RotelException - If no command is associated to the searched textual command
659      */
660     public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
661         for (RotelCommand value : RotelCommand.values()) {
662             if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
663                 return value;
664             }
665         }
666         throw new RotelException("Invalid textual command: " + text);
667     }
668
669     /**
670      * Get the command from its name
671      *
672      * @param name the command name used to identify the command
673      *
674      * @return the command associated to the searched name
675      *
676      * @throws RotelException - If no command is associated to the searched name
677      */
678     public static RotelCommand getFromName(String name) throws RotelException {
679         for (RotelCommand value : RotelCommand.values()) {
680             if (value.name().equals(name)) {
681                 return value;
682             }
683         }
684         throw new RotelException("Invalid command: " + name);
685     }
686
687     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2) {
688         return Stream.of(list1, list2).flatMap(Collection::stream).collect(Collectors.toList());
689     }
690
691     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
692             List<RotelCommand> list3) {
693         return Stream.of(list1, list2, list3).flatMap(Collection::stream).collect(Collectors.toList());
694     }
695
696     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
697             List<RotelCommand> list3, List<RotelCommand> list4) {
698         return Stream.of(list1, list2, list3, list4).flatMap(Collection::stream).collect(Collectors.toList());
699     }
700
701     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
702             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5) {
703         return Stream.of(list1, list2, list3, list4, list5).flatMap(Collection::stream).collect(Collectors.toList());
704     }
705
706     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
707             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6) {
708         return Stream.of(list1, list2, list3, list4, list5, list6).flatMap(Collection::stream)
709                 .collect(Collectors.toList());
710     }
711
712     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
713             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
714             List<RotelCommand> list7) {
715         return Stream.of(list1, list2, list3, list4, list5, list6, list7).flatMap(Collection::stream)
716                 .collect(Collectors.toList());
717     }
718
719     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
720             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
721             List<RotelCommand> list7, List<RotelCommand> list8) {
722         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8).flatMap(Collection::stream)
723                 .collect(Collectors.toList());
724     }
725
726     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
727             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
728             List<RotelCommand> list7, List<RotelCommand> list8, List<RotelCommand> list9) {
729         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8, list9).flatMap(Collection::stream)
730                 .collect(Collectors.toList());
731     }
732 }