]> git.basschouten.com Git - openhab-addons.git/blob
8cc4b13a6d6af930b5c0939fadfd390ca996b9fa
[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.bluetooth.bluegiga.internal.command.system;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaResponse;
17
18 /**
19  * Class to implement the BlueGiga command <b>getInfo</b>.
20  * <p>
21  * This command reads the local devices software and hardware versions.
22  * <p>
23  * This class provides methods for processing BlueGiga API commands.
24  * <p>
25  * Note that this code is autogenerated. Manual changes may be overwritten.
26  *
27  * @author Chris Jackson - Initial contribution of Java code generator
28  */
29 @NonNullByDefault
30 public class BlueGigaGetInfoResponse extends BlueGigaResponse {
31     public static final int COMMAND_CLASS = 0x00;
32     public static final int COMMAND_METHOD = 0x08;
33
34     /**
35      * Major software version
36      * <p>
37      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
38      */
39     private int major;
40
41     /**
42      * Minor software version
43      * <p>
44      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
45      */
46     private int minor;
47
48     /**
49      * Patch ID
50      * <p>
51      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
52      */
53     private int patch;
54
55     /**
56      * Build version
57      * <p>
58      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
59      */
60     private int build;
61
62     /**
63      * Link layer version
64      * <p>
65      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
66      */
67     private int llVersion;
68
69     /**
70      * Protocol version
71      * <p>
72      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
73      */
74     private int protocolVersion;
75
76     /**
77      * Hardware version
78      * <p>
79      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
80      */
81     private int hardware;
82
83     /**
84      * Response constructor
85      */
86     public BlueGigaGetInfoResponse(int[] inputBuffer) {
87         // Super creates deserializer and reads header fields
88         super(inputBuffer);
89
90         event = (inputBuffer[0] & 0x80) != 0;
91
92         // Deserialize the fields
93         major = deserializeUInt16();
94         minor = deserializeUInt16();
95         patch = deserializeUInt16();
96         build = deserializeUInt16();
97         llVersion = deserializeUInt16();
98         protocolVersion = deserializeUInt16();
99         hardware = deserializeUInt16();
100     }
101
102     /**
103      * Major software version
104      * <p>
105      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
106      *
107      * @return the current major as {@link int}
108      */
109     public int getMajor() {
110         return major;
111     }
112
113     /**
114      * Minor software version
115      * <p>
116      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
117      *
118      * @return the current minor as {@link int}
119      */
120     public int getMinor() {
121         return minor;
122     }
123
124     /**
125      * Patch ID
126      * <p>
127      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
128      *
129      * @return the current patch as {@link int}
130      */
131     public int getPatch() {
132         return patch;
133     }
134
135     /**
136      * Build version
137      * <p>
138      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
139      *
140      * @return the current build as {@link int}
141      */
142     public int getBuild() {
143         return build;
144     }
145
146     /**
147      * Link layer version
148      * <p>
149      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
150      *
151      * @return the current ll_version as {@link int}
152      */
153     public int getLlVersion() {
154         return llVersion;
155     }
156
157     /**
158      * Protocol version
159      * <p>
160      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
161      *
162      * @return the current protocol_version as {@link int}
163      */
164     public int getProtocolVersion() {
165         return protocolVersion;
166     }
167
168     /**
169      * Hardware version
170      * <p>
171      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
172      *
173      * @return the current hardware as {@link int}
174      */
175     public int getHardware() {
176         return hardware;
177     }
178
179     @Override
180     public String toString() {
181         final StringBuilder builder = new StringBuilder();
182         builder.append("BlueGigaGetInfoResponse [major=");
183         builder.append(major);
184         builder.append(", minor=");
185         builder.append(minor);
186         builder.append(", patch=");
187         builder.append(patch);
188         builder.append(", build=");
189         builder.append(build);
190         builder.append(", llVersion=");
191         builder.append(llVersion);
192         builder.append(", protocolVersion=");
193         builder.append(protocolVersion);
194         builder.append(", hardware=");
195         builder.append(hardware);
196         builder.append(']');
197         return builder.toString();
198     }
199 }