]> git.basschouten.com Git - openhab-addons.git/blob
ae1f0d03b0d59b5e1f669ab9fceaea29f279d557
[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 /**
16  * GenericAudioItems are any kind of items that deal with audio data and can be
17  * muted or their volume can be changed.
18  *
19  * @author Tobias Bräutigam - Initial contribution
20  */
21 public abstract class AbstractAudioDeviceConfig extends AbstractDeviceConfig {
22
23     public enum State {
24         SUSPENDED,
25         IDLE,
26         RUNNING,
27         CORKED,
28         DRAINED
29     }
30
31     protected State state;
32     protected boolean muted;
33     protected int volume;
34     protected Module module;
35
36     public AbstractAudioDeviceConfig(int id, String name, Module module) {
37         super(id, name);
38         this.module = module;
39     }
40
41     public Module getModule() {
42         return module;
43     }
44
45     public void setModule(Module module) {
46         this.module = module;
47     }
48
49     public State getState() {
50         return state;
51     }
52
53     public void setState(State state) {
54         this.state = state;
55     }
56
57     public boolean isMuted() {
58         return muted;
59     }
60
61     public void setMuted(boolean muted) {
62         this.muted = muted;
63     }
64
65     public int getVolume() {
66         return volume;
67     }
68
69     public void setVolume(int volume) {
70         this.volume = volume;
71     }
72
73     @Override
74     public String toString() {
75         return this.getClass().getSimpleName() + " #" + id + " (Module: " + module + ") " + name + ", muted: " + muted
76                 + ", state: " + state + ", volume: " + volume;
77     }
78 }