]> git.basschouten.com Git - openhab-addons.git/blob
1753defb070a6c99070bfaa73d32031236ce3686
[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.connection;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaDeviceResponse;
17
18 /**
19  * Class to implement the BlueGiga command <b>versionIndEvent</b>.
20  * <p>
21  * This event indicates the remote devices version.
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 BlueGigaVersionIndEvent extends BlueGigaDeviceResponse {
31     public static int COMMAND_CLASS = 0x03;
32     public static int COMMAND_METHOD = 0x01;
33
34     /**
35      * Bluetooth controller specification version
36      * <p>
37      * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
38      */
39     private int versNr;
40
41     /**
42      * Manufacturer of the controller
43      * <p>
44      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
45      */
46     private int compId;
47
48     /**
49      * Bluetooth controller version
50      * <p>
51      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
52      */
53     private int subVersNr;
54
55     /**
56      * Event constructor
57      */
58     public BlueGigaVersionIndEvent(int[] inputBuffer) {
59         // Super creates deserializer and reads header fields
60         super(inputBuffer);
61
62         event = (inputBuffer[0] & 0x80) != 0;
63
64         // Deserialize the fields
65         connection = deserializeUInt8();
66         versNr = deserializeUInt8();
67         compId = deserializeUInt16();
68         subVersNr = deserializeUInt16();
69     }
70
71     /**
72      * Bluetooth controller specification version
73      * <p>
74      * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
75      *
76      * @return the current vers_nr as {@link int}
77      */
78     public int getVersNr() {
79         return versNr;
80     }
81
82     /**
83      * Manufacturer of the controller
84      * <p>
85      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
86      *
87      * @return the current comp_id as {@link int}
88      */
89     public int getCompId() {
90         return compId;
91     }
92
93     /**
94      * Bluetooth controller version
95      * <p>
96      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
97      *
98      * @return the current sub_vers_nr as {@link int}
99      */
100     public int getSubVersNr() {
101         return subVersNr;
102     }
103
104     @Override
105     public String toString() {
106         final StringBuilder builder = new StringBuilder();
107         builder.append("BlueGigaVersionIndEvent [connection=");
108         builder.append(connection);
109         builder.append(", versNr=");
110         builder.append(versNr);
111         builder.append(", compId=");
112         builder.append(compId);
113         builder.append(", subVersNr=");
114         builder.append(subVersNr);
115         builder.append(']');
116         return builder.toString();
117     }
118 }