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.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 = Set.of(BRIDGE_THING_TYPE);
39 public static final Set<ThingTypeUID> ZONE_THING_TYPES_UIDS = Set.of(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";
51 public static final String CHANNEL_HDMI1OUT = "hdmi1Out";
52 public static final String CHANNEL_HDMI2OUT = "hdmi2Out";
54 public static final String CHANNEL_PARTY_MODE = "party_mode";
55 public static final String CHANNEL_PARTY_MODE_MUTE = "party_mode_mute";
56 public static final String CHANNEL_PARTY_MODE_VOLUME = "party_mode_volume";
58 // List of channel IDs for navigation control: Read/Write
59 public static final String CHANNEL_NAVIGATION_MENU = "navigation_menu"; // Navigate either in the current menu
60 // or to the full menu path if "/" is used.
61 // List of channel IDs for navigation control: Write only
62 public static final String CHANNEL_NAVIGATION_UPDOWN = "navigation_updown"; // UpDown; Change current line
63 public static final String CHANNEL_NAVIGATION_LEFTRIGHT = "navigation_leftright"; // UpDown Type
64 public static final String CHANNEL_NAVIGATION_SELECT = "navigation_select"; // Switch Type
65 public static final String CHANNEL_NAVIGATION_BACK = "navigation_back"; // Switch Type
66 public static final String CHANNEL_NAVIGATION_BACKTOROOT = "navigation_backtoroot"; // Switch Type
68 // List of channel IDs for navigation control: Read only
69 public static final String CHANNEL_NAVIGATION_LEVEL = "navigation_level"; // DecType
70 public static final String CHANNEL_NAVIGATION_CURRENT_ITEM = "navigation_current_item"; // DecType
71 public static final String CHANNEL_NAVIGATION_TOTAL_ITEMS = "navigation_total_items"; // DecType
73 public static final Set<String> CHANNELS_NAVIGATION = Collections.unmodifiableSet(Stream
74 .of(CHANNEL_NAVIGATION_MENU, CHANNEL_NAVIGATION_CURRENT_ITEM, CHANNEL_NAVIGATION_UPDOWN,
75 CHANNEL_NAVIGATION_LEFTRIGHT, CHANNEL_NAVIGATION_SELECT, CHANNEL_NAVIGATION_BACK,
76 CHANNEL_NAVIGATION_BACKTOROOT, CHANNEL_NAVIGATION_LEVEL, CHANNEL_NAVIGATION_TOTAL_ITEMS)
77 .collect(Collectors.toSet()));
79 // List of channel IDs for Tuner DAB control
80 public static final String CHANNEL_TUNER_BAND = "tuner_band"; // band name for DAB tuner; RW
82 // List of channel IDs for playback control
83 public static final String CHANNEL_PLAYBACK_PRESET = "preset"; // Preset number; RW
84 public static final String CHANNEL_PLAYBACK_PRESET_TYPE_NAMED = "namedpreset"; // Preset number; RW
85 public static final String CHANNEL_PLAYBACK = "playback"; // Play,Pause,Stop,FastFW,Rewind,Next,Previous.
86 // Will show the current state as String.
87 // List of channel IDs for playback control: Read only
88 public static final String CHANNEL_PLAYBACK_STATION = "playback_station";
89 public static final String CHANNEL_PLAYBACK_ARTIST = "playback_artist";
90 public static final String CHANNEL_PLAYBACK_ALBUM = "playback_album";
91 public static final String CHANNEL_PLAYBACK_SONG = "playback_song";
92 public static final String CHANNEL_PLAYBACK_SONG_IMAGE_URL = "playback_song_image_url";
94 public static final Set<String> CHANNELS_PLAYBACK = Collections.unmodifiableSet(
95 Stream.of(CHANNEL_PLAYBACK, CHANNEL_PLAYBACK_STATION, CHANNEL_PLAYBACK_ARTIST, CHANNEL_PLAYBACK_ALBUM,
96 CHANNEL_PLAYBACK_SONG, CHANNEL_PLAYBACK_SONG_IMAGE_URL).collect(Collectors.toSet()));
98 public static final String UPNP_TYPE = "MediaRenderer";
99 public static final String UPNP_MANUFACTURER = "YAMAHA";
101 public static class Configs {
102 public static final String CONFIG_HOST_NAME = "host";
103 public static final String CONFIG_ZONE = "zone";
106 public static final String PROPERTY_VERSION = "version";
107 public static final String PROPERTY_ASSIGNED_NAME = "assigned_name";
108 public static final String PROPERTY_MENU_ERROR = "menu_error";
109 public static final String PROPERTY_LAST_PARSE_ERROR = "last_parse_error";
111 public static final String CHANNEL_GROUP_PLAYBACK = "playback_channels";
112 public static final String CHANNEL_GROUP_NAVIGATION = "navigation_channels";
113 public static final String CHANNEL_GROUP_ZONE = "zone_channels";
116 * The names of this enum are part of the protocols!
117 * Receivers have different capabilities, some have 2 zones, some up to 4.
118 * Every receiver has a "Main_Zone".
128 * Flags indicating if a feature is supported
130 public enum Feature {
139 * Model RX-V3900 has this and it represents NET_RADIO and USB
143 * Model HTR-xxxx has a Zone_2 concept but realized as an extension to Main_Zone
148 /** Retry time in ms if no response for menu navigation */
149 public static final int MENU_RETRY_DELAY = 500;
151 /** Max menu waiting in ms */
152 public static final int MENU_MAX_WAITING_TIME = 5000;
154 // List of known inputs
155 public static class Inputs {
156 public static final String INPUT_TUNER = "TUNER";
157 public static final String INPUT_SPOTIFY = "Spotify";
158 public static final String INPUT_BLUETOOTH = "Bluetooth";
159 public static final String INPUT_NET_RADIO = "NET RADIO";
160 // Note (TM): We should only 'NET RADIO' (as the canonical input name), the NET_RADIO seems to be only used in
161 // the XML nodes when commands are sent.
162 public static final String INPUT_NET_RADIO_LEGACY = "NET_RADIO";
163 public static final String INPUT_MUSIC_CAST_LINK = "MusicCast Link";
164 public static final String INPUT_SERVER = "SERVER";
165 public static final String INPUT_USB = "USB";
166 public static final String INPUT_IPOD_USB = "iPOD_USB";
167 public static final String INPUT_DOCK = "DOCK";
168 public static final String INPUT_PC = "PC";
169 public static final String INPUT_NAPSTER = "Napster";
170 public static final String INPUT_PANDORA = "Pandora";
171 public static final String INPUT_SIRIUS = "SIRIUS";
172 public static final String INPUT_RHAPSODY = "Rhapsody";
173 public static final String INPUT_IPOD = "iPod";
174 public static final String INPUT_HD_RADIO = "HD_RADIO";
177 /** Placeholder value that is used when the string channel value is not available */
178 public static final String VALUE_NA = "N/A";
179 /** Empty value that is used when the string channel value is not available */
180 public static final String VALUE_EMPTY = "";
182 public static class Models {
183 public static final String RX_A2000 = "RX-A2000";