]> git.basschouten.com Git - openhab-addons.git/blob
bf768db9f4c80ed8a40f16bfbeb162fcee04f926
[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.robonect.internal.model;
14
15 /**
16  * Answer object for holding version information.
17  * 
18  * @author Marco Meyer - Initial contribution
19  */
20 public class VersionInfo extends RobonectAnswer {
21
22     private static final RobonectVersion NA_VERSION = new RobonectVersion();
23
24     /**
25      * encapsulates the robonect version information.
26      */
27     public static class RobonectVersion {
28
29         private static final String NA = "n/a";
30
31         private String serial;
32
33         private String version;
34
35         private String compiled;
36
37         private String comment;
38
39         public RobonectVersion() {
40             this(NA, NA, NA, NA);
41         }
42
43         public RobonectVersion(String serial, String version, String compiled, String comment) {
44             this.serial = serial;
45             this.version = version;
46             this.compiled = compiled;
47             this.comment = comment;
48         }
49
50         /**
51          * @return - The serial number of the robonect module.
52          */
53         public String getSerial() {
54             return serial;
55         }
56
57         /**
58          * @return - The firmware version running on the robonect module.
59          */
60         public String getVersion() {
61             return version;
62         }
63
64         /**
65          * @return - The date and time the firmware was compiled.
66          */
67         public String getCompiled() {
68             return compiled;
69         }
70
71         /**
72          * @return - The comment added to this version.
73          */
74         public String getComment() {
75             return comment;
76         }
77
78         public void setSerial(String serial) {
79             this.serial = serial;
80         }
81
82         public void setVersion(String version) {
83             this.version = version;
84         }
85
86         public void setCompiled(String compiled) {
87             this.compiled = compiled;
88         }
89
90         public void setComment(String comment) {
91             this.comment = comment;
92         }
93     }
94
95     private RobonectVersion robonect;
96
97     /**
98      * @return - the object encapsulating the version information. See {@link RobonectVersion}
99      */
100     public RobonectVersion getRobonect() {
101         if (robonect != null) {
102             return robonect;
103         } else {
104             return NA_VERSION;
105         }
106     }
107
108     public void setRobonect(RobonectVersion robonect) {
109         this.robonect = robonect;
110     }
111 }