]> git.basschouten.com Git - openhab-addons.git/blob
cf3cd3d9e4d8f3e6950de09c59b33f1a03f83c8c
[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.NonNull;
23 import org.eclipse.jdt.annotation.NonNullByDefault;
24 import org.eclipse.jdt.annotation.Nullable;
25 import org.openhab.binding.rotel.internal.RotelException;
26
27 /**
28  * Represents the different kinds of commands
29  *
30  * @author Laurent Garnier - Initial contribution
31  */
32 @NonNullByDefault
33 public enum RotelCommand {
34
35     POWER_TOGGLE("Power Toggle", PRIMARY_CMD, (byte) 0x0A, "power_toggle", "power_toggle"),
36     POWER_OFF("Power Off", PRIMARY_CMD, (byte) 0x4A, "power_off", "power_off"),
37     POWER_ON("Power On", PRIMARY_CMD, (byte) 0x4B, "power_on", "power_on"),
38     POWER_OFF_ALL_ZONES("Power Off All Zones", PRIMARY_CMD, (byte) 0x71),
39     POWER("Request current power status", "get_current_power", "power?"),
40     ZONE_SELECT("Zone Select", PRIMARY_CMD, (byte) 0x23),
41     MAIN_ZONE_POWER_TOGGLE("Main Zone Power Toggle", MAIN_ZONE_CMD, (byte) 0x0A),
42     MAIN_ZONE_POWER_OFF("Main Zone Power Off", MAIN_ZONE_CMD, (byte) 0x4A),
43     MAIN_ZONE_POWER_ON("Main Zone Power On", MAIN_ZONE_CMD, (byte) 0x4B),
44     ZONE2_POWER_TOGGLE("Zone 2 Power Toggle", ZONE2_CMD, (byte) 0x0A),
45     ZONE2_POWER_OFF("Zone 2 Power Off", ZONE2_CMD, (byte) 0x4A),
46     ZONE2_POWER_ON("Zone 2 Power On", ZONE2_CMD, (byte) 0x4B),
47     ZONE3_POWER_TOGGLE("Zone 3 Power Toggle", ZONE3_CMD, (byte) 0x0A),
48     ZONE3_POWER_OFF("Zone 3 Power Off", ZONE3_CMD, (byte) 0x4A),
49     ZONE3_POWER_ON("Zone 3 Power On", ZONE3_CMD, (byte) 0x4B),
50     ZONE4_POWER_TOGGLE("Zone 4 Power Toggle", ZONE4_CMD, (byte) 0x0A),
51     ZONE4_POWER_OFF("Zone 4 Power Off", ZONE4_CMD, (byte) 0x4A),
52     ZONE4_POWER_ON("Zone 4 Power On", ZONE4_CMD, (byte) 0x4B),
53     VOLUME_UP("Volume Up", PRIMARY_CMD, (byte) 0x0B, "volume_up", "vol_up"),
54     VOLUME_DOWN("Volume Down", PRIMARY_CMD, (byte) 0x0C, "volume_down", "vol_dwn"),
55     VOLUME_SET("Set Volume to level", VOLUME_CMD, (byte) 0, "volume_", "vol_"),
56     VOLUME_GET("Request current volume level", "get_volume", "volume?"),
57     VOLUME_GET_MIN("Request Min volume level", "get_volume_min", null),
58     VOLUME_GET_MAX("Request Max volume level", "get_volume_max", null),
59     REMOTE_VOLUME_UP("Remote Volume Up", PRIMARY_CMD, (byte) 0x00),
60     REMOTE_VOLUME_DOWN("Remote Volume Down", PRIMARY_CMD, (byte) 0x01),
61     MUTE_TOGGLE("Mute Toggle", PRIMARY_CMD, (byte) 0x1E, "mute", "mute"),
62     MUTE_ON("Mute On", "mute_on", "mute_on"),
63     MUTE_OFF("Mute Off", "mute_off", "mute_off"),
64     MUTE("Request current mute status", "get_mute_status", "mute?"),
65     MAIN_ZONE_VOLUME_UP("Main Zone Volume Up", MAIN_ZONE_CMD, (byte) 0),
66     MAIN_ZONE_VOLUME_DOWN("Main Zone Volume Down", MAIN_ZONE_CMD, (byte) 1),
67     MAIN_ZONE_MUTE_TOGGLE("Main Zone Mute Toggle", MAIN_ZONE_CMD, (byte) 0x1E),
68     MAIN_ZONE_MUTE_ON("Main Zone Mute On", MAIN_ZONE_CMD, (byte) 0x6C),
69     MAIN_ZONE_MUTE_OFF("Main Zone Mute Off", MAIN_ZONE_CMD, (byte) 0x6D),
70     ZONE1_VOLUME_UP("Zone 1 Volume Up", null, "z1:vol_up"),
71     ZONE1_VOLUME_DOWN("Zone 1 Volume Down", null, "z1:vol_dwn"),
72     ZONE1_VOLUME_SET("Set Zone 1 Volume to level", null, "z1:vol_"),
73     ZONE1_MUTE_TOGGLE("Zone 1 Mute Toggle", null, "z1:mute"),
74     ZONE1_MUTE_ON("Zone 1 Mute On", null, "z1:mute_on"),
75     ZONE1_MUTE_OFF("Zone 1 Mute Off", null, "z1:mute_off"),
76     ZONE2_VOLUME_UP("Zone 2 Volume Up", ZONE2_CMD, (byte) 0, null, "z2:vol_up"),
77     ZONE2_VOLUME_DOWN("Zone 2 Volume Down", ZONE2_CMD, (byte) 1, null, "z2:vol_dwn"),
78     ZONE2_VOLUME_SET("Set Zone 2 Volume to level", ZONE2_VOLUME_CMD, (byte) 0, null, "z2:vol_"),
79     ZONE2_MUTE_TOGGLE("Zone 2 Mute Toggle", ZONE2_CMD, (byte) 0x1E, null, "z2:mute"),
80     ZONE2_MUTE_ON("Zone 2 Mute On", ZONE2_CMD, (byte) 0x6C, null, "z2:mute_on"),
81     ZONE2_MUTE_OFF("Zone 2 Mute Off", ZONE2_CMD, (byte) 0x6D, null, "z2:mute_off"),
82     ZONE3_VOLUME_UP("Zone 3 Volume Up", ZONE3_CMD, (byte) 0, null, "z3:vol_up"),
83     ZONE3_VOLUME_DOWN("Zone 3 Volume Down", ZONE3_CMD, (byte) 1, null, "z3:vol_dwn"),
84     ZONE3_VOLUME_SET("Set Zone 3 Volume to level", ZONE3_VOLUME_CMD, (byte) 0, null, "z3:vol_"),
85     ZONE3_MUTE_TOGGLE("Zone 3 Mute Toggle", ZONE3_CMD, (byte) 0x1E, null, "z3:mute"),
86     ZONE3_MUTE_ON("Zone 3 Mute On", ZONE3_CMD, (byte) 0x6C, null, "z3:mute_on"),
87     ZONE3_MUTE_OFF("Zone 3 Mute Off", ZONE3_CMD, (byte) 0x6D, null, "z3:mute_off"),
88     ZONE4_VOLUME_UP("Zone 4 Volume Up", ZONE4_CMD, (byte) 0, null, "z4:vol_up"),
89     ZONE4_VOLUME_DOWN("Zone 4 Volume Down", ZONE4_CMD, (byte) 1, null, "z4:vol_dwn"),
90     ZONE4_VOLUME_SET("Set Zone 4 Volume to level", ZONE4_VOLUME_CMD, (byte) 0, null, "z4:vol_"),
91     ZONE4_MUTE_TOGGLE("Zone 4 Mute Toggle", ZONE4_CMD, (byte) 0x1E, null, "z4:mute"),
92     ZONE4_MUTE_ON("Zone 4 Mute On", ZONE4_CMD, (byte) 0x6C, null, "z4:mute_on"),
93     ZONE4_MUTE_OFF("Zone 4 Mute Off", ZONE4_CMD, (byte) 0x6D, null, "z4:mute_off"),
94     SOURCE_CD("Source CD", PRIMARY_CMD, (byte) 0x02, "cd", "cd"),
95     SOURCE_TUNER("Source Tuner", PRIMARY_CMD, (byte) 0x03, "tuner", "tuner"),
96     SOURCE_TAPE("Source Tape", PRIMARY_CMD, (byte) 0x04, "tape", "tape"),
97     SOURCE_VIDEO1("Source Video 1", PRIMARY_CMD, (byte) 0x05, "video1", "video1"),
98     SOURCE_VIDEO2("Source Video 2", PRIMARY_CMD, (byte) 0x06, "video2", "video2"),
99     SOURCE_VIDEO3("Source Video 3", PRIMARY_CMD, (byte) 0x07, "video3", "video3"),
100     SOURCE_VIDEO4("Source Video 4", PRIMARY_CMD, (byte) 0x08, "video4", "video4"),
101     SOURCE_VIDEO5("Source Video 5", PRIMARY_CMD, (byte) 0x09, "video5", "video5"),
102     SOURCE_VIDEO6("Source Video 6", PRIMARY_CMD, (byte) 0x94, "video6", "video6"),
103     SOURCE_VIDEO7("Source Video 7", "video7", "video7"),
104     SOURCE_VIDEO8("Source Video 8", "video8", "video8"),
105     SOURCE_PHONO("Source Phono", PRIMARY_CMD, (byte) 0x35, "phono", "phono"),
106     SOURCE_USB("Source Front USB", PRIMARY_CMD, (byte) 0x8E, "usb", "usb"),
107     SOURCE_PCUSB("Source PC USB", "pc_usb", "pcusb"),
108     SOURCE_MULTI_INPUT("Source Multi Input", PRIMARY_CMD, (byte) 0x15, "multi_input", "multi_input"),
109     SOURCE_AUX("Source Aux", "aux", "aux"),
110     SOURCE_AUX1("Source Aux 1", "aux1", "aux1"),
111     SOURCE_AUX2("Source Aux 2", "aux2", "aux2"),
112     SOURCE_AUX1_COAX("Source Aux 1 Coax", "aux1_coax", "aux1_coax"),
113     SOURCE_AUX1_OPT("Source Aux 1 Optical", "aux1_opt", "aux1_opt"),
114     SOURCE_COAX1("Source Coax 1", "coax1", "coax1"),
115     SOURCE_COAX2("Source Coax 2", "coax2", "coax2"),
116     SOURCE_COAX3("Source Coax 3", "coax3", "coax3"),
117     SOURCE_OPT1("Source Optical 1", "opt1", "opt1"),
118     SOURCE_OPT2("Source Optical 2", "opt2", "opt2"),
119     SOURCE_OPT3("Source Optical 3", "opt3", "opt3"),
120     SOURCE_BLUETOOTH("Source Bluetooth", "bluetooth", "bluetooth"),
121     SOURCE_ROTEL_CD("Source Rotel CD", "rcd", null),
122     SOURCE_XLR("Source XLR", "bal_xlr", "bal_xlr"),
123     SOURCE_XLR1("Source XLR 1", "bal_xlr1", "bal_xlr1"),
124     SOURCE_XLR2("Source XLR 2", "bal_xlr2", "bal_xlr2"),
125     SOURCE_FM("Source FM", "fm", "fm"),
126     SOURCE_DAB("Source DAB", "dab", "dab"),
127     SOURCE_PLAYFI("Source PlayFi", "playfi", "playfi"),
128     SOURCE_IRADIO("Source iRadio", "iradio", "iradio"),
129     SOURCE_NETWORK("Source Network", "network", "network"),
130     SOURCE_INPUT_A("Source Input A", null, "input_a"),
131     SOURCE_INPUT_B("Source Input B", null, "input_b"),
132     SOURCE_INPUT_C("Source Input C", null, "input_c"),
133     SOURCE_INPUT_D("Source Input D", null, "input_d"),
134     SOURCE("Request current source", "get_current_source", "source?"),
135     INPUT("Request current source", null, "input?"),
136     MAIN_ZONE_SOURCE_CD("Main Zone Source CD", MAIN_ZONE_CMD, (byte) 0x02, "main_zone_cd", "main_zone_cd"),
137     MAIN_ZONE_SOURCE_TUNER("Main Zone Source Tuner", MAIN_ZONE_CMD, (byte) 0x03, "main_zone_tuner", "main_zone_tuner"),
138     MAIN_ZONE_SOURCE_TAPE("Main Zone Source Tape", MAIN_ZONE_CMD, (byte) 0x04, "main_zone_tape", "main_zone_tape"),
139     MAIN_ZONE_SOURCE_VIDEO1("Main Zone Source Video 1", MAIN_ZONE_CMD, (byte) 0x05, "main_zone_video1",
140             "main_zone_video1"),
141     MAIN_ZONE_SOURCE_VIDEO2("Main Zone Source Video 2", MAIN_ZONE_CMD, (byte) 0x06, "main_zone_video2",
142             "main_zone_video2"),
143     MAIN_ZONE_SOURCE_VIDEO3("Main Zone Source Video 3", MAIN_ZONE_CMD, (byte) 0x07, "main_zone_video3",
144             "main_zone_video3"),
145     MAIN_ZONE_SOURCE_VIDEO4("Main Zone Source Video 4", MAIN_ZONE_CMD, (byte) 0x08, "main_zone_video4",
146             "main_zone_video4"),
147     MAIN_ZONE_SOURCE_VIDEO5("Main Zone Source Video 5", MAIN_ZONE_CMD, (byte) 0x09, "main_zone_video5",
148             "main_zone_video5"),
149     MAIN_ZONE_SOURCE_VIDEO6("Main Zone Source Video 6", MAIN_ZONE_CMD, (byte) 0x94, "main_zone_video6",
150             "main_zone_video6"),
151     MAIN_ZONE_SOURCE_USB("Main Zone Source Front USB", MAIN_ZONE_CMD, (byte) 0x8E, "main_zone_usb", "main_zone_usb"),
152     MAIN_ZONE_SOURCE_MULTI_INPUT("Main Zone Source Multi Input", MAIN_ZONE_CMD, (byte) 0x15, "main_zone_multi_input",
153             "main_zone_multi_input"),
154     ZONE1_SOURCE_INPUT_A("Zone 1 Source Input A", null, "z1:input_a"),
155     ZONE1_SOURCE_INPUT_B("Zone 1 Source Input B", null, "z1:input_b"),
156     ZONE1_SOURCE_INPUT_C("Zone 1 Source Input C", null, "z1:input_c"),
157     ZONE1_SOURCE_INPUT_D("Zone 1 Source Input D", null, "z1:input_d"),
158     RECORD_SOURCE_CD("Record Source CD", RECORD_SRC_CMD, (byte) 0x02, "record_cd", "record_cd"),
159     RECORD_SOURCE_TUNER("Record Source Tuner", RECORD_SRC_CMD, (byte) 0x03, "record_tuner", "record_tuner"),
160     RECORD_SOURCE_TAPE("Record Source Tape", RECORD_SRC_CMD, (byte) 0x04, "record_tape", "record_tape"),
161     RECORD_SOURCE_VIDEO1("Record Source Video 1", RECORD_SRC_CMD, (byte) 0x05, "record_video1", "record_video1"),
162     RECORD_SOURCE_VIDEO2("Record Source Video 2", RECORD_SRC_CMD, (byte) 0x06, "record_video2", "record_video2"),
163     RECORD_SOURCE_VIDEO3("Record Source Video 3", RECORD_SRC_CMD, (byte) 0x07, "record_video3", "record_video3"),
164     RECORD_SOURCE_VIDEO4("Record Source Video 4", RECORD_SRC_CMD, (byte) 0x08, "record_video4", "record_video4"),
165     RECORD_SOURCE_VIDEO5("Record Source Video 5", RECORD_SRC_CMD, (byte) 0x09, "record_video5", "record_video5"),
166     RECORD_SOURCE_VIDEO6("Record Source Video 6", RECORD_SRC_CMD, (byte) 0x94, "record_video6", "record_video6"),
167     RECORD_SOURCE_USB("Record Source Front USB", RECORD_SRC_CMD, (byte) 0x8E, "record_usb", "record_usb"),
168     RECORD_SOURCE_MAIN("Record Follow Main Zone Source", RECORD_SRC_CMD, (byte) 0x6B, "record_follow_main",
169             "record_follow_main"),
170     ZONE2_SOURCE_CD("Zone 2 Source CD", ZONE2_CMD, (byte) 0x02, "zone2_cd", "zone2_cd"),
171     ZONE2_SOURCE_TUNER("Zone 2 Source Tuner", ZONE2_CMD, (byte) 0x03, "zone2_tuner", "zone2_tuner"),
172     ZONE2_SOURCE_TAPE("Zone 2 Source Tape", ZONE2_CMD, (byte) 0x04, "zone2_tape", "zone2_tape"),
173     ZONE2_SOURCE_VIDEO1("Zone 2 Source Video 1", ZONE2_CMD, (byte) 0x05, "zone2_video1", "zone2_video1"),
174     ZONE2_SOURCE_VIDEO2("Zone 2 Source Video 2", ZONE2_CMD, (byte) 0x06, "zone2_video2", "zone2_video2"),
175     ZONE2_SOURCE_VIDEO3("Zone 2 Source Video 3", ZONE2_CMD, (byte) 0x07, "zone2_video3", "zone2_video3"),
176     ZONE2_SOURCE_VIDEO4("Zone 2 Source Video 4", ZONE2_CMD, (byte) 0x08, "zone2_video4", "zone2_video4"),
177     ZONE2_SOURCE_VIDEO5("Zone 2 Source Video 5", ZONE2_CMD, (byte) 0x09, "zone2_video5", "zone2_video5"),
178     ZONE2_SOURCE_VIDEO6("Zone 2 Source Video 6", ZONE2_CMD, (byte) 0x94, "zone2_video6", "zone2_video6"),
179     ZONE2_SOURCE_USB("Zone 2 Source Front USB", ZONE2_CMD, (byte) 0x8E, "zone2_usb", "zone2_usb"),
180     ZONE2_SOURCE_MAIN("Zone 2 Follow Main Zone Source", ZONE2_CMD, (byte) 0x6B, "zone2_follow_main",
181             "zone2_follow_main"),
182     ZONE2_SOURCE_INPUT_A("Zone 2 Source Input A", null, "z2:input_a"),
183     ZONE2_SOURCE_INPUT_B("Zone 2 Source Input B", null, "z2:input_b"),
184     ZONE2_SOURCE_INPUT_C("Zone 2 Source Input C", null, "z2:input_c"),
185     ZONE2_SOURCE_INPUT_D("Zone 2 Source Input D", null, "z2:input_d"),
186     ZONE3_SOURCE_CD("Zone 3 Source CD", ZONE3_CMD, (byte) 0x02, "zone3_cd", "zone3_cd"),
187     ZONE3_SOURCE_TUNER("Zone 3 Source Tuner", ZONE3_CMD, (byte) 0x03, "zone3_tuner", "zone3_tuner"),
188     ZONE3_SOURCE_TAPE("Zone 3 Source Tape", ZONE3_CMD, (byte) 0x04, "zone3_tape", "zone3_tape"),
189     ZONE3_SOURCE_VIDEO1("Zone 3 Source Video 1", ZONE3_CMD, (byte) 0x05, "zone3_video1", "zone3_video1"),
190     ZONE3_SOURCE_VIDEO2("Zone 3 Source Video 2", ZONE3_CMD, (byte) 0x06, "zone3_video2", "zone3_video2"),
191     ZONE3_SOURCE_VIDEO3("Zone 3 Source Video 3", ZONE3_CMD, (byte) 0x07, "zone3_video3", "zone3_video3"),
192     ZONE3_SOURCE_VIDEO4("Zone 3 Source Video 4", ZONE3_CMD, (byte) 0x08, "zone3_video4", "zone3_video4"),
193     ZONE3_SOURCE_VIDEO5("Zone 3 Source Video 5", ZONE3_CMD, (byte) 0x09, "zone3_video5", "zone3_video5"),
194     ZONE3_SOURCE_VIDEO6("Zone 3 Source Video 6", ZONE3_CMD, (byte) 0x94, "zone3_video6", "zone3_video6"),
195     ZONE3_SOURCE_USB("Zone 3 Source Front USB", ZONE3_CMD, (byte) 0x8E, "zone3_usb", "zone3_usb"),
196     ZONE3_SOURCE_MAIN("Zone 3 Follow Main Zone Source", ZONE3_CMD, (byte) 0x6B, "zone3_follow_main",
197             "zone3_follow_main"),
198     ZONE3_SOURCE_INPUT_A("Zone 3 Source Input A", null, "z3:input_a"),
199     ZONE3_SOURCE_INPUT_B("Zone 3 Source Input B", null, "z3:input_b"),
200     ZONE3_SOURCE_INPUT_C("Zone 3 Source Input C", null, "z3:input_c"),
201     ZONE3_SOURCE_INPUT_D("Zone 3 Source Input D", null, "z3:input_d"),
202     ZONE4_SOURCE_CD("Zone 4 Source CD", ZONE4_CMD, (byte) 0x02, "zone4_cd", "zone4_cd"),
203     ZONE4_SOURCE_TUNER("Zone 4 Source Tuner", ZONE4_CMD, (byte) 0x03, "zone4_tuner", "zone4_tuner"),
204     ZONE4_SOURCE_TAPE("Zone 4 Source Tape", ZONE4_CMD, (byte) 0x04, "zone4_tape", "zone4_tape"),
205     ZONE4_SOURCE_VIDEO1("Zone 4 Source Video 1", ZONE4_CMD, (byte) 0x05, "zone4_video1", "zone4_video1"),
206     ZONE4_SOURCE_VIDEO2("Zone 4 Source Video 2", ZONE4_CMD, (byte) 0x06, "zone4_video2", "zone4_video2"),
207     ZONE4_SOURCE_VIDEO3("Zone 4 Source Video 3", ZONE4_CMD, (byte) 0x07, "zone4_video3", "zone4_video3"),
208     ZONE4_SOURCE_VIDEO4("Zone 4 Source Video 4", ZONE4_CMD, (byte) 0x08, "zone4_video4", "zone4_video4"),
209     ZONE4_SOURCE_VIDEO5("Zone 4 Source Video 5", ZONE4_CMD, (byte) 0x09, "zone4_video5", "zone4_video5"),
210     ZONE4_SOURCE_VIDEO6("Zone 4 Source Video 6", ZONE4_CMD, (byte) 0x94, "zone4_video6", "zone4_video6"),
211     ZONE4_SOURCE_USB("Zone 4 Source Front USB", ZONE4_CMD, (byte) 0x8E, "zone4_usb", "zone4_usb"),
212     ZONE4_SOURCE_MAIN("Zone 4 Follow Main Zone Source", ZONE4_CMD, (byte) 0x6B, "zone4_follow_main",
213             "zone4_follow_main"),
214     ZONE4_SOURCE_INPUT_A("Zone 4 Source Input A", null, "z4:input_a"),
215     ZONE4_SOURCE_INPUT_B("Zone 4 Source Input B", null, "z4:input_b"),
216     ZONE4_SOURCE_INPUT_C("Zone 4 Source Input C", null, "z4:input_c"),
217     ZONE4_SOURCE_INPUT_D("Zone 4 Source Input D", null, "z4:input_d"),
218     STEREO("Stereo", PRIMARY_CMD, (byte) 0x11, "2channel", "2channel"),
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", PRIMARY_CMD, (byte) 0x11, "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
483     public static final List<RotelCommand> SRC_CTRL_CMDS_SET1 = List.of(PLAY, STOP, PAUSE, TRACK_FWD, TRACK_BACK);
484     public static final List<RotelCommand> SRC_CTRL_CMDS_SET2 = List.of(FAST_FWD, FAST_BACK, RANDOM_TOGGLE,
485             REPEAT_TOGGLE);
486     public static final List<RotelCommand> SRC_CTRL_CMDS_SET3 = List.of(FAST_FWD, FAST_BACK, EJECT, TIME_TOGGLE);
487
488     public static final List<RotelCommand> TUNER_CMDS_SET1 = List.of(TUNE_UP, TUNE_DOWN, MEMORY, BAND_TOGGLE, AM, FM,
489             TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT, PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY,
490             RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
491     public static final List<RotelCommand> TUNER_CMDS_SET2 = List.of(TUNE_UP, TUNE_DOWN, PRESET_UP, PRESET_DOWN,
492             FREQUENCY_UP, FREQUENCY_DOWN, MEMORY, BAND_TOGGLE, AM, FM, TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT,
493             PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY, RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
494     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
495             ZONE2_BAND_TOGGLE, ZONE2_AM, ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT,
496             ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN, ZONE2_FM_MONO_TOGGLE);
497     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET2 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
498             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
499             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
500             ZONE2_FM_MONO_TOGGLE);
501     public static final List<RotelCommand> ZONE234_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
502             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
503             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
504             ZONE2_FM_MONO_TOGGLE, ZONE3_TUNE_UP, ZONE3_TUNE_DOWN, ZONE3_PRESET_UP, ZONE3_PRESET_DOWN,
505             ZONE3_FREQUENCY_UP, ZONE3_FREQUENCY_DOWN, ZONE3_BAND_TOGGLE, ZONE3_AM, ZONE3_FM, ZONE3_TUNE_PRESET_TOGGLE,
506             ZONE3_TUNING_MODE_SELECT, ZONE3_PRESET_MODE_SELECT, ZONE3_PRESET_SCAN, ZONE3_FM_MONO_TOGGLE, ZONE4_TUNE_UP,
507             ZONE4_TUNE_DOWN, ZONE4_PRESET_UP, ZONE4_PRESET_DOWN, ZONE4_FREQUENCY_UP, ZONE4_FREQUENCY_DOWN,
508             ZONE4_BAND_TOGGLE, ZONE4_AM, ZONE4_FM, ZONE4_TUNE_PRESET_TOGGLE, ZONE4_TUNING_MODE_SELECT,
509             ZONE4_PRESET_MODE_SELECT, ZONE4_PRESET_SCAN, ZONE4_FM_MONO_TOGGLE);
510
511     public static final List<RotelCommand> MENU_CTRL_CMDS = List.of(MENU, EXIT, UP, DOWN, LEFT, RIGHT, ENTER);
512     public static final List<RotelCommand> MENU2_CTRL_CMDS = List.of(MENU, UP, DOWN, LEFT, RIGHT, ENTER);
513     public static final List<RotelCommand> MENU3_CTRL_CMDS = List.of(MENU, EXIT, UP_PRESSED, UP_RELEASED, DOWN_PRESSED,
514             DOWN_RELEASED, LEFT_PRESSED, LEFT_RELEASED, RIGHT_PRESSED, RIGHT_RELEASED, ENTER);
515
516     public static final List<RotelCommand> NUMERIC_KEY_CMDS = List.of(KEY1, KEY2, KEY3, KEY4, KEY5, KEY6, KEY7, KEY8,
517             KEY9, KEY0);
518     public static final List<RotelCommand> ZONE2_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
519             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0);
520     public static final List<RotelCommand> ZONE234_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
521             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0, ZONE3_KEY1, ZONE3_KEY2,
522             ZONE3_KEY3, ZONE3_KEY4, ZONE3_KEY5, ZONE3_KEY6, ZONE3_KEY7, ZONE3_KEY8, ZONE3_KEY9, ZONE3_KEY0, ZONE4_KEY1,
523             ZONE4_KEY2, ZONE4_KEY3, ZONE4_KEY4, ZONE4_KEY5, ZONE4_KEY6, ZONE4_KEY7, ZONE4_KEY8, ZONE4_KEY9, ZONE4_KEY0);
524
525     public static final List<RotelCommand> PCUSB_CLASS_CMDS = List.of(PCUSB_CLASS_1, PCUSB_CLASS_2);
526
527     public static final List<RotelCommand> OTHER_CMDS_SET1 = List.of(RECORD_FONCTION_SELECT, TONE_CONTROL_SELECT,
528             DYNAMIC_RANGE, DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
529     public static final List<RotelCommand> OTHER_CMDS_SET2 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
530             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
531             HDMI_TV_MODE);
532     public static final List<RotelCommand> OTHER_CMDS_SET3 = List.of(RECORD_FONCTION_SELECT, DYNAMIC_RANGE,
533             DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
534     public static final List<RotelCommand> OTHER_CMDS_SET4 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
535             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
536             HDMI_TV_MODE, ROOM_EQ_TOGGLE, SPEAKER_SETTING_TOGGLE, RESET_FACTORY);
537
538     public static final byte PRIMARY_COMMAND = (byte) 0x10;
539
540     private String label;
541     private byte hexType;
542     private byte hexKey;
543     private @Nullable String asciiCommandV1;
544     private @Nullable String asciiCommandV2;
545
546     /**
547      * Constructor when the textual commands are undefined
548      *
549      * @param label the command label
550      * @param hexType the the command type (HEX protocol)
551      * @param hexKey the the command key (HEX protocol)
552      */
553     private RotelCommand(String label, byte hexType, byte hexKey) {
554         this(label, hexType, hexKey, null, null);
555     }
556
557     /**
558      * Constructor when the HEX command is undefined
559      *
560      * @param label the command label
561      * @param asciiCommandV1 the textual command (ASCII protocol V1)
562      * @param asciiCommandV2 the textual command (ASCII protocol V2)
563      */
564     private RotelCommand(String label, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
565         this(label, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
566     }
567
568     /**
569      * Constructor
570      *
571      * @param label the command label
572      * @param hexType the the command type (HEX protocol)
573      * @param hexKey the the command key (HEX protocol)
574      * @param asciiCommandV1 the textual command (ASCII protocol V1)
575      * @param asciiCommandV2 the textual command (ASCII protocol V2)
576      */
577     private RotelCommand(String label, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
578             @Nullable String asciiCommandV2) {
579         this.label = label;
580         this.hexType = hexType;
581         this.hexKey = hexKey;
582         this.asciiCommandV1 = asciiCommandV1;
583         this.asciiCommandV2 = asciiCommandV2;
584     }
585
586     /**
587      * Get the command label
588      *
589      * @return the command label
590      */
591     public String getLabel() {
592         return label;
593     }
594
595     /**
596      * Get the command type (HEX protocol)
597      *
598      * @return the command type
599      */
600     public byte getHexType() {
601         return hexType;
602     }
603
604     /**
605      * Get the command key (HEX protocol)
606      *
607      * @return the command key
608      */
609     public byte getHexKey() {
610         return hexKey;
611     }
612
613     /**
614      * Get the textual command (ASCII protocol V1)
615      *
616      * @return the textual command
617      */
618     public @Nullable String getAsciiCommandV1() {
619         return asciiCommandV1;
620     }
621
622     /**
623      * Get the textual command (ASCII protocol V2)
624      *
625      * @return the textual command
626      */
627     public @Nullable String getAsciiCommandV2() {
628         return asciiCommandV2;
629     }
630
631     /**
632      * Indicate if the command is relative to a particular zone
633      *
634      * @param numZone the zone number
635      *
636      * @return true if the command is relative to the zone
637      */
638     public boolean isCommandForZone(int numZone) {
639         String prefix = String.format("ZONE%d", numZone);
640         return name().startsWith(prefix);
641     }
642
643     @Override
644     public @NonNull String toString() {
645         return label;
646     }
647
648     /**
649      * Get the command associated to a textual command
650      *
651      * @param text the textual command used to identify the command
652      *
653      * @return the command associated to the searched textual command
654      *
655      * @throws RotelException - If no command is associated to the searched textual command
656      */
657     public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
658         for (RotelCommand value : RotelCommand.values()) {
659             if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
660                 return value;
661             }
662         }
663         throw new RotelException("Invalid textual command: " + text);
664     }
665
666     /**
667      * Get the command from its name
668      *
669      * @param name the command name used to identify the command
670      *
671      * @return the command associated to the searched name
672      *
673      * @throws RotelException - If no command is associated to the searched name
674      */
675     public static RotelCommand getFromName(String name) throws RotelException {
676         for (RotelCommand value : RotelCommand.values()) {
677             if (value.name().equals(name)) {
678                 return value;
679             }
680         }
681         throw new RotelException("Invalid command: " + name);
682     }
683
684     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2) {
685         return Stream.of(list1, list2).flatMap(Collection::stream).collect(Collectors.toList());
686     }
687
688     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
689             List<RotelCommand> list3) {
690         return Stream.of(list1, list2, list3).flatMap(Collection::stream).collect(Collectors.toList());
691     }
692
693     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
694             List<RotelCommand> list3, List<RotelCommand> list4) {
695         return Stream.of(list1, list2, list3, list4).flatMap(Collection::stream).collect(Collectors.toList());
696     }
697
698     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
699             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5) {
700         return Stream.of(list1, list2, list3, list4, list5).flatMap(Collection::stream).collect(Collectors.toList());
701     }
702
703     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
704             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6) {
705         return Stream.of(list1, list2, list3, list4, list5, list6).flatMap(Collection::stream)
706                 .collect(Collectors.toList());
707     }
708
709     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
710             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
711             List<RotelCommand> list7) {
712         return Stream.of(list1, list2, list3, list4, list5, list6, list7).flatMap(Collection::stream)
713                 .collect(Collectors.toList());
714     }
715
716     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
717             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
718             List<RotelCommand> list7, List<RotelCommand> list8) {
719         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8).flatMap(Collection::stream)
720                 .collect(Collectors.toList());
721     }
722
723     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
724             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
725             List<RotelCommand> list7, List<RotelCommand> list8, List<RotelCommand> list9) {
726         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8, list9).flatMap(Collection::stream)
727                 .collect(Collectors.toList());
728     }
729 }