]> git.basschouten.com Git - openhab-addons.git/blob
82df4112053821be96032ead191809b79a926744
[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.phc.internal.handler;
14
15 import org.openhab.core.types.Command;
16
17 /**
18  * Object to save a whole message.
19  *
20  * @author Jonas Hohaus - Initial contribution
21  */
22 class QueueObject {
23     private final String moduleType;
24     private final byte moduleAddress;
25     private final byte channel;
26     private final Command command;
27
28     private short time;
29
30     public QueueObject(String moduleType, byte moduleAddress, byte channel, Command command) {
31         this.moduleType = moduleType;
32         this.moduleAddress = moduleAddress;
33         this.channel = channel;
34         this.command = command;
35     }
36
37     public QueueObject(String moduleType, int moduleAddress, String channel, Command command) {
38         this.moduleType = moduleType;
39         this.moduleAddress = (byte) moduleAddress;
40         this.channel = Byte.parseByte(channel);
41         this.command = command;
42     }
43
44     public QueueObject(String moduleType, int moduleAddress, String channel, Command command, short time) {
45         this(moduleType, moduleAddress, channel, command);
46         this.time = time;
47     }
48
49     public String getModuleType() {
50         return moduleType;
51     }
52
53     public byte getModuleAddress() {
54         return moduleAddress;
55     }
56
57     public byte getChannel() {
58         return channel;
59     }
60
61     public Command getCommand() {
62         return command;
63     }
64
65     public short getTime() {
66         return time;
67     }
68
69     @Override
70     public String toString() {
71         StringBuilder sb = new StringBuilder();
72         sb.append("moduleType: ");
73         sb.append(moduleType);
74         sb.append(", moduleAddress: ");
75         sb.append(moduleAddress);
76         sb.append(", channel: ");
77         sb.append(channel);
78
79         return sb.toString();
80     }
81 }