]> git.basschouten.com Git - openhab-addons.git/blob
d3bb3dc679c521f2aa0838e2af5bd00ea32a3d26
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.rotel.internal.communication;
14
15 import static org.openhab.binding.rotel.internal.RotelBindingConstants.*;
16
17 import java.util.Collection;
18 import java.util.List;
19 import java.util.stream.Collectors;
20 import java.util.stream.Stream;
21
22 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import org.eclipse.jdt.annotation.Nullable;
24 import org.openhab.binding.rotel.internal.RotelException;
25
26 /**
27  * Represents the different kinds of commands
28  *
29  * @author Laurent Garnier - Initial contribution
30  */
31 @NonNullByDefault
32 public enum RotelCommand {
33
34     POWER_TOGGLE("Power Toggle", PRIMARY_CMD, (byte) 0x0A, "power_toggle", "power_toggle"),
35     POWER_OFF("Power Off", PRIMARY_CMD, (byte) 0x4A, "power_off", "power_off"),
36     POWER_ON("Power On", PRIMARY_CMD, (byte) 0x4B, "power_on", "power_on"),
37     POWER_OFF_ALL_ZONES("Power Off All Zones", PRIMARY_CMD, (byte) 0x71),
38     POWER("Request current power status", "get_current_power", "power?"),
39     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),
359     ZONE2_TUNE_UP("Zone 2 Tune Up", ZONE2_CMD, (byte) 0x28),
360     ZONE2_TUNE_DOWN("Zone 2 Tune Down", ZONE2_CMD, (byte) 0x29),
361     ZONE2_PRESET_UP("Zone 2 Preset Up", ZONE2_CMD, (byte) 0x6F),
362     ZONE2_PRESET_DOWN("Zone 2 Preset Down", ZONE2_CMD, (byte) 0x70),
363     ZONE2_FREQUENCY_UP("Zone 2 Frequency Up", ZONE2_CMD, (byte) 0x72),
364     ZONE2_FREQUENCY_DOWN("Zone 2 Frequency Down", ZONE2_CMD, (byte) 0x73),
365     ZONE2_BAND_TOGGLE("Zone 2 Band Toggle", ZONE2_CMD, (byte) 0x24),
366     ZONE2_AM("Zone 2 AM", ZONE2_CMD, (byte) 0x56),
367     ZONE2_FM("Zone 2 FM", ZONE2_CMD, (byte) 0x55),
368     ZONE2_TUNE_PRESET_TOGGLE("Zone 2 Tune / Preset", ZONE2_CMD, (byte) 0x20),
369     ZONE2_TUNING_MODE_SELECT("Zone 2 Tuning Mode Select", ZONE2_CMD, (byte) 0x69),
370     ZONE2_PRESET_MODE_SELECT("Zone 2 Preset Mode Select", ZONE2_CMD, (byte) 0x6A),
371     ZONE2_PRESET_SCAN("Zone 2 Preset Scan", ZONE2_CMD, (byte) 0x21),
372     ZONE2_FM_MONO_TOGGLE("Zone 2 FM Mono", ZONE2_CMD, (byte) 0x26),
373     ZONE3_TUNE_UP("Zone 3 Tune Up", ZONE3_CMD, (byte) 0x28),
374     ZONE3_TUNE_DOWN("Zone 3 Tune Down", ZONE3_CMD, (byte) 0x29),
375     ZONE3_PRESET_UP("Zone 3 Preset Up", ZONE3_CMD, (byte) 0x6F),
376     ZONE3_PRESET_DOWN("Zone 3 Preset Down", ZONE3_CMD, (byte) 0x70),
377     ZONE3_FREQUENCY_UP("Zone 3 Frequency Up", ZONE3_CMD, (byte) 0x72),
378     ZONE3_FREQUENCY_DOWN("Zone 3 Frequency Down", ZONE3_CMD, (byte) 0x73),
379     ZONE3_BAND_TOGGLE("Zone 3 Band Toggle", ZONE3_CMD, (byte) 0x24),
380     ZONE3_AM("Zone 3 AM", ZONE3_CMD, (byte) 0x56),
381     ZONE3_FM("Zone 3 FM", ZONE3_CMD, (byte) 0x55),
382     ZONE3_TUNE_PRESET_TOGGLE("Zone 3 Tune / Preset", ZONE3_CMD, (byte) 0x20),
383     ZONE3_TUNING_MODE_SELECT("Zone 3 Tuning Mode Select", ZONE3_CMD, (byte) 0x69),
384     ZONE3_PRESET_MODE_SELECT("Zone 3 Preset Mode Select", ZONE3_CMD, (byte) 0x6A),
385     ZONE3_PRESET_SCAN("Zone 3 Preset Scan", ZONE3_CMD, (byte) 0x21),
386     ZONE3_FM_MONO_TOGGLE("Zone 3 FM Mono", ZONE3_CMD, (byte) 0x26),
387     ZONE4_TUNE_UP("Zone 4 Tune Up", ZONE4_CMD, (byte) 0x28),
388     ZONE4_TUNE_DOWN("Zone 4 Tune Down", ZONE4_CMD, (byte) 0x29),
389     ZONE4_PRESET_UP("Zone 4 Preset Up", ZONE4_CMD, (byte) 0x6F),
390     ZONE4_PRESET_DOWN("Zone 4 Preset Down", ZONE4_CMD, (byte) 0x70),
391     ZONE4_FREQUENCY_UP("Zone 4 Frequency Up", ZONE4_CMD, (byte) 0x72),
392     ZONE4_FREQUENCY_DOWN("Zone 4 Frequency Down", ZONE4_CMD, (byte) 0x73),
393     ZONE4_BAND_TOGGLE("Zone 4 Band Toggle", ZONE4_CMD, (byte) 0x24),
394     ZONE4_AM("Zone 4 AM", ZONE4_CMD, (byte) 0x56),
395     ZONE4_FM("Zone 4 FM", ZONE4_CMD, (byte) 0x55),
396     ZONE4_TUNE_PRESET_TOGGLE("Zone 4 Tune / Preset", ZONE4_CMD, (byte) 0x20),
397     ZONE4_TUNING_MODE_SELECT("Zone 4 Tuning Mode Select", ZONE4_CMD, (byte) 0x69),
398     ZONE4_PRESET_MODE_SELECT("Zone 4 Preset Mode Select", ZONE4_CMD, (byte) 0x6A),
399     ZONE4_PRESET_SCAN("Zone 4 Preset Scan", ZONE4_CMD, (byte) 0x21),
400     ZONE4_FM_MONO_TOGGLE("Zone 4 FM Mono", ZONE4_CMD, (byte) 0x26),
401     MENU("Display the Menu", PRIMARY_CMD, (byte) 0x18, "menu", null),
402     EXIT("Exit Key", PRIMARY_CMD, (byte) 0x90, "exit", null),
403     UP("Cursor Up", PRIMARY_CMD, (byte) 0x1C, "up", null),
404     UP_PRESSED("Cursor Up â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1C),
405     UP_RELEASED("Cursor Up â€“ Key Released", (byte) 0x11, (byte) 0x1C),
406     DOWN("Cursor Down", PRIMARY_CMD, (byte) 0x1D, "down", null),
407     DOWN_PRESSED("Cursor Down â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1D),
408     DOWN_RELEASED("Cursor Down â€“ Key Released", (byte) 0x11, (byte) 0x1D),
409     LEFT("Cursor Left", PRIMARY_CMD, (byte) 0x1B, "left", null),
410     LEFT_PRESSED("Cursor Left â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1B),
411     LEFT_RELEASED("Cursor Left â€“ Key Released", (byte) 0x11, (byte) 0x1B),
412     RIGHT("Cursor Right", PRIMARY_CMD, (byte) 0x1A, "right", null),
413     ENTER("Enter Key", PRIMARY_CMD, (byte) 0x19, "enter", null),
414     RIGHT_PRESSED("Cursor Right â€“ Key Pressed", PRIMARY_CMD, (byte) 0x1A),
415     RIGHT_RELEASED("Cursor Right â€“ Key Released", (byte) 0x11, (byte) 0x1A),
416     KEY1("Number Key 1", PRIMARY_CMD, (byte) 0x2A, "1", "1"),
417     KEY2("Number Key 2", PRIMARY_CMD, (byte) 0x2B, "2", "2"),
418     KEY3("Number Key 3", PRIMARY_CMD, (byte) 0x2C, "3", "3"),
419     KEY4("Number Key 4", PRIMARY_CMD, (byte) 0x2D, "4", "4"),
420     KEY5("Number Key 5", PRIMARY_CMD, (byte) 0x2E, "5", "5"),
421     KEY6("Number Key 6", PRIMARY_CMD, (byte) 0x2F, "6", "6"),
422     KEY7("Number Key 7", PRIMARY_CMD, (byte) 0x30, "7", "7"),
423     KEY8("Number Key 8", PRIMARY_CMD, (byte) 0x31, "8", "8"),
424     KEY9("Number Key 9", PRIMARY_CMD, (byte) 0x32, "9", "9"),
425     KEY0("Number Key 0", PRIMARY_CMD, (byte) 0x33, "0", "0"),
426     ZONE2_KEY1("Zone 2 Number Key 1", ZONE2_CMD, (byte) 0x2A),
427     ZONE2_KEY2("Zone 2 Number Key 2", ZONE2_CMD, (byte) 0x2B),
428     ZONE2_KEY3("Zone 2 Number Key 3", ZONE2_CMD, (byte) 0x2C),
429     ZONE2_KEY4("Zone 2 Number Key 4", ZONE2_CMD, (byte) 0x2D),
430     ZONE2_KEY5("Zone 2 Number Key 5", ZONE2_CMD, (byte) 0x2E),
431     ZONE2_KEY6("Zone 2 Number Key 6", ZONE2_CMD, (byte) 0x2F),
432     ZONE2_KEY7("Zone 2 Number Key 7", ZONE2_CMD, (byte) 0x30),
433     ZONE2_KEY8("Zone 2 Number Key 8", ZONE2_CMD, (byte) 0x31),
434     ZONE2_KEY9("Zone 2 Number Key 9", ZONE2_CMD, (byte) 0x32),
435     ZONE2_KEY0("Zone 2 Number Key 0", ZONE2_CMD, (byte) 0x33),
436     ZONE3_KEY1("Zone 3 Number Key 1", ZONE3_CMD, (byte) 0x2A),
437     ZONE3_KEY2("Zone 3 Number Key 2", ZONE3_CMD, (byte) 0x2B),
438     ZONE3_KEY3("Zone 3 Number Key 3", ZONE3_CMD, (byte) 0x2C),
439     ZONE3_KEY4("Zone 3 Number Key 4", ZONE3_CMD, (byte) 0x2D),
440     ZONE3_KEY5("Zone 3 Number Key 5", ZONE3_CMD, (byte) 0x2E),
441     ZONE3_KEY6("Zone 3 Number Key 6", ZONE3_CMD, (byte) 0x2F),
442     ZONE3_KEY7("Zone 3 Number Key 7", ZONE3_CMD, (byte) 0x30),
443     ZONE3_KEY8("Zone 3 Number Key 8", ZONE3_CMD, (byte) 0x31),
444     ZONE3_KEY9("Zone 3 Number Key 9", ZONE3_CMD, (byte) 0x32),
445     ZONE3_KEY0("Zone 3 Number Key 0", ZONE3_CMD, (byte) 0x33),
446     ZONE4_KEY1("Zone 4 Number Key 1", ZONE4_CMD, (byte) 0x2A),
447     ZONE4_KEY2("Zone 4 Number Key 2", ZONE4_CMD, (byte) 0x2B),
448     ZONE4_KEY3("Zone 4 Number Key 3", ZONE4_CMD, (byte) 0x2C),
449     ZONE4_KEY4("Zone 4 Number Key 4", ZONE4_CMD, (byte) 0x2D),
450     ZONE4_KEY5("Zone 4 Number Key 5", ZONE4_CMD, (byte) 0x2E),
451     ZONE4_KEY6("Zone 4 Number Key 6", ZONE4_CMD, (byte) 0x2F),
452     ZONE4_KEY7("Zone 4 Number Key 7", ZONE4_CMD, (byte) 0x30),
453     ZONE4_KEY8("Zone 4 Number Key 8", ZONE4_CMD, (byte) 0x31),
454     ZONE4_KEY9("Zone 4 Number Key 9", ZONE4_CMD, (byte) 0x32),
455     ZONE4_KEY0("Zone 4 Number Key 0", ZONE4_CMD, (byte) 0x33),
456     PROGRAM("Program Key", "program", null),
457     PCUSB_CLASS_1("Set PC-USB Audio Class to 1.0", "pcusb_class_1", "pcusb_class_1"),
458     PCUSB_CLASS_2("Set PC-USB Audio Class to 2.0", "pcusb_class_2", "pcusb_class_2"),
459     PCUSB_CLASS("Request current PC-USB class", "get_pcusb_class", "pcusb?"),
460     RESET_FACTORY("Reset unit to factory defaults", PRIMARY_CMD, (byte) 0x93, "factory_default_on",
461             "factory_default_on"),
462     DYNAMIC_RANGE("Dynamic Range", PRIMARY_CMD, (byte) 0x16),
463     DIGITAL_INPUT_SELECT("Digital Input Select", PRIMARY_CMD, (byte) 0x1F),
464     ZONE_TOGGLE("Zone Toggle", PRIMARY_CMD, (byte) 0x23),
465     CENTER_TRIM("Temporary Center Trim", PRIMARY_CMD, (byte) 0x4C),
466     SUB_TRIM("Temporary Subwoofer  Trim", PRIMARY_CMD, (byte) 0x4D),
467     SURROUND_TRIM("Temporary Surround  Trim", PRIMARY_CMD, (byte) 0x4E),
468     SUB_LEVEL_UP("Temporary increase sub level", "subwoofer_up", null),
469     SUB_LEVEL_DOWN("Temporary decrease sub level", "subwoofer_down", null),
470     C_LEVEL_UP("Temporary increase center level", "center_up", null),
471     C_LEVEL_DOWN("Temporary decrease center level", "center_down", null),
472     SR_LEVEL_UP("Temporary increase surround right level", "surround_right_up", null),
473     SR_LEVEL_DOWN("Temporary decrease surround right level", "surround_right_down", null),
474     SL_LEVEL_UP("Temporary increase surround left level", "surround_left_up", null),
475     SL_LEVEL_DOWN("Temporary decrease surround left level", "surround_left_down", null),
476     CBR_LEVEL_UP("Temporary increase center back right level", "center_back_right_up", null),
477     CBR_LEVEL_DOWN("Temporary decrease center back right level", "center_back_right_down", null),
478     CBL_LEVEL_UP("Temporary increase center back left level", "center_back_left_up", null),
479     CBL_LEVEL_DOWN("Temporary decrease center back left level", "center_back_left_down", null),
480     CFR_LEVEL_UP("Temporary increase ceiling front right level", "ceiling_front_right_up", null),
481     CFR_LEVEL_DOWN("Temporary decrease ceiling front right level", "ceiling_front_right_down", null),
482     CFL_LEVEL_UP("Temporary increase ceiling front left level", "ceiling_front_left_up", null),
483     CFL_LEVEL_DOWN("Temporary decrease ceiling front left level", "ceiling_front_left_down", null),
484     CRR_LEVEL_UP("Temporary increase ceiling rear right level", "ceiling_rear_right_up", null),
485     CRR_LEVEL_DOWN("Temporary decrease ceiling rear right level", "ceiling_rear_right_down", null),
486     CRL_LEVEL_UP("Temporary increase ceiling rear left level", "ceiling_rear_left_up", null),
487     CRL_LEVEL_DOWN("Temporary decrease ceiling rear left level", "ceiling_rear_left_down", null),
488     CINEMA_EQ_TOGGLE("Cinema EQ Toggle", PRIMARY_CMD, (byte) 0x4F),
489     DISPLAY_TOGGLE("Front Display On/Off", PRIMARY_CMD, (byte) 0x52),
490     PARTY_MODE_TOGGLE("Party Mode Toggle", PRIMARY_CMD, (byte) 0x6E),
491     ZONE2_PARTY_MODE_TOGGLE("Zone 2 Party Mode Toggle", ZONE2_CMD, (byte) 0x6E),
492     ZONE3_PARTY_MODE_TOGGLE("Zone 3 Party Mode Toggle", ZONE3_CMD, (byte) 0x6E),
493     ZONE4_PARTY_MODE_TOGGLE("Zone 4 Party Mode Toggle", ZONE4_CMD, (byte) 0x6E),
494     OUTPUT_RESOLUTION("Output Resolution", PRIMARY_CMD, (byte) 0x75),
495     HDMI_AMP_MODE("HDMI Amp Mode", PRIMARY_CMD, (byte) 0x78),
496     HDMI_TV_MODE("HDMI TV Mode", PRIMARY_CMD, (byte) 0x79),
497     ROOM_EQ_TOGGLE("Temporary Room EQ Toggle", PRIMARY_CMD, (byte) 0x67),
498     SPEAKER_SETTING_TOGGLE("Speaker Level Setting Toggle", PRIMARY_CMD, (byte) 0xA1),
499     MODEL("Request the model number", "get_product_type", "model?"),
500     VERSION("Request the main CPU software version", "get_product_version", "version?");
501
502     public static final List<RotelCommand> DSP_CMDS_SET1 = List.of(DSP_TOGGLE, PROLOGIC_TOGGLE, DOLBY_TOGGLE,
503             PLII_PANORAMA_TOGGLE, PLII_DIMENSION_UP, PLII_DIMENSION_DOWN, PLII_CENTER_WIDTH_UP, PLII_CENTER_WIDTH_DOWN,
504             DDEX_TOGGLE, NEO6_TOGGLE, NEXT_MODE);
505     public static final List<RotelCommand> DSP_CMDS_SET2 = List.of(STEREO_BYPASS_TOGGLE);
506
507     public static final List<RotelCommand> SRC_CTRL_CMDS_SET1 = List.of(PLAY, STOP, PAUSE, TRACK_FWD, TRACK_BACK);
508     public static final List<RotelCommand> SRC_CTRL_CMDS_SET2 = List.of(FAST_FWD, FAST_BACK);
509     public static final List<RotelCommand> SRC_CTRL_CMDS_SET3 = List.of(RANDOM_TOGGLE, REPEAT_TOGGLE);
510     public static final List<RotelCommand> SRC_CTRL_CMDS_SET4 = List.of(EJECT, TIME_TOGGLE);
511
512     public static final List<RotelCommand> TUNER_CMDS_SET1 = List.of(TUNE_UP, TUNE_DOWN, MEMORY, BAND_TOGGLE, AM, FM,
513             TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT, PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY,
514             RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
515     public static final List<RotelCommand> TUNER_CMDS_SET2 = List.of(TUNE_UP, TUNE_DOWN, PRESET_UP, PRESET_DOWN,
516             FREQUENCY_UP, FREQUENCY_DOWN, MEMORY, BAND_TOGGLE, AM, FM, TUNE_PRESET_TOGGLE, TUNING_MODE_SELECT,
517             PRESET_MODE_SELECT, FREQUENCY_DIRECT, PRESET_SCAN, TUNER_DISPLAY, RDS_PTY, RDS_TP, RDS_TA, FM_MONO_TOGGLE);
518     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
519             ZONE2_BAND_TOGGLE, ZONE2_AM, ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT,
520             ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN, ZONE2_FM_MONO_TOGGLE);
521     public static final List<RotelCommand> ZONE2_TUNER_CMDS_SET2 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
522             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
523             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
524             ZONE2_FM_MONO_TOGGLE);
525     public static final List<RotelCommand> ZONE234_TUNER_CMDS_SET1 = List.of(ZONE2_TUNE_UP, ZONE2_TUNE_DOWN,
526             ZONE2_PRESET_UP, ZONE2_PRESET_DOWN, ZONE2_FREQUENCY_UP, ZONE2_FREQUENCY_DOWN, ZONE2_BAND_TOGGLE, ZONE2_AM,
527             ZONE2_FM, ZONE2_TUNE_PRESET_TOGGLE, ZONE2_TUNING_MODE_SELECT, ZONE2_PRESET_MODE_SELECT, ZONE2_PRESET_SCAN,
528             ZONE2_FM_MONO_TOGGLE, ZONE3_TUNE_UP, ZONE3_TUNE_DOWN, ZONE3_PRESET_UP, ZONE3_PRESET_DOWN,
529             ZONE3_FREQUENCY_UP, ZONE3_FREQUENCY_DOWN, ZONE3_BAND_TOGGLE, ZONE3_AM, ZONE3_FM, ZONE3_TUNE_PRESET_TOGGLE,
530             ZONE3_TUNING_MODE_SELECT, ZONE3_PRESET_MODE_SELECT, ZONE3_PRESET_SCAN, ZONE3_FM_MONO_TOGGLE, ZONE4_TUNE_UP,
531             ZONE4_TUNE_DOWN, ZONE4_PRESET_UP, ZONE4_PRESET_DOWN, ZONE4_FREQUENCY_UP, ZONE4_FREQUENCY_DOWN,
532             ZONE4_BAND_TOGGLE, ZONE4_AM, ZONE4_FM, ZONE4_TUNE_PRESET_TOGGLE, ZONE4_TUNING_MODE_SELECT,
533             ZONE4_PRESET_MODE_SELECT, ZONE4_PRESET_SCAN, ZONE4_FM_MONO_TOGGLE);
534
535     public static final List<RotelCommand> MENU_CTRL_CMDS = List.of(MENU, EXIT, UP, DOWN, LEFT, RIGHT, ENTER);
536     public static final List<RotelCommand> MENU2_CTRL_CMDS = List.of(MENU, UP, DOWN, LEFT, RIGHT, ENTER);
537     public static final List<RotelCommand> MENU3_CTRL_CMDS = List.of(MENU, EXIT, UP_PRESSED, UP_RELEASED, DOWN_PRESSED,
538             DOWN_RELEASED, LEFT_PRESSED, LEFT_RELEASED, RIGHT_PRESSED, RIGHT_RELEASED, ENTER);
539
540     public static final List<RotelCommand> NUMERIC_KEY_CMDS = List.of(KEY1, KEY2, KEY3, KEY4, KEY5, KEY6, KEY7, KEY8,
541             KEY9, KEY0);
542     public static final List<RotelCommand> ZONE2_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
543             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0);
544     public static final List<RotelCommand> ZONE234_NUMERIC_KEY_CMDS = List.of(ZONE2_KEY1, ZONE2_KEY2, ZONE2_KEY3,
545             ZONE2_KEY4, ZONE2_KEY5, ZONE2_KEY6, ZONE2_KEY7, ZONE2_KEY8, ZONE2_KEY9, ZONE2_KEY0, ZONE3_KEY1, ZONE3_KEY2,
546             ZONE3_KEY3, ZONE3_KEY4, ZONE3_KEY5, ZONE3_KEY6, ZONE3_KEY7, ZONE3_KEY8, ZONE3_KEY9, ZONE3_KEY0, ZONE4_KEY1,
547             ZONE4_KEY2, ZONE4_KEY3, ZONE4_KEY4, ZONE4_KEY5, ZONE4_KEY6, ZONE4_KEY7, ZONE4_KEY8, ZONE4_KEY9, ZONE4_KEY0);
548
549     public static final List<RotelCommand> PCUSB_CLASS_CMDS = List.of(PCUSB_CLASS, PCUSB_CLASS_1, PCUSB_CLASS_2);
550
551     public static final List<RotelCommand> LEVEL_TRIM_CMDS_SET1 = List.of(SUB_LEVEL_UP, SUB_LEVEL_DOWN, C_LEVEL_UP,
552             C_LEVEL_DOWN, SR_LEVEL_UP, SR_LEVEL_DOWN, SL_LEVEL_UP, SL_LEVEL_DOWN, CBR_LEVEL_UP, CBR_LEVEL_DOWN,
553             CBL_LEVEL_UP, CBL_LEVEL_DOWN);
554     public static final List<RotelCommand> LEVEL_TRIM_CMDS_SET2 = List.of(CFR_LEVEL_UP, CFR_LEVEL_DOWN, CFL_LEVEL_UP,
555             CFL_LEVEL_DOWN, CRR_LEVEL_UP, CRR_LEVEL_DOWN, CRL_LEVEL_UP, CRL_LEVEL_DOWN);
556
557     public static final List<RotelCommand> OTHER_CMDS_SET1 = List.of(RECORD_FONCTION_SELECT, TONE_CONTROL_SELECT,
558             DYNAMIC_RANGE, DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
559     public static final List<RotelCommand> OTHER_CMDS_SET2 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
560             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
561             HDMI_TV_MODE);
562     public static final List<RotelCommand> OTHER_CMDS_SET3 = List.of(RECORD_FONCTION_SELECT, DYNAMIC_RANGE,
563             DIGITAL_INPUT_SELECT, ZONE_TOGGLE, CENTER_TRIM, SUB_TRIM, SURROUND_TRIM, CINEMA_EQ_TOGGLE);
564     public static final List<RotelCommand> OTHER_CMDS_SET4 = List.of(POWER_OFF_ALL_ZONES, PARTY_MODE_TOGGLE,
565             ZONE2_PARTY_MODE_TOGGLE, ZONE3_PARTY_MODE_TOGGLE, ZONE4_PARTY_MODE_TOGGLE, OUTPUT_RESOLUTION, HDMI_AMP_MODE,
566             HDMI_TV_MODE, ROOM_EQ_TOGGLE, SPEAKER_SETTING_TOGGLE, RESET_FACTORY);
567     public static final List<RotelCommand> OTHER_CMDS_SET5 = List.of(POWER_MODE, POWER_MODE_QUICK, POWER_MODE_NORMAL,
568             RESET_FACTORY);
569     public static final List<RotelCommand> OTHER_CMDS_SET6 = List.of(POWER_MODE, RESET_FACTORY);
570     public static final List<RotelCommand> OTHER_CMDS_SET7 = List.of(NEXT_MODE, RESET_FACTORY);
571
572     public static final byte PRIMARY_COMMAND = (byte) 0x10;
573
574     private String label;
575     private byte hexType;
576     private byte hexKey;
577     private @Nullable String asciiCommandV1;
578     private @Nullable String asciiCommandV2;
579
580     /**
581      * Constructor when the textual commands are undefined
582      *
583      * @param label the command label
584      * @param hexType the the command type (HEX protocol)
585      * @param hexKey the the command key (HEX protocol)
586      */
587     private RotelCommand(String label, byte hexType, byte hexKey) {
588         this(label, hexType, hexKey, null, null);
589     }
590
591     /**
592      * Constructor when the HEX command is undefined
593      *
594      * @param label the command label
595      * @param asciiCommandV1 the textual command (ASCII protocol V1)
596      * @param asciiCommandV2 the textual command (ASCII protocol V2)
597      */
598     private RotelCommand(String label, @Nullable String asciiCommandV1, @Nullable String asciiCommandV2) {
599         this(label, (byte) 0, (byte) 0, asciiCommandV1, asciiCommandV2);
600     }
601
602     /**
603      * Constructor
604      *
605      * @param label the command label
606      * @param hexType the the command type (HEX protocol)
607      * @param hexKey the the command key (HEX protocol)
608      * @param asciiCommandV1 the textual command (ASCII protocol V1)
609      * @param asciiCommandV2 the textual command (ASCII protocol V2)
610      */
611     private RotelCommand(String label, byte hexType, byte hexKey, @Nullable String asciiCommandV1,
612             @Nullable String asciiCommandV2) {
613         this.label = label;
614         this.hexType = hexType;
615         this.hexKey = hexKey;
616         this.asciiCommandV1 = asciiCommandV1;
617         this.asciiCommandV2 = asciiCommandV2;
618     }
619
620     /**
621      * Get the command label
622      *
623      * @return the command label
624      */
625     public String getLabel() {
626         return label;
627     }
628
629     /**
630      * Get the command type (HEX protocol)
631      *
632      * @return the command type
633      */
634     public byte getHexType() {
635         return hexType;
636     }
637
638     /**
639      * Get the command key (HEX protocol)
640      *
641      * @return the command key
642      */
643     public byte getHexKey() {
644         return hexKey;
645     }
646
647     /**
648      * Get the textual command (ASCII protocol V1)
649      *
650      * @return the textual command
651      */
652     public @Nullable String getAsciiCommandV1() {
653         return asciiCommandV1;
654     }
655
656     /**
657      * Get the textual command (ASCII protocol V2)
658      *
659      * @return the textual command
660      */
661     public @Nullable String getAsciiCommandV2() {
662         return asciiCommandV2;
663     }
664
665     /**
666      * Indicate if the command is relative to a particular zone
667      *
668      * @param numZone the zone number
669      *
670      * @return true if the command is relative to the zone
671      */
672     public boolean isCommandForZone(int numZone) {
673         String prefix = String.format("ZONE%d", numZone);
674         return name().startsWith(prefix);
675     }
676
677     @Override
678     public String toString() {
679         return label;
680     }
681
682     /**
683      * Get the command associated to a textual command
684      *
685      * @param text the textual command used to identify the command
686      *
687      * @return the command associated to the searched textual command
688      *
689      * @throws RotelException - If no command is associated to the searched textual command
690      */
691     public static RotelCommand getFromAsciiCommand(String text) throws RotelException {
692         for (RotelCommand value : RotelCommand.values()) {
693             if (text.equals(value.getAsciiCommandV1()) || text.equals(value.getAsciiCommandV2())) {
694                 return value;
695             }
696         }
697         throw new RotelException("Invalid textual command: " + text);
698     }
699
700     /**
701      * Get the command from its name
702      *
703      * @param name the command name used to identify the command
704      *
705      * @return the command associated to the searched name
706      *
707      * @throws RotelException - If no command is associated to the searched name
708      */
709     public static RotelCommand getFromName(String name) throws RotelException {
710         for (RotelCommand value : RotelCommand.values()) {
711             if (value.name().equals(name)) {
712                 return value;
713             }
714         }
715         throw new RotelException("Invalid command: " + name);
716     }
717
718     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2) {
719         return Stream.of(list1, list2).flatMap(Collection::stream).collect(Collectors.toList());
720     }
721
722     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
723             List<RotelCommand> list3) {
724         return Stream.of(list1, list2, list3).flatMap(Collection::stream).collect(Collectors.toList());
725     }
726
727     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
728             List<RotelCommand> list3, List<RotelCommand> list4) {
729         return Stream.of(list1, list2, list3, list4).flatMap(Collection::stream).collect(Collectors.toList());
730     }
731
732     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
733             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5) {
734         return Stream.of(list1, list2, list3, list4, list5).flatMap(Collection::stream).collect(Collectors.toList());
735     }
736
737     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
738             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6) {
739         return Stream.of(list1, list2, list3, list4, list5, list6).flatMap(Collection::stream)
740                 .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             List<RotelCommand> list7) {
746         return Stream.of(list1, list2, list3, list4, list5, list6, list7).flatMap(Collection::stream)
747                 .collect(Collectors.toList());
748     }
749
750     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
751             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
752             List<RotelCommand> list7, List<RotelCommand> list8) {
753         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8).flatMap(Collection::stream)
754                 .collect(Collectors.toList());
755     }
756
757     public static List<RotelCommand> concatenate(List<RotelCommand> list1, List<RotelCommand> list2,
758             List<RotelCommand> list3, List<RotelCommand> list4, List<RotelCommand> list5, List<RotelCommand> list6,
759             List<RotelCommand> list7, List<RotelCommand> list8, List<RotelCommand> list9) {
760         return Stream.of(list1, list2, list3, list4, list5, list6, list7, list8, list9).flatMap(Collection::stream)
761                 .collect(Collectors.toList());
762     }
763 }