]> git.basschouten.com Git - openhab-addons.git/blob
aa048510476e5c1853743b78a6b22ac7c4302080
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.pjlinkdevice.internal.device.command.mute;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.pjlinkdevice.internal.device.PJLinkDevice;
17 import org.openhab.binding.pjlinkdevice.internal.device.command.AbstractCommand;
18 import org.openhab.binding.pjlinkdevice.internal.device.command.ResponseException;
19
20 /**
21  * This command is used for selecting audio/video mute of the device as described in
22  * <a href="https://pjlink.jbmia.or.jp/english/data_cl2/PJLink_5-1.pdf">[PJLinkSpec]</a> 4.5. Mute instruction
23  *
24  * @author Nils Schnabel - Initial contribution
25  */
26 @NonNullByDefault
27 public class MuteInstructionCommand extends AbstractCommand<MuteInstructionRequest, MuteInstructionResponse> {
28
29     public enum MuteInstructionState {
30         ON("1"),
31         OFF("0");
32
33         private String pjLinkRepresentation;
34
35         private MuteInstructionState(String pjLinkRepresentation) {
36             this.pjLinkRepresentation = pjLinkRepresentation;
37         }
38
39         public String getPJLinkRepresentation() {
40             return this.pjLinkRepresentation;
41         }
42     }
43
44     public enum MuteInstructionChannel {
45         VIDEO("1"),
46         AUDIO("2"),
47         AUDIO_AND_VIDEO("3");
48
49         private String pjLinkRepresentation;
50
51         private MuteInstructionChannel(String pjLinkRepresentation) {
52             this.pjLinkRepresentation = pjLinkRepresentation;
53         }
54
55         public String getPJLinkRepresentation() {
56             return this.pjLinkRepresentation;
57         }
58     }
59
60     private MuteInstructionState targetState;
61     private MuteInstructionChannel targetChannel;
62
63     public MuteInstructionCommand(PJLinkDevice pjLinkDevice, MuteInstructionState targetState,
64             MuteInstructionChannel targetChannel) {
65         super(pjLinkDevice);
66         this.targetState = targetState;
67         this.targetChannel = targetChannel;
68     }
69
70     public MuteInstructionState getTargetState() {
71         return this.targetState;
72     }
73
74     public MuteInstructionChannel getTargetChannel() {
75         return this.targetChannel;
76     }
77
78     @Override
79     public MuteInstructionRequest createRequest() {
80         return new MuteInstructionRequest(this);
81     }
82
83     @Override
84     public MuteInstructionResponse parseResponse(String response) throws ResponseException {
85         return new MuteInstructionResponse(response);
86     }
87 }