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.hdpowerview.internal.dto;
15 import java.nio.charset.StandardCharsets;
16 import java.util.Base64;
17 import java.util.Objects;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
23 * State of a single Scene, as returned by an HD PowerView Hub
25 * @author Jacob Laursen - Initial contribution
28 public class Scene implements Comparable<Scene> {
30 public @Nullable String name;
37 public boolean equals(@Nullable Object o) {
41 if (!(o instanceof Scene)) {
44 Scene other = (Scene) o;
46 return this.id == other.id && Objects.equals(name, other.name) && this.roomId == other.roomId
47 && this.order == other.order && this.colorId == other.colorId && this.iconId == other.iconId;
51 public final int hashCode() {
54 String name = this.name;
55 result = prime * result + id;
56 result = prime * result + (name == null ? 0 : name.hashCode());
57 result = prime * result + roomId;
58 result = prime * result + order;
59 result = prime * result + colorId;
60 result = prime * result + iconId;
66 public int compareTo(Scene other) {
67 return Integer.compare(order, other.order);
70 public String getName() {
71 return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);