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