]> git.basschouten.com Git - openhab-addons.git/blob
e96b3d39c81928a35a0c3ace2f3244b0fa57d1bb
[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.mercedesme.internal.utils;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.types.State;
17
18 /**
19  * The {@link ChannelStateMap} holds the necessary values to update a channel state
20  *
21  * @author Bernd Weymann - Initial contribution
22  */
23 @NonNullByDefault
24 public class ChannelStateMap {
25     private String channel;
26     private String group;
27     private State state;
28     private long timestamp;
29
30     public ChannelStateMap(String ch, String grp, State st, long ts) {
31         channel = ch;
32         group = grp;
33         state = st;
34         timestamp = ts;
35     }
36
37     public String getChannel() {
38         return channel;
39     }
40
41     public String getGroup() {
42         return group;
43     }
44
45     public State getState() {
46         return state;
47     }
48
49     public long getTimestamp() {
50         return timestamp;
51     }
52
53     @Override
54     public String toString() {
55         return group + ":" + channel + " " + state;
56     }
57
58     public boolean isValid() {
59         return !channel.isEmpty();
60     }
61 }