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