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.nest.internal.wwn.dto;
15 import java.util.Date;
16 import java.util.List;
19 * The data for the WWN camera.
21 * @author David Bennett - Initial contribution
22 * @author Wouter Born - Add equals and hashCode methods
24 public class WWNCamera extends BaseWWNDevice {
26 private Boolean isStreaming;
27 private Boolean isAudioInputEnabled;
28 private Date lastIsOnlineChange;
29 private Boolean isVideoHistoryEnabled;
30 private String webUrl;
31 private String appUrl;
32 private Boolean isPublicShareEnabled;
33 private List<WWNActivityZone> activityZones;
34 private String publicShareUrl;
35 private String snapshotUrl;
36 private WWNCameraEvent lastEvent;
38 public Boolean isStreaming() {
42 public Boolean isAudioInputEnabled() {
43 return isAudioInputEnabled;
46 public Date getLastIsOnlineChange() {
47 return lastIsOnlineChange;
50 public Boolean isVideoHistoryEnabled() {
51 return isVideoHistoryEnabled;
54 public String getWebUrl() {
58 public String getAppUrl() {
62 public Boolean isPublicShareEnabled() {
63 return isPublicShareEnabled;
66 public List<WWNActivityZone> getActivityZones() {
70 public String getPublicShareUrl() {
71 return publicShareUrl;
74 public String getSnapshotUrl() {
78 public WWNCameraEvent getLastEvent() {
83 public boolean equals(Object obj) {
87 if (obj == null || !super.equals(obj)) {
90 if (getClass() != obj.getClass()) {
93 WWNCamera other = (WWNCamera) obj;
94 if (activityZones == null) {
95 if (other.activityZones != null) {
98 } else if (!activityZones.equals(other.activityZones)) {
101 if (appUrl == null) {
102 if (other.appUrl != null) {
105 } else if (!appUrl.equals(other.appUrl)) {
108 if (isAudioInputEnabled == null) {
109 if (other.isAudioInputEnabled != null) {
112 } else if (!isAudioInputEnabled.equals(other.isAudioInputEnabled)) {
115 if (isPublicShareEnabled == null) {
116 if (other.isPublicShareEnabled != null) {
119 } else if (!isPublicShareEnabled.equals(other.isPublicShareEnabled)) {
122 if (isStreaming == null) {
123 if (other.isStreaming != null) {
126 } else if (!isStreaming.equals(other.isStreaming)) {
129 if (isVideoHistoryEnabled == null) {
130 if (other.isVideoHistoryEnabled != null) {
133 } else if (!isVideoHistoryEnabled.equals(other.isVideoHistoryEnabled)) {
136 if (lastEvent == null) {
137 if (other.lastEvent != null) {
140 } else if (!lastEvent.equals(other.lastEvent)) {
143 if (lastIsOnlineChange == null) {
144 if (other.lastIsOnlineChange != null) {
147 } else if (!lastIsOnlineChange.equals(other.lastIsOnlineChange)) {
150 if (publicShareUrl == null) {
151 if (other.publicShareUrl != null) {
154 } else if (!publicShareUrl.equals(other.publicShareUrl)) {
157 if (snapshotUrl == null) {
158 if (other.snapshotUrl != null) {
161 } else if (!snapshotUrl.equals(other.snapshotUrl)) {
164 if (webUrl == null) {
165 if (other.webUrl != null) {
168 } else if (!webUrl.equals(other.webUrl)) {
175 public int hashCode() {
176 final int prime = 31;
177 int result = super.hashCode();
178 result = prime * result + ((activityZones == null) ? 0 : activityZones.hashCode());
179 result = prime * result + ((appUrl == null) ? 0 : appUrl.hashCode());
180 result = prime * result + ((isAudioInputEnabled == null) ? 0 : isAudioInputEnabled.hashCode());
181 result = prime * result + ((isPublicShareEnabled == null) ? 0 : isPublicShareEnabled.hashCode());
182 result = prime * result + ((isStreaming == null) ? 0 : isStreaming.hashCode());
183 result = prime * result + ((isVideoHistoryEnabled == null) ? 0 : isVideoHistoryEnabled.hashCode());
184 result = prime * result + ((lastEvent == null) ? 0 : lastEvent.hashCode());
185 result = prime * result + ((lastIsOnlineChange == null) ? 0 : lastIsOnlineChange.hashCode());
186 result = prime * result + ((publicShareUrl == null) ? 0 : publicShareUrl.hashCode());
187 result = prime * result + ((snapshotUrl == null) ? 0 : snapshotUrl.hashCode());
188 result = prime * result + ((webUrl == null) ? 0 : webUrl.hashCode());
193 public String toString() {
194 StringBuilder builder = new StringBuilder();
195 builder.append("Camera [isStreaming=").append(isStreaming).append(", isAudioInputEnabled=")
196 .append(isAudioInputEnabled).append(", lastIsOnlineChange=").append(lastIsOnlineChange)
197 .append(", isVideoHistoryEnabled=").append(isVideoHistoryEnabled).append(", webUrl=").append(webUrl)
198 .append(", appUrl=").append(appUrl).append(", isPublicShareEnabled=").append(isPublicShareEnabled)
199 .append(", activityZones=").append(activityZones).append(", publicShareUrl=").append(publicShareUrl)
200 .append(", snapshotUrl=").append(snapshotUrl).append(", lastEvent=").append(lastEvent)
201 .append(", getId()=").append(getId()).append(", getName()=").append(getName())
202 .append(", getDeviceId()=").append(getDeviceId()).append(", getLastConnection()=")
203 .append(getLastConnection()).append(", isOnline()=").append(isOnline()).append(", getNameLong()=")
204 .append(getNameLong()).append(", getSoftwareVersion()=").append(getSoftwareVersion())
205 .append(", getStructureId()=").append(getStructureId()).append(", getWhereId()=").append(getWhereId())
207 return builder.toString();