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.omnilink.internal;
15 import java.util.Arrays;
16 import java.util.Optional;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
21 * The {@link AudioPlayer} defines some methods that are used to
22 * interface with an OmniLink Audio Player.
24 * @author Brian O'Connell - Initial contribution
27 public enum AudioPlayer {
28 NUVO(1, 6, 8, 7, 9, 10),
29 NUVO_GRAND_ESSENTIA_SIMPLESE(2, 6, 8, 7, 9, 10),
30 NUVO_GRAND_GRAND_CONCERTO(3, 6, 6, 6, 9, 10),
31 RUSSOUND(4, 6, 8, 7, 11, 12),
32 XANTECH(6, 13, 15, 14, 16, 17),
33 SPEAKERCRAFT(7, 45, 44, 46, 42, 43),
34 PROFICIENT(8, 45, 44, 46, 42, 43);
36 private final int featureCode;
37 private final int playCommand;
38 private final int pauseCommand;
39 private final int stopCommand;
40 private final int previousCommand;
41 private final int nextCommand;
43 AudioPlayer(int featureCode, int playCommand, int pauseCommand, int stopCommand, int previousCommand,
45 this.featureCode = featureCode;
46 this.playCommand = playCommand;
47 this.pauseCommand = pauseCommand;
48 this.stopCommand = stopCommand;
49 this.previousCommand = previousCommand;
50 this.nextCommand = nextCommand;
53 public int getPlayCommand() {
57 public int getPauseCommand() {
61 public int getStopCommand() {
65 public int getPreviousCommand() {
66 return previousCommand;
69 public int getNextCommand() {
73 public static Optional<AudioPlayer> getAudioPlayerForFeatureCode(int featureCode) {
74 return Arrays.stream(values()).filter(v -> v.featureCode == featureCode).findAny();