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