2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.pioneeravr.internal.protocol;
15 import org.openhab.binding.pioneeravr.internal.protocol.avr.AvrCommand;
18 * A simple command without parameters.
20 * @author Antoine Besnard - Initial contribution
21 * @author Leroy Foerster - Listening Mode, Playing Listening Mode
23 public class SimpleCommand implements AvrCommand {
26 * List of the simple command types.
28 public enum SimpleCommandType implements AvrCommand.CommandType {
30 POWER_ON("PO", "APO", "BPO", "ZEO"),
31 POWER_OFF("PF", "APF", "BPF", "ZEF"),
32 POWER_QUERY("?P", "?AP", "?BP", "?ZEP"),
33 VOLUME_UP("VU", "ZU", "YU", "HZU"),
34 VOLUME_DOWN("VD", "ZD", "YD", "HZD"),
35 VOLUME_QUERY("?V", "?ZV", "?YV", "?HZV"),
36 MUTE_ON("MO", "Z2MO", "Z3MO", "HZMO"),
37 MUTE_OFF("MF", "Z2MF", "Z3MF", "HZMF"),
38 MUTE_QUERY("?M", "?Z2M", "?Z3M", "?HZM"),
39 INPUT_CHANGE_CYCLIC("FU"),
40 INPUT_CHANGE_REVERSE("FD"),
41 LISTENING_MODE_CHANGE_CYCLIC("0010SR"),
42 LISTENING_MODE_QUERY("?S"),
43 INPUT_QUERY("?F", "?ZS", "?ZT", "?ZEA"),
44 MCACC_MEMORY_CHANGE_CYCLIC("0MC"),
45 MCACC_MEMORY_QUERY("?MC");
47 private String zoneCommands[];
49 private SimpleCommandType(String... command) {
50 this.zoneCommands = command;
54 public String getCommand() {
55 return zoneCommands[0];
59 public String getCommand(int zone) {
60 return zoneCommands[zone - 1];
64 private CommandType commandType;
67 public SimpleCommand(CommandType commandType, int zone) {
68 this.commandType = commandType;
72 public SimpleCommand(CommandType commandType) {
77 public String getCommand() {
79 return commandType.getCommand() + "\r";
81 return commandType.getCommand(zone) + "\r";
85 public CommandType getCommandType() {
90 public int getZone() {