]> git.basschouten.com Git - openhab-addons.git/blob
9b884e927ca1afd8f05f04c486550240af08e90d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.hdpowerview.internal.dto.gen3;
14
15 import java.nio.charset.StandardCharsets;
16 import java.util.Base64;
17 import java.util.List;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20
21 /**
22  * DTO for a scene as returned by an HD PowerView Generation 3 Gateway.
23  *
24  * @author Andrew Fiddian-Green - Initial contribution.
25  */
26 @NonNullByDefault
27 public class Scene {
28     private int id;
29     private @NonNullByDefault({}) String name;
30     private @NonNullByDefault({}) String ptName;
31     private @NonNullByDefault({}) String color;
32     private @NonNullByDefault({}) String icon;
33     private @NonNullByDefault({}) List<Integer> roomIds;
34
35     public String getColor() {
36         return color;
37     }
38
39     public String getIcon() {
40         return icon;
41     }
42
43     public int getId() {
44         return id;
45     }
46
47     public String getName() {
48         return String.join(" ", new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8), ptName);
49     }
50
51     public String getPtName() {
52         return ptName;
53     }
54
55     public List<Integer> getRoomIds() {
56         List<Integer> roomIds = this.roomIds;
57         return roomIds != null ? roomIds : List.of();
58     }
59 }