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