]> git.basschouten.com Git - openhab-addons.git/blob
dd1148d252fcb992df790387a7b93c8a37e6829a
[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     DSP_TOGGLE("DSP Mode Toggle", PRIMARY_CMD, (byte) 0x14),
225     DSP1("DSP 1", PRIMARY_CMD, (byte) 0x57),
226     DSP2("DSP 2", PRIMARY_CMD, (byte) 0x58),
227     DSP3("DSP 3", PRIMARY_CMD, (byte) 0x59),
228     DSP4("DSP 4", PRIMARY_CMD, (byte) 0x5A),
229     PROLOGIC_TOGGLE("Dolby 3 Stereo / Pro Logic Toggle", PRIMARY_CMD, (byte) 0x53),
230     PROLOGIC("Dolby Pro Logic", PRIMARY_CMD, (byte) 0x5F),
231     PLII_CINEMA("Dolby PLII Cinema", PRIMARY_CMD, (byte) 0x5D, "prologic_movie", "prologic_movie"),
232     PLII_MUSIC("Dolby PLII Music", PRIMARY_CMD, (byte) 0x5E, "prologic_music", "prologic_music"),
233     PLII_GAME("Dolby PLII Game", PRIMARY_CMD, (byte) 0x74, "prologic_game", "prologic_game"),
234     PLIIZ("Dolby PLIIz", PRIMARY_CMD, (byte) 0x92, "prologic_iiz", "prologic_iiz"),
235     PLII_PANORAMA_TOGGLE("PLII Panorama Toggle", PRIMARY_CMD, (byte) 0x62),
236     PLII_DIMENSION_UP("PLII Dimension Up", PRIMARY_CMD, (byte) 0x63),
237     PLII_DIMENSION_DOWN("PLII Dimension Down", PRIMARY_CMD, (byte) 0x64),
238     PLII_CENTER_WIDTH_UP("PLII Center Width Up", PRIMARY_CMD, (byte) 0x65),
239     PLII_CENTER_WIDTH_DOWN("PLII Center Width Down", PRIMARY_CMD, (byte) 0x66),
240     DDEX_TOGGLE("Dolby Digital EX Toggle", PRIMARY_CMD, (byte) 0x68),
241     NEO6_TOGGLE("dts Neo:6 Music/Cinema Toggle", PRIMARY_CMD, (byte) 0x54),
242     NEO6_MUSIC("dts Neo:6 Music", PRIMARY_CMD, (byte) 0x60, "neo6_music", "neo6_music"),
243     NEO6_CINEMA("dts Neo:6 Cinema", PRIMARY_CMD, (byte) 0x61, "neo6_cinema", "neo6_cinema"),
244     ATMOS("Dolby Atmos", "dolby_atmos", "dolby_atmos"),
245     NEURAL_X("dts Neural:X", "dts_neural", "dts_neural"),
246     BYPASS("Analog Bypass", PRIMARY_CMD, (byte) 0x11, "bypass", "bypass"),
247     NEXT_MODE("Next Surround Mode", PRIMARY_CMD, (byte) 0x22),
248     DSP_MODE("Request current DSP mode", "get_dsp_mode", null),
249     TONE_MAX("Request Max tone level", "get_tone_max", null),
250     TONE_CONTROL_SELECT("Tone Control Select", PRIMARY_CMD, (byte) 0x67),
251     TREBLE_UP("Treble Up", PRIMARY_CMD, (byte) 0x0D, "treble_up", "treble_up"),
252     TREBLE_DOWN("Treble Down", PRIMARY_CMD, (byte) 0x0E, "treble_down", "treble_down"),
253     TREBLE_SET("Set Treble to level", "treble_", "treble_"),
254     TREBLE("Request current treble level", "get_treble", "treble?"),
255     BASS_UP("Bass Up", PRIMARY_CMD, (byte) 0x0F, "bass_up", "bass_up"),
256     BASS_DOWN("Bass Down", PRIMARY_CMD, (byte) 0x10, "bass_down", "bass_down"),
257     BASS_SET("Set Bass to level", "bass_", "bass_"),
258     BASS("Request current bass level", "get_bass", "bass?"),
259     ZONE1_TREBLE_UP("Zone 1 Treble Up", null, "z1:treble_up"),
260     ZONE1_TREBLE_DOWN("Zone 1 Treble Down", null, "z1:treble_down"),
261     ZONE1_TREBLE_SET("Set Zone 1 Treble to level", null, "z1:treble_"),
262     ZONE1_BASS_UP("Zone 1 Bass Up", null, "z1:bass_up"),
263     ZONE1_BASS_DOWN("Zone 1 Bass Down", null, "z1:bass_down"),
264     ZONE1_BASS_SET("Set Zone 1 Bass to level", null, "z1:bass_"),
265     ZONE2_TREBLE_UP("Zone 2 Treble Up", null, "z2:treble_up"),
266     ZONE2_TREBLE_DOWN("Zone 2 Treble Down", null, "z2:treble_down"),
267     ZONE2_TREBLE_SET("Set Zone 2 Treble to level", null, "z2:treble_"),
268     ZONE2_BASS_UP("Zone 2 Bass Up", null, "z2:bass_up"),
269     ZONE2_BASS_DOWN("Zone 2 Bass Down", null, "z2:bass_down"),
270     ZONE2_BASS_SET("Set Zone 2 Bass to level", null, "z2:bass_"),
271     ZONE3_TREBLE_UP("Zone 3 Treble Up", null, "z3:treble_up"),
272     ZONE3_TREBLE_DOWN("Zone 3 Treble Down", null, "z3:treble_down"),
273     ZONE3_TREBLE_SET("Set Zone 3 Treble to level", null, "z3:treble_"),
274     ZONE3_BASS_UP("Zone 3 Bass Up", null, "z3:bass_up"),
275     ZONE3_BASS_DOWN("Zone 3 Bass Down", null, "z3:bass_down"),
276     ZONE3_BASS_SET("Set Zone 3 Bass to level", null, "z3:bass_"),
277     ZONE4_TREBLE_UP("Zone 4 Treble Up", null, "z4:treble_up"),
278     ZONE4_TREBLE_DOWN("Zone 4 Treble Down", null, "z4:treble_down"),
279     ZONE4_TREBLE_SET("Set Zone 4 Treble to level", null, "z4:treble_"),
280     ZONE4_BASS_UP("Zone 4 Bass Up", null, "z4:bass_up"),
281     ZONE4_BASS_DOWN("Zone 4 Bass Down", null, "z4:bass_down"),
282     ZONE4_BASS_SET("Set Zone 4 Bass to level", null, "z4:bass_"),
283     RECORD_FONCTION_SELECT("Record Function Select", PRIMARY_CMD, (byte) 0x17),
284     PLAY("Play Source", PRIMARY_CMD, (byte) 0x04, "play", "play"),
285     STOP("Stop Source", PRIMARY_CMD, (byte) 0x06, "stop", "stop"),
286     PAUSE("Pause Source", PRIMARY_CMD, (byte) 0x05, "pause", "pause"),
287     CD_PLAY_STATUS("Request CD play status", "get_cd_play_status", null),
288     PLAY_STATUS("Request source play status", "get_play_status", "status?"),
289     RANDOM_TOGGLE("Random Play Mode Toggle", PRIMARY_CMD, (byte) 0x25, "random", "rnd"),
290     RANDOM_MODE("Request current random play mode", null, "rnd?"),
291     REPEAT_TOGGLE("Repeat Play Mode Toggle", PRIMARY_CMD, (byte) 0x26, "repeat", "rpt"),
292     REPEAT_MODE("Request current repeat play mode", null, "rpt?"),
293     TRACK_FWD("Track Forward/Tune Up", PRIMARY_CMD, (byte) 0x09, "track_fwd", "trkf"),
294     TRACK_BACK("Track Backward/Tune Down", PRIMARY_CMD, (byte) 0x08, "track_back", "trkb"),
295     FAST_FWD("Fast Forward/Search Forward", PRIMARY_CMD, (byte) 0x0B, "fast_fwd", "ff"),
296     FAST_BACK("Fast Backward/Search Backward", PRIMARY_CMD, (byte) 0x0A, "fast_back", "fb"),
297     TRACK("Request current CD track number", null, "track?"),
298     EJECT("Eject CD", "eject", "eject"),
299     TIME_TOGGLE("Toggle CD Time Display", "time", "time"),
300     FREQUENCY("Request current frequency for digital source input", "get_current_freq", "freq?"),
301     DISPLAY_REFRESH("Display Refresh", PRIMARY_CMD, (byte) 0xFF),
302     DIMMER_LEVEL_GET("Request current front display dimmer level", "get_current_dimmer", "dimmer?"),
303     DIMMER_LEVEL_SET("Set front display dimmer to level", "dimmer_", "dimmer_"),
304     UPDATE_AUTO("Set Update to Auto", "display_update_auto", "rs232_update_on"),
305     UPDATE_MANUAL("Set Update to Manual", "display_update_manual", "rs232_update_off"),
306     TONE_CONTROLS_ON("Tone Controls On", "tone_on", null),
307     TONE_CONTROLS_OFF("Tone Controls Off", "tone_off", null),
308     TONE_CONTROLS("Request current tone control state", "get_tone", null),
309     TCBYPASS_ON("Bypass On", null, "bypass_on"),
310     TCBYPASS_OFF("Bypass Off", null, "bypass_off"),
311     TCBYPASS("Request current tone bypass state", null, "bypass?"),
312     BALANCE_RIGHT("Balance Right", "balance_right", "balance_r"),
313     BALANCE_LEFT("Balance Left", "balance_left", "balance_l"),
314     BALANCE_SET("Set Balance to level", "balance_", "balance_"),
315     ZONE1_BALANCE_RIGHT("Zone 1 Balance Right", null, "z1:balance_r"),
316     ZONE1_BALANCE_LEFT("Zone 1 Balance Left", null, "z1:balance_l"),
317     ZONE1_BALANCE_SET("Set Zone 1 Balance to level", null, "z1:balance_"),
318     ZONE2_BALANCE_RIGHT("Zone 2 Balance Right", null, "z2:balance_r"),
319     ZONE2_BALANCE_LEFT("Zone 2 Balance Left", null, "z2:balance_l"),
320     ZONE2_BALANCE_SET("Set Zone 2 Balance to level", null, "z2:balance_"),
321     ZONE3_BALANCE_RIGHT("Zone 3 Balance Right", null, "z3:balance_r"),
322     ZONE3_BALANCE_LEFT("Zone 3 Balance Left", null, "z3:balance_l"),
323     ZONE3_BALANCE_SET("Set Zone 3 Balance to level", null, "z3:balance_"),
324     ZONE4_BALANCE_RIGHT("Zone 4 Balance Right", null, "z4:balance_r"),
325     ZONE4_BALANCE_LEFT("Zone 4 Balance Left", null, "z4:balance_l"),
326     ZONE4_BALANCE_SET("Set Zone 4 Balance to level", null, "z4:balance_"),
327     BALANCE("Request current balance setting", "get_balance", "balance?"),
328     SPEAKER_A_TOGGLE("Toggle Speaker A Output", PRIMARY_CMD, (byte) 0x50, "speaker_a", "speaker_a"),
329     SPEAKER_A_ON("Set Speaker A Output", "speaker_a_on", "speaker_a_on"),
330     SPEAKER_A_OFF("Unset Speaker A Output", "speaker_a_off", "speaker_a_off"),
331     SPEAKER_B_TOGGLE("Toggle Speaker B Output", PRIMARY_CMD, (byte) 0x51, "speaker_b", "speaker_b"),
332     SPEAKER_B_ON("Set Speaker B Output", "speaker_b_on", "speaker_b_on"),
333     SPEAKER_B_OFF("Unset Speaker B Output", "speaker_b_off", "speaker_b_off"),
334     SPEAKER("Request current active speaker outputs", "get_current_speaker", "speaker?"),
335     TUNE_UP("Tune Up", PRIMARY_CMD, (byte) 0x28),
336     TUNE_DOWN("Tune Down", PRIMARY_CMD, (byte) 0x29),
337     PRESET_UP("Preset Up", PRIMARY_CMD, (byte) 0x6F),
338     PRESET_DOWN("Preset Down", PRIMARY_CMD, (byte) 0x70),
339     FREQUENCY_UP("Frequency Up", PRIMARY_CMD, (byte) 0x72),
340     FREQUENCY_DOWN("Frequency Down", PRIMARY_CMD, (byte) 0x73),
341     MEMORY("Memory", PRIMARY_CMD, (byte) 0x27),
342     BAND_TOGGLE("Band Toggle", PRIMARY_CMD, (byte) 0x24),
343     AM("AM", PRIMARY_CMD, (byte) 0x56),
344     FM("FM", PRIMARY_CMD, (byte) 0x55),
345     TUNE_PRESET_TOGGLE("Tune / Preset", PRIMARY_CMD, (byte) 0x20),
346     TUNING_MODE_SELECT("Tuning Mode Select", PRIMARY_CMD, (byte) 0x69),
347     PRESET_MODE_SELECT("Preset Mode Select", PRIMARY_CMD, (byte) 0x6A),
348     FREQUENCY_DIRECT("Frequency Direct", PRIMARY_CMD, (byte) 0x25),
349     PRESET_SCAN("Preset Scan", PRIMARY_CMD, (byte) 0x21),
350     TUNER_DISPLAY("Tuner Display", PRIMARY_CMD, (byte) 0x44),
351     RDS_PTY("RDS PTY", PRIMARY_CMD, (byte) 0x45),
352     RDS_TP("RDS TP", PRIMARY_CMD, (byte) 0x46),
353     RDS_TA("RDS TA", PRIMARY_CMD, (byte) 0x47),
354     FM_MONO_TOGGLE("FM Mono", PRIMARY_CMD, (byte) 0x26),
355     ZONE2_TUNE_UP("Zone 2 Tune Up", ZONE2_CMD, (byte) 0x28),
356     ZONE2_TUNE_DOWN("Zone 2 Tune Down", ZONE2_CMD, (byte) 0x29),
357     ZONE2_PRESET_UP("Zone 2 Preset Up", ZONE2_CMD, (byte) 0x6F),
358     ZONE2_PRESET_DOWN("Zone 2 Preset Down", ZONE2_CMD, (byte) 0x70),
359     ZONE2_FREQUENCY_UP("Zone 2 Frequency Up", ZONE2_CMD, (byte) 0x72),
360     ZONE2_FREQUENCY_DOWN("Zone 2 Frequency Down", ZONE2_CMD, (byte) 0x73),
361     ZONE2_BAND_TOGGLE("Zone 2 Band Toggle", ZONE2_CMD, (byte) 0x24),
362     ZONE2_AM("Zone 2 AM", ZONE2_CMD, (byte) 0x56),
363     ZONE2_FM("Zone 2 FM", ZONE2_CMD, (byte) 0x55),
364     ZONE2_TUNE_PRESET_TOGGLE("Zone 2 Tune / Preset", ZONE2_CMD, (byte) 0x20),
365     ZONE2_TUNING_MODE_SELECT("Zone 2 Tuning Mode Select", ZONE2_CMD, (byte) 0x69),
366     ZONE2_PRESET_MODE_SELECT("Zone 2 Preset Mode Select", ZONE2_CMD, (byte) 0x6A),
367     ZONE2_PRESET_SCAN("Zone 2 Preset Scan", ZONE2_CMD, (byte) 0x21),
368     ZONE2_FM_MONO_TOGGLE("Zone 2 FM Mono", ZONE2_CMD, (byte) 0x26),
369     ZONE3_TUNE_UP("Zone 3 Tune Up", ZONE3_CMD, (byte) 0x28),
370     ZONE3_TUNE_DOWN("Zone 3 Tune Down", ZONE3_CMD, (byte) 0x29),
371     ZONE3_PRESET_UP("Zone 3 Preset Up", ZONE3_CMD, (byte) 0x6F),
372     ZONE3_PRESET_DOWN("Zone 3 Preset Down", ZONE3_CMD, (byte) 0x70),
373     ZONE3_FREQUENCY_UP("Zone 3 Frequency Up", ZONE3_CMD, (byte) 0x72),
374     ZONE3_FREQUENCY_DOWN("Zone 3 Frequency Down", ZONE3_CMD, (byte) 0x73),
375     ZONE3_BAND_TOGGLE("Zone 3 Band Toggle", ZONE3_CMD, (byte) 0x24),
376     ZONE3_AM("Zone 3 AM", ZONE3_CMD, (byte) 0x56),
377     ZONE3_FM("Zone 3 FM", ZONE3_CMD, (byte) 0x55),
378     ZONE3_TUNE_PRESET_TOGGLE("Zone 3 Tune / Preset", ZONE3_CMD, (byte) 0x20),
379     ZONE3_TUNING_MODE_SELECT("Zone 3 Tuning Mode Select", ZONE3_CMD, (byte) 0x69),
380     ZONE3_PRESET_MODE_SELECT("Zone 3 Preset Mode Select", ZONE3_CMD, (byte) 0x6A),
381     ZONE3_PRESET_SCAN("Zone 3 Preset Scan", ZONE3_CMD, (byte) 0x21),
382     ZONE3_FM_MONO_TOGGLE("Zone 3 FM Mono", ZONE3_CMD, (byte) 0x26),
383     ZONE4_TUNE_UP("Zone 4 Tune Up", ZONE4_CMD, (byte) 0x28),
384     ZONE4_TUNE_DOWN("Zone 4 Tune Down", ZONE4_CMD, (byte) 0x29),
385     ZONE4_PRESET_UP("Zone 4 Preset Up", ZONE4_CMD, (byte) 0x6F),
386     ZONE4_PRESET_DOWN("Zone 4 Preset Down", ZONE4_CMD, (byte) 0x70),
387     ZONE4_FREQUENCY_UP("Zone 4 Frequency Up", ZONE4_CMD, (byte) 0x72),
388     ZONE4_FREQUENCY_DOWN("Zone 4 Frequency Down", ZONE4_CMD, (byte) 0x73),
389     ZONE4_BAND_TOGGLE("Zone 4 Band Toggle", ZONE4_CMD, (byte) 0x24),
390     ZONE4_AM("Zone 4 AM", ZONE4_CMD, (byte) 0x56),
391     ZONE4_FM("Zone 4 FM", ZONE4_CMD, (byte) 0x55),
392     ZONE4_TUNE_PRESET_TOGGLE("Zone 4 Tune / Preset", ZONE4_CMD, (byte) 0x20),
393     ZONE4_TUNING_MODE_SELECT("Zone 4 Tuning Mode Select", ZONE4_CMD, (byte) 0x69),
394     ZONE4_PRESET_MODE_SELECT("Zone 4 Preset Mode Select", ZONE4_CMD, (byte) 0x6A),
395     ZONE4_PRESET_SCAN("Zone 4 Preset Scan", ZONE4_CMD, (byte) 0x21),
396     ZONE4_FM_MONO_TOGGLE("Zone 4 FM Mono", ZONE4_CMD, (byte) 0x26),
397     MENU("Display the Menu", PRIMARY_CMD, (byte) 0x18, "menu", null),
398     EXIT("Exit Key", PRIMARY_CMD, (byte) 0x90, "exit", null),
399     UP("Cursor Up", PRIMARY_CMD, (byte) 0x1C, "up", null),
400     UP_PRESSED("Cursor Up â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1C),
401     UP_RELEASED("Cursor Up â€“ Key Released", (byte) 0x11, (byte) 0x1C),
402     DOWN("Cursor Down", PRIMARY_CMD, (byte) 0x1D, "down", null),
403     DOWN_PRESSED("Cursor Down â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1D),
404     DOWN_RELEASED("Cursor Down â€“ Key Released", (byte) 0x11, (byte) 0x1D),
405     LEFT("Cursor Left", PRIMARY_CMD, (byte) 0x1B, "left", null),
406     LEFT_PRESSED("Cursor Left â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1B),
407     LEFT_RELEASED("Cursor Left â€“ Key Released", (byte) 0x11, (byte) 0x1B),
408     RIGHT("Cursor Right", PRIMARY_CMD, (byte) 0x1A, "right", null),
409     ENTER("Enter Key", PRIMARY_CMD, (byte) 0x19, "enter", null),
410     RIGHT_PRESSED("Cursor Right â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1A),
411     RIGHT_RELEASED("Cursor Right â€“ Key Released", (byte) 0x11, (byte) 0x1A),
412     KEY1("Number Key 1", PRIMARY_CMD, (byte) 0x2A, "1", "1"),
413     KEY2("Number Key 2", PRIMARY_CMD, (byte) 0x2B, "2", "2"),
414     KEY3("Number Key 3", PRIMARY_CMD, (byte) 0x2C, "3", "3"),
415     KEY4("Number Key 4", PRIMARY_CMD, (byte) 0x2D, "4", "4"),
416     KEY5("Number Key 5", PRIMARY_CMD, (byte) 0x2E, "5", "5"),
417     KEY6("Number Key 6", PRIMARY_CMD, (byte) 0x2F, "6", "6"),
418     KEY7("Number Key 7", PRIMARY_CMD, (byte) 0x30, "7", "7"),
419     KEY8("Number Key 8", PRIMARY_CMD, (byte) 0x31, "8", "8"),
420     KEY9("Number Key 9", PRIMARY_CMD, (byte) 0x32, "9", "9"),
421     KEY0("Number Key 0", PRIMARY_CMD, (byte) 0x33, "0", "0"),
422     ZONE2_KEY1("Zone 2 Number Key 1", ZONE2_CMD, (byte) 0x2A),
423     ZONE2_KEY2("Zone 2 Number Key 2", ZONE2_CMD, (byte) 0x2B),
424     ZONE2_KEY3("Zone 2 Number Key 3", ZONE2_CMD, (byte) 0x2C),
425     ZONE2_KEY4("Zone 2 Number Key 4", ZONE2_CMD, (byte) 0x2D),
426     ZONE2_KEY5("Zone 2 Number Key 5", ZONE2_CMD, (byte) 0x2E),
427     ZONE2_KEY6("Zone 2 Number Key 6", ZONE2_CMD, (byte) 0x2F),
428     ZONE2_KEY7("Zone 2 Number Key 7", ZONE2_CMD, (byte) 0x30),
429     ZONE2_KEY8("Zone 2 Number Key 8", ZONE2_CMD, (byte) 0x31),
430     ZONE2_KEY9("Zone 2 Number Key 9", ZONE2_CMD, (byte) 0x32),
431     ZONE2_KEY0("Zone 2 Number Key 0", ZONE2_CMD, (byte) 0x33),
432     ZONE3_KEY1("Zone 3 Number Key 1", ZONE3_CMD, (byte) 0x2A),
433     ZONE3_KEY2("Zone 3 Number Key 2", ZONE3_CMD, (byte) 0x2B),
434     ZONE3_KEY3("Zone 3 Number Key 3", ZONE3_CMD, (byte) 0x2C),
435     ZONE3_KEY4("Zone 3 Number Key 4", ZONE3_CMD, (byte) 0x2D),
436     ZONE3_KEY5("Zone 3 Number Key 5", ZONE3_CMD, (byte) 0x2E),
437     ZONE3_KEY6("Zone 3 Number Key 6", ZONE3_CMD, (byte) 0x2F),
438     ZONE3_KEY7("Zone 3 Number Key 7", ZONE3_CMD, (byte) 0x30),
439     ZONE3_KEY8("Zone 3 Number Key 8", ZONE3_CMD, (byte) 0x31),
440     ZONE3_KEY9("Zone 3 Number Key 9", ZONE3_CMD, (byte) 0x32),
441     ZONE3_KEY0("Zone 3 Number Key 0", ZONE3_CMD, (byte) 0x33),
442     ZONE4_KEY1("Zone 4 Number Key 1", ZONE4_CMD, (byte) 0x2A),
443     ZONE4_KEY2("Zone 4 Number Key 2", ZONE4_CMD, (byte) 0x2B),
444     ZONE4_KEY3("Zone 4 Number Key 3", ZONE4_CMD, (byte) 0x2C),
445     ZONE4_KEY4("Zone 4 Number Key 4", ZONE4_CMD, (byte) 0x2D),
446     ZONE4_KEY5("Zone 4 Number Key 5", ZONE4_CMD, (byte) 0x2E),
447     ZONE4_KEY6("Zone 4 Number Key 6", ZONE4_CMD, (byte) 0x2F),
448     ZONE4_KEY7("Zone 4 Number Key 7", ZONE4_CMD, (byte) 0x30),
449     ZONE4_KEY8("Zone 4 Number Key 8", ZONE4_CMD, (byte) 0x31),
450     ZONE4_KEY9("Zone 4 Number Key 9", ZONE4_CMD, (byte) 0x32),
451     ZONE4_KEY0("Zone 4 Number Key 0", ZONE4_CMD, (byte) 0x33),
452     PROGRAM("Program Key", "program", null),
453     PCUSB_CLASS_1("Set PC-USB Audio Class to 1.0", "pcusb_class_1", "pcusb_class_1"),
454     PCUSB_CLASS_2("Set PC-USB Audio Class to 2.0", "pcusb_class_2", "pcusb_class_2"),
455     PCUSB_CLASS_GET("Request current PC-USB class", "get_pcusb_class", "pcusb?"),
456     RESET_FACTORY("Reset unit to factory defaults", PRIMARY_CMD, (byte) 0x93, "factory_default_on",
457             "factory_default_on"),
458     DYNAMIC_RANGE("Dynamic Range", PRIMARY_CMD, (byte) 0x16),
459     DIGITAL_INPUT_SELECT("Digital Input Select", PRIMARY_CMD, (byte) 0x1F),
460     ZONE_TOGGLE("Zone Toggle", PRIMARY_CMD, (byte) 0x23),
461     CENTER_TRIM("Temporary Center Trim", PRIMARY_CMD, (byte) 0x4C),
462     SUB_TRIM("Temporary Subwoofer  Trim", PRIMARY_CMD, (byte) 0x4D),
463     SURROUND_TRIM("Temporary Surround  Trim", PRIMARY_CMD, (byte) 0x4E),
464     CINEMA_EQ_TOGGLE("Cinema EQ Toggle", PRIMARY_CMD, (byte) 0x4F),
465     DISPLAY_TOGGLE("Front Display On/Off", PRIMARY_CMD, (byte) 0x52),
466     PARTY_MODE_TOGGLE("Party Mode Toggle", PRIMARY_CMD, (byte) 0x6E),
467     ZONE2_PARTY_MODE_TOGGLE("Zone 2 Party Mode Toggle", ZONE2_CMD, (byte) 0x6E),
468     ZONE3_PARTY_MODE_TOGGLE("Zone 3 Party Mode Toggle", ZONE3_CMD, (byte) 0x6E),
469     ZONE4_PARTY_MODE_TOGGLE("Zone 4 Party Mode Toggle", ZONE4_CMD, (byte) 0x6E),
470     OUTPUT_RESOLUTION("Output Resolution", PRIMARY_CMD, (byte) 0x75),
471     HDMI_AMP_MODE("HDMI Amp Mode", PRIMARY_CMD, (byte) 0x78),
472     HDMI_TV_MODE("HDMI TV Mode", PRIMARY_CMD, (byte) 0x79),
473     ROOM_EQ_TOGGLE("Temporary Room EQ Toggle", PRIMARY_CMD, (byte) 0x67),
474     SPEAKER_SETTING_TOGGLE("Speaker Level Setting Toggle", PRIMARY_CMD, (byte) 0xA1),
475     MODEL("Request the model number", null, "model?"),
476     VERSION("Request the main CPU software version", null, "version?");
477
478     public static final List<RotelCommand> DSP_CMDS_SET1 = List.of(DSP_TOGGLE, PROLOGIC_TOGGLE, PLII_PANORAMA_TOGGLE,
479             PLII_DIMENSION_UP, PLII_DIMENSION_DOWN, PLII_CENTER_WIDTH_UP, PLII_CENTER_WIDTH_DOWN, DDEX_TOGGLE,
480             NEO6_TOGGLE, NEXT_MODE);
481
482     public static final List<RotelCommand> SRC_CTRL_CMDS_SET1 = List.of(PLAY, STOP, PAUSE, TRACK_FWD, TRACK_BACK);
483     public static final List<RotelCommand> SRC_CTRL_CMDS_SET2 = List.of(FAST_FWD, FAST_BACK, RANDOM_TOGGLE,
484             REPEAT_TOGGLE);
485     public static final List<RotelCommand> SRC_CTRL_CMDS_SET3 = List.of(FAST_FWD, FAST_BACK, EJECT, TIME_TOGGLE);
486
487     public static final List<RotelCommand> TUNER_CMDS_SET1 = List.of(TUNE_UP, TUNE_DOWN, MEMORY, BAND_TOGGLE, AM, FM,
488             TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT, PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY,
489             RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
490     public static final List<RotelCommand> TUNER_CMDS_SET2 = List.of(TUNE_UP, TUNE_DOWN, PRESET_UP, PRESET_DOWN,
491             FREQUENCY_UP, FREQUENCY_DOWN, MEMORY, BAND_TOGGLE, AM, FM, TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT,
492             PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY, RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
493     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
494             ZONE2_BAND_TOGGLE, ZONE2_AM, ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT,
495             ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN, ZONE2_FM_MONO_TOGGLE);
496     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET2 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
497             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
498             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
499             ZONE2_FM_MONO_TOGGLE);
500     public static final List<RotelCommand> ZONE234_TUNER_CMDS_SET1 = 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, ZONE3_TUNE_UP, ZONE3_TUNE_DOWN, ZONE3_PRESET_UP, ZONE3_PRESET_DOWN,
504             ZONE3_FREQUENCY_UP, ZONE3_FREQUENCY_DOWN, ZONE3_BAND_TOGGLE, ZONE3_AM, ZONE3_FM, ZONE3_TUNE_PRESET_TOGGLE,
505             ZONE3_TUNING_MODE_SELECT, ZONE3_PRESET_MODE_SELECT, ZONE3_PRESET_SCAN, ZONE3_FM_MONO_TOGGLE, ZONE4_TUNE_UP,
506             ZONE4_TUNE_DOWN, ZONE4_PRESET_UP, ZONE4_PRESET_DOWN, ZONE4_FREQUENCY_UP, ZONE4_FREQUENCY_DOWN,
507             ZONE4_BAND_TOGGLE, ZONE4_AM, ZONE4_FM, ZONE4_TUNE_PRESET_TOGGLE, ZONE4_TUNING_MODE_SELECT,
508             ZONE4_PRESET_MODE_SELECT, ZONE4_PRESET_SCAN, ZONE4_FM_MONO_TOGGLE);
509
510     public static final List<RotelCommand> MENU_CTRL_CMDS = List.of(MENU, EXIT, UP, DOWN, LEFT, RIGHT, ENTER);
511     public static final List<RotelCommand> MENU2_CTRL_CMDS = List.of(MENU, UP, DOWN, LEFT, RIGHT, ENTER);
512     public static final List<RotelCommand> MENU3_CTRL_CMDS = List.of(MENU, EXIT, UP_PRESSED, UP_RELEASED, DOWN_PRESSED,
513             DOWN_RELEASED, LEFT_PRESSED, LEFT_RELEASED, RIGHT_PRESSED, RIGHT_RELEASED, ENTER);
514
515     public static final List<RotelCommand> NUMERIC_KEY_CMDS = List.of(KEY1, KEY2, KEY3, KEY4, KEY5, KEY6, KEY7, KEY8,
516             KEY9, KEY0);
517     public static final List<RotelCommand> ZONE2_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
518             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0);
519     public static final List<RotelCommand> ZONE234_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
520             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0, ZONE3_KEY1, ZONE3_KEY2,
521             ZONE3_KEY3, ZONE3_KEY4, ZONE3_KEY5, ZONE3_KEY6, ZONE3_KEY7, ZONE3_KEY8, ZONE3_KEY9, ZONE3_KEY0, ZONE4_KEY1,
522             ZONE4_KEY2, ZONE4_KEY3, ZONE4_KEY4, ZONE4_KEY5, ZONE4_KEY6, ZONE4_KEY7, ZONE4_KEY8, ZONE4_KEY9, ZONE4_KEY0);
523
524     public static final List<RotelCommand> PCUSB_CLASS_CMDS = List.of(PCUSB_CLASS_1, PCUSB_CLASS_2);
525
526     public static final List<RotelCommand> OTHER_CMDS_SET1 = List.of(RECORD_FONCTION_SELECT, TONE_CONTROL_SELECT,
527             DYNAMIC_RANGE, DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
528     public static final List<RotelCommand> OTHER_CMDS_SET2 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
529             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
530             HDMI_TV_MODE);
531     public static final List<RotelCommand> OTHER_CMDS_SET3 = List.of(RECORD_FONCTION_SELECT, DYNAMIC_RANGE,
532             DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
533     public static final List<RotelCommand> OTHER_CMDS_SET4 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
534             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
535             HDMI_TV_MODE, ROOM_EQ_TOGGLE, SPEAKER_SETTING_TOGGLE, RESET_FACTORY);
536
537     public static final byte PRIMARY_COMMAND = (byte) 0x10;
538
539     private String label;
540     private byte hexType;
541     private byte hexKey;
542     private @Nullable String asciiCommandV1;
543     private @Nullable String asciiCommandV2;
544
545     /**
546      * Constructor when the textual commands are undefined
547      *
548      * @param label the command label
549      * @param hexType the the command type (HEX protocol)
550      * @param hexKey the the command key (HEX protocol)
551      */
552     private RotelCommand(String label, byte hexType, byte hexKey) {
553         this(label, hexType, hexKey, null, null);
554     }
555
556     /**
557      * Constructor when the HEX command is undefined
558      *
559      * @param label the command label
560      * @param asciiCommandV1 the textual command (ASCII protocol V1)
561      * @param asciiCommandV2 the textual command (ASCII protocol V2)
562      */
563     private RotelCommand(String label, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
564         this(label, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
565     }
566
567     /**
568      * Constructor
569      *
570      * @param label the command label
571      * @param hexType the the command type (HEX protocol)
572      * @param hexKey the the command key (HEX protocol)
573      * @param asciiCommandV1 the textual command (ASCII protocol V1)
574      * @param asciiCommandV2 the textual command (ASCII protocol V2)
575      */
576     private RotelCommand(String label, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
577             @Nullable String asciiCommandV2) {
578         this.label = label;
579         this.hexType = hexType;
580         this.hexKey = hexKey;
581         this.asciiCommandV1 = asciiCommandV1;
582         this.asciiCommandV2 = asciiCommandV2;
583     }
584
585     /**
586      * Get the command label
587      *
588      * @return the command label
589      */
590     public String getLabel() {
591         return label;
592     }
593
594     /**
595      * Get the command type (HEX protocol)
596      *
597      * @return the command type
598      */
599     public byte getHexType() {
600         return hexType;
601     }
602
603     /**
604      * Get the command key (HEX protocol)
605      *
606      * @return the command key
607      */
608     public byte getHexKey() {
609         return hexKey;
610     }
611
612     /**
613      * Get the textual command (ASCII protocol V1)
614      *
615      * @return the textual command
616      */
617     public @Nullable String getAsciiCommandV1() {
618         return asciiCommandV1;
619     }
620
621     /**
622      * Get the textual command (ASCII protocol V2)
623      *
624      * @return the textual command
625      */
626     public @Nullable String getAsciiCommandV2() {
627         return asciiCommandV2;
628     }
629
630     /**
631      * Indicate if the command is relative to a particular zone
632      *
633      * @param numZone the zone number
634      *
635      * @return true if the command is relative to the zone
636      */
637     public boolean isCommandForZone(int numZone) {
638         String prefix = String.format("ZONE%d", numZone);
639         return name().startsWith(prefix);
640     }
641
642     @Override
643     public @NonNull String toString() {
644         return label;
645     }
646
647     /**
648      * Get the command associated to a textual command
649      *
650      * @param text the textual command used to identify the command
651      *
652      * @return the command associated to the searched textual command
653      *
654      * @throws RotelException - If no command is associated to the searched textual command
655      */
656     public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
657         for (RotelCommand value : RotelCommand.values()) {
658             if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
659                 return value;
660             }
661         }
662         throw new RotelException("Invalid textual command: " + text);
663     }
664
665     /**
666      * Get the command from its name
667      *
668      * @param name the command name used to identify the command
669      *
670      * @return the command associated to the searched name
671      *
672      * @throws RotelException - If no command is associated to the searched name
673      */
674     public static RotelCommand getFromName(String name) throws RotelException {
675         for (RotelCommand value : RotelCommand.values()) {
676             if (value.name().equals(name)) {
677                 return value;
678             }
679         }
680         throw new RotelException("Invalid command: " + name);
681     }
682
683     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2) {
684         return Stream.of(list1, list2).flatMap(Collection::stream).collect(Collectors.toList());
685     }
686
687     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
688             List<RotelCommand> list3) {
689         return Stream.of(list1, list2, list3).flatMap(Collection::stream).collect(Collectors.toList());
690     }
691
692     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
693             List<RotelCommand> list3, List<RotelCommand> list4) {
694         return Stream.of(list1, list2, list3, list4).flatMap(Collection::stream).collect(Collectors.toList());
695     }
696
697     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
698             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5) {
699         return Stream.of(list1, list2, list3, list4, list5).flatMap(Collection::stream).collect(Collectors.toList());
700     }
701
702     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
703             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6) {
704         return Stream.of(list1, list2, list3, list4, list5, list6).flatMap(Collection::stream)
705                 .collect(Collectors.toList());
706     }
707
708     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
709             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
710             List<RotelCommand> list7) {
711         return Stream.of(list1, list2, list3, list4, list5, list6, list7).flatMap(Collection::stream)
712                 .collect(Collectors.toList());
713     }
714
715     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
716             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
717             List<RotelCommand> list7, List<RotelCommand> list8) {
718         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8).flatMap(Collection::stream)
719                 .collect(Collectors.toList());
720     }
721
722     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
723             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
724             List<RotelCommand> list7, List<RotelCommand> list8, List<RotelCommand> list9) {
725         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8, list9).flatMap(Collection::stream)
726                 .collect(Collectors.toList());
727     }
728 }