]> git.basschouten.com Git - openhab-addons.git/blob
ccea6228ce393d3835bc4610f8314e5fdeaf10cc
[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.pulseaudio.internal.items;
14
15 import java.util.ArrayList;
16 import java.util.List;
17 import java.util.Map;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21
22 /**
23  * On a Pulseaudio server Sinks are the devices the audio streams are routed to
24  * (playback devices) it can be a single item or a group of other Sinks that are
25  * combined to one playback device
26  *
27  * @author Tobias Bräutigam - Initial contribution
28  */
29 @NonNullByDefault
30 public class Sink extends AbstractAudioDeviceConfig {
31
32     protected List<String> combinedSinkNames;
33     protected List<Sink> combinedSinks;
34
35     public Sink(int id, String name, String description, Map<String, String> properties, @Nullable Module module) {
36         super(id, name, description, properties, module);
37         combinedSinkNames = new ArrayList<>();
38         combinedSinks = new ArrayList<>();
39     }
40
41     public void addCombinedSinkName(String name) {
42         this.combinedSinkNames.add(name);
43     }
44
45     public boolean isCombinedSink() {
46         return !combinedSinkNames.isEmpty();
47     }
48
49     public List<String> getCombinedSinkNames() {
50         return combinedSinkNames;
51     }
52
53     public List<Sink> getCombinedSinks() {
54         return combinedSinks;
55     }
56
57     public void setCombinedSinks(List<Sink> combinedSinks) {
58         this.combinedSinks = combinedSinks;
59     }
60
61     public void addCombinedSink(@Nullable Sink sink) {
62         if (sink != null) {
63             this.combinedSinks.add(sink);
64         }
65     }
66 }