2 * Copyright (c) 2010-2022 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.yamahamusiccast.internal.dto;
15 import com.google.gson.annotations.SerializedName;
18 * This class represents the UDP event received from the Yamaha model/device.
20 * @author Lennert Coopman - Initial contribution
21 * @author Florian Hotze - Add volume in decibel
24 public class UdpMessage {
26 @SerializedName("device_id")
27 private String deviceId;
29 public String getDeviceId() {
30 if (deviceId == null) {
36 @SerializedName("main")
38 @SerializedName("zone2")
40 @SerializedName("zone3")
42 @SerializedName("zone4")
44 @SerializedName("netusb")
45 private NetUSB netusb;
46 @SerializedName("dist")
49 public Zone getMain() {
53 public Zone getZone2() {
57 public Zone getZone3() {
61 public Zone getZone4() {
65 public NetUSB getNetUSB() {
69 public Dist getDist() {
74 @SerializedName("power")
76 @SerializedName("volume")
77 private int volume = 0;
78 @SerializedName("actual_volume")
79 private ActualVolume actualVolume;
80 @SerializedName("mute")
82 @SerializedName("input")
84 @SerializedName("status_updated")
85 private String statusUpdated;
87 public String getPower() {
94 public String getMute() {
101 public String getInput() {
108 public int getVolume() {
113 * Get the volume in decibel (dB).
115 * @return volume in dB or -90 dB if not available
117 public float getVolumeDb() {
118 if (actualVolume == null)
120 return actualVolume.getValue();
123 public String getstatusUpdated() {
124 if (statusUpdated == null) {
127 return statusUpdated;
131 public class NetUSB {
132 @SerializedName("preset_control")
133 private PresetControl presetControl;
134 @SerializedName("play_info_updated")
135 private String playInfoUpdated;
136 @SerializedName("play_time")
137 private int playTime;
139 public PresetControl getPresetControl() {
140 return presetControl;
143 public String getPlayInfoUpdated() {
144 if (playInfoUpdated == null) {
145 playInfoUpdated = "";
147 return playInfoUpdated;
150 public int getPlayTime() {
155 public class PresetControl {
156 @SerializedName("type")
158 @SerializedName("num")
160 @SerializedName("result")
161 private String result;
163 public String getType() {
170 public String getResult() {
171 if (result == null) {
177 public int getNum() {
183 @SerializedName("dist_info_updated")
184 private String distInfoUpdated;
186 public String getDistInfoUpdated() {
187 if (distInfoUpdated == null) {
188 distInfoUpdated = "";
190 return distInfoUpdated;