2 * Copyright (c) 2010-2020 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.atlona.internal.pro3;
15 import java.util.Collections;
16 import java.util.HashSet;
19 import org.openhab.binding.atlona.internal.handler.AtlonaCapabilities;
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.
25 * @author Tim Roberts - Initial contribution
27 public class AtlonaPro3Capabilities extends AtlonaCapabilities {
30 * Number of power ports
32 private final int nbrPowerPorts;
35 * Number of audio ports
37 private final int nbrAudioPorts;
40 * The set of output ports that are HDMI ports
42 private final Set<Integer> hdmiPorts;
45 * Constructs the capabilities from the parms
47 * @param nbrPowerPorts a greater than 0 number of power ports
48 * @param nbrAudioPorts a greater than 0 number of audio ports
49 * @param hdmiPorts a non-null, non-empty set of hdmi ports
51 public AtlonaPro3Capabilities(int nbrPowerPorts, int nbrAudioPorts, Set<Integer> hdmiPorts) {
54 if (nbrPowerPorts < 1) {
55 throw new IllegalArgumentException("nbrPowerPorts must be greater than 0");
58 if (nbrAudioPorts < 1) {
59 throw new IllegalArgumentException("nbrAudioPorts must be greater than 0");
62 if (hdmiPorts == null) {
63 throw new IllegalArgumentException("hdmiPorts cannot be null");
66 if (hdmiPorts.isEmpty()) {
67 throw new IllegalArgumentException("hdmiPorts cannot be empty");
70 this.nbrPowerPorts = nbrPowerPorts;
71 this.nbrAudioPorts = nbrAudioPorts;
72 this.hdmiPorts = Collections.unmodifiableSet(new HashSet<>(hdmiPorts));
76 * Returns the number of power ports
78 * @return a greater than 0 number of power ports
80 int getNbrPowerPorts() {
85 * Returns the number of audio ports
87 * @return a greater than 0 number of audio ports
89 int getNbrAudioPorts() {
94 * Returns the set of hdmi ports
96 * @return a non-null, non-empty immutable set of hdmi ports
98 Set<Integer> getHdmiPorts() {