]> git.basschouten.com Git - openhab-addons.git/blob
8a0970a304a8ff913b9a5aa58ab815e2a24fa877
[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.onkyo.internal.eiscp;
14
15 /**
16  * Class to handle Onkyo eISCP messages.
17  *
18  * @author Pauli Anttila - Initial contribution
19  */
20 public class EiscpMessage {
21     private String command = "";
22     private String value = "";
23
24     private EiscpMessage(MessageBuilder messageBuilder) {
25         this.command = messageBuilder.command;
26         this.value = messageBuilder.value;
27     }
28
29     public String getCommand() {
30         return command;
31     }
32
33     public void setCommand(String command) {
34         this.command = command;
35     }
36
37     public String getValue() {
38         return value;
39     }
40
41     public void setValue(String value) {
42         this.value = value;
43     }
44
45     @Override
46     public String toString() {
47         String str = "[";
48
49         str += "command=" + command;
50         str += ", value=" + value;
51         str += "]";
52
53         return str;
54     }
55
56     public static class MessageBuilder {
57         private String command;
58         private String value;
59
60         public MessageBuilder command(String command) {
61             this.command = command;
62             return this;
63         }
64
65         public MessageBuilder value(String value) {
66             this.value = value;
67             return this;
68         }
69
70         public EiscpMessage build() {
71             return new EiscpMessage(this);
72         }
73     }
74 }