]> git.basschouten.com Git - openhab-addons.git/blob
ec6d2d13bbeda44089f2cea8ea700dc13cfeb7bb
[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.atlona.internal.pro3;
14
15 import java.util.Collections;
16 import java.util.HashSet;
17 import java.util.Set;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.atlona.internal.handler.AtlonaCapabilities;
21
22 /**
23  * The capabilities class for the Atlona PRO3 line. Each PRO3 model differs in the number of (output) ports that can be
24  * powered, the number of audio ports there are and which (output) ports are HDMI ports.
25  *
26  * @author Tim Roberts - Initial contribution
27  * @author Michael Lobstein - Add support for AT-PRO3HD66M
28  */
29 @NonNullByDefault
30 public class AtlonaPro3Capabilities extends AtlonaCapabilities {
31
32     /**
33      * Number of power ports
34      */
35     private final int nbrPowerPorts;
36
37     /**
38      * Number of audio ports
39      */
40     private final int nbrAudioPorts;
41
42     /**
43      * The set of output ports that are HDMI ports
44      */
45     private final Set<Integer> hdmiPorts;
46
47     /**
48      * Indicates if the thing is a 4K/UHD model vs an older HD model
49      */
50     private final boolean isUHDModel;
51
52     /**
53      * Constructs the capabilities from the parms
54      *
55      * @param nbrPowerPorts a greater than 0 number of power ports
56      * @param nbrAudioPorts a greater than 0 number of audio ports
57      * @param hdmiPorts a non-null, non-empty set of hdmi ports
58      */
59     public AtlonaPro3Capabilities(int nbrPowerPorts, int nbrAudioPorts, Set<Integer> hdmiPorts, boolean isUHDModel) {
60         super();
61
62         if (hdmiPorts.isEmpty()) {
63             throw new IllegalArgumentException("hdmiPorts cannot be empty");
64         }
65
66         this.nbrPowerPorts = nbrPowerPorts;
67         this.nbrAudioPorts = nbrAudioPorts;
68         this.hdmiPorts = Collections.unmodifiableSet(new HashSet<>(hdmiPorts));
69         this.isUHDModel = isUHDModel;
70     }
71
72     /**
73      * Returns the number of power ports
74      *
75      * @return a greater than 0 number of power ports
76      */
77     int getNbrPowerPorts() {
78         return nbrPowerPorts;
79     }
80
81     /**
82      * Returns the number of audio ports
83      *
84      * @return a greater than 0 number of audio ports
85      */
86     int getNbrAudioPorts() {
87         return nbrAudioPorts;
88     }
89
90     /**
91      * Returns the set of hdmi ports
92      *
93      * @return a non-null, non-empty immutable set of hdmi ports
94      */
95     Set<Integer> getHdmiPorts() {
96         return hdmiPorts;
97     }
98
99     /**
100      * Returns a flag indicating the model type
101      *
102      * @return boolean true if the thing is a 4K/UHD model
103      */
104     boolean isUHDModel() {
105         return isUHDModel;
106     }
107 }