2 * Copyright (c) 2010-2021 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.yamahareceiver.internal;
15 import java.util.Collections;
17 import java.util.stream.Collectors;
18 import java.util.stream.Stream;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.core.thing.ThingTypeUID;
24 * The {@link YamahaReceiverBindingConstants} class defines common constants, which are
25 * used across the whole binding.
27 * @author David Graeff - Initial contribution
28 * @author Tomasz Maruszak - DAB support, Spotify support, refactoring
31 public class YamahaReceiverBindingConstants {
32 public static final String BINDING_ID = "yamahareceiver";
34 // List of all Thing Type UIDs
35 public static final ThingTypeUID BRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, "yamahaAV");
36 public static final ThingTypeUID ZONE_THING_TYPE = new ThingTypeUID(BINDING_ID, "zone");
38 public static final Set<ThingTypeUID> BRIDGE_THING_TYPES_UIDS = Collections.singleton(BRIDGE_THING_TYPE);
39 public static final Set<ThingTypeUID> ZONE_THING_TYPES_UIDS = Collections.singleton(ZONE_THING_TYPE);
41 // List of channel IDs for zone control (except power which is also a non-zone/bridge channel)
42 public static final String CHANNEL_POWER = "power";
43 public static final String CHANNEL_INPUT = "input";
44 public static final String CHANNEL_INPUT_TYPE_AVAILABLE = "availableinput";
45 public static final String CHANNEL_SURROUND = "surroundProgram";
46 public static final String CHANNEL_VOLUME = "volume";
47 public static final String CHANNEL_VOLUME_DB = "volumeDB";
48 public static final String CHANNEL_MUTE = "mute";
49 public static final String CHANNEL_SCENE = "scene";
50 public static final String CHANNEL_DIALOGUE_LEVEL = "dialogueLevel";
52 public static final String CHANNEL_PARTY_MODE = "party_mode";
53 public static final String CHANNEL_PARTY_MODE_MUTE = "party_mode_mute";
54 public static final String CHANNEL_PARTY_MODE_VOLUME = "party_mode_volume";
56 // List of channel IDs for navigation control: Read/Write
57 public static final String CHANNEL_NAVIGATION_MENU = "navigation_menu"; // Navigate either in the current menu
58 // or to the full menu path if "/" is used.
59 // List of channel IDs for navigation control: Write only
60 public static final String CHANNEL_NAVIGATION_UPDOWN = "navigation_updown"; // UpDown; Change current line
61 public static final String CHANNEL_NAVIGATION_LEFTRIGHT = "navigation_leftright"; // UpDown Type
62 public static final String CHANNEL_NAVIGATION_SELECT = "navigation_select"; // Switch Type
63 public static final String CHANNEL_NAVIGATION_BACK = "navigation_back"; // Switch Type
64 public static final String CHANNEL_NAVIGATION_BACKTOROOT = "navigation_backtoroot"; // Switch Type
66 // List of channel IDs for navigation control: Read only
67 public static final String CHANNEL_NAVIGATION_LEVEL = "navigation_level"; // DecType
68 public static final String CHANNEL_NAVIGATION_CURRENT_ITEM = "navigation_current_item"; // DecType
69 public static final String CHANNEL_NAVIGATION_TOTAL_ITEMS = "navigation_total_items"; // DecType
71 public static final Set<String> CHANNELS_NAVIGATION = Collections.unmodifiableSet(Stream
72 .of(CHANNEL_NAVIGATION_MENU, CHANNEL_NAVIGATION_CURRENT_ITEM, CHANNEL_NAVIGATION_UPDOWN,
73 CHANNEL_NAVIGATION_LEFTRIGHT, CHANNEL_NAVIGATION_SELECT, CHANNEL_NAVIGATION_BACK,
74 CHANNEL_NAVIGATION_BACKTOROOT, CHANNEL_NAVIGATION_LEVEL, CHANNEL_NAVIGATION_TOTAL_ITEMS)
75 .collect(Collectors.toSet()));
77 // List of channel IDs for Tuner DAB control
78 public static final String CHANNEL_TUNER_BAND = "tuner_band"; // band name for DAB tuner; RW
80 // List of channel IDs for playback control
81 public static final String CHANNEL_PLAYBACK_PRESET = "preset"; // Preset number; RW
82 public static final String CHANNEL_PLAYBACK_PRESET_TYPE_NAMED = "namedpreset"; // Preset number; RW
83 public static final String CHANNEL_PLAYBACK = "playback"; // Play,Pause,Stop,FastFW,Rewind,Next,Previous.
84 // Will show the current state as String.
85 // List of channel IDs for playback control: Read only
86 public static final String CHANNEL_PLAYBACK_STATION = "playback_station";
87 public static final String CHANNEL_PLAYBACK_ARTIST = "playback_artist";
88 public static final String CHANNEL_PLAYBACK_ALBUM = "playback_album";
89 public static final String CHANNEL_PLAYBACK_SONG = "playback_song";
90 public static final String CHANNEL_PLAYBACK_SONG_IMAGE_URL = "playback_song_image_url";
92 public static final Set<String> CHANNELS_PLAYBACK = Collections.unmodifiableSet(
93 Stream.of(CHANNEL_PLAYBACK, CHANNEL_PLAYBACK_STATION, CHANNEL_PLAYBACK_ARTIST, CHANNEL_PLAYBACK_ALBUM,
94 CHANNEL_PLAYBACK_SONG, CHANNEL_PLAYBACK_SONG_IMAGE_URL).collect(Collectors.toSet()));
96 public static final String UPNP_TYPE = "MediaRenderer";
97 public static final String UPNP_MANUFACTURER = "YAMAHA";
99 public static class Configs {
100 public static final String CONFIG_HOST_NAME = "host";
101 public static final String CONFIG_ZONE = "zone";
104 public static final String PROPERTY_VERSION = "version";
105 public static final String PROPERTY_ASSIGNED_NAME = "assigned_name";
106 public static final String PROPERTY_MENU_ERROR = "menu_error";
107 public static final String PROPERTY_LAST_PARSE_ERROR = "last_parse_error";
109 public static final String CHANNEL_GROUP_PLAYBACK = "playback_channels";
110 public static final String CHANNEL_GROUP_NAVIGATION = "navigation_channels";
111 public static final String CHANNEL_GROUP_ZONE = "zone_channels";
114 * The names of this enum are part of the protocols!
115 * Receivers have different capabilities, some have 2 zones, some up to 4.
116 * Every receiver has a "Main_Zone".
126 * Flags indicating if a feature is supported
128 public enum Feature {
137 * Model RX-V3900 has this and it represents NET_RADIO and USB
141 * Model HTR-xxxx has a Zone_2 concept but realized as an extension to Main_Zone
146 /** Retry time in ms if no response for menu navigation */
147 public static final int MENU_RETRY_DELAY = 500;
149 /** Max menu waiting in ms */
150 public static final int MENU_MAX_WAITING_TIME = 5000;
152 // List of known inputs
153 public static class Inputs {
154 public static final String INPUT_TUNER = "TUNER";
155 public static final String INPUT_SPOTIFY = "Spotify";
156 public static final String INPUT_BLUETOOTH = "Bluetooth";
157 public static final String INPUT_NET_RADIO = "NET RADIO";
158 // Note (TM): We should only 'NET RADIO' (as the canonical input name), the NET_RADIO seems to be only used in
159 // the XML nodes when commands are sent.
160 public static final String INPUT_NET_RADIO_LEGACY = "NET_RADIO";
161 public static final String INPUT_MUSIC_CAST_LINK = "MusicCast Link";
162 public static final String INPUT_SERVER = "SERVER";
163 public static final String INPUT_USB = "USB";
164 public static final String INPUT_IPOD_USB = "iPOD_USB";
165 public static final String INPUT_DOCK = "DOCK";
166 public static final String INPUT_PC = "PC";
167 public static final String INPUT_NAPSTER = "Napster";
168 public static final String INPUT_PANDORA = "Pandora";
169 public static final String INPUT_SIRIUS = "SIRIUS";
170 public static final String INPUT_RHAPSODY = "Rhapsody";
171 public static final String INPUT_IPOD = "iPod";
172 public static final String INPUT_HD_RADIO = "HD_RADIO";
175 /** Placeholder value that is used when the string channel value is not available */
176 public static final String VALUE_NA = "N/A";
177 /** Empty value that is used when the string channel value is not available */
178 public static final String VALUE_EMPTY = "";
180 public static class Models {
181 public static final String RX_A2000 = "RX-A2000";