]> git.basschouten.com Git - openhab-addons.git/blob
6f4c4d289018aafd0051b997d074b9285d4b4061
[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.attributeclient;
14
15 import java.util.UUID;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaDeviceResponse;
19
20 /**
21  * Class to implement the BlueGiga command <b>groupFoundEvent</b>.
22  * <p>
23  * This event is produced when an attribute group (a service) is found. Typically this event is
24  * produced after Read by Group Type command.
25  * <p>
26  * This class provides methods for processing BlueGiga API commands.
27  * <p>
28  * Note that this code is autogenerated. Manual changes may be overwritten.
29  *
30  * @author Chris Jackson - Initial contribution of Java code generator
31  */
32 @NonNullByDefault
33 public class BlueGigaGroupFoundEvent extends BlueGigaDeviceResponse {
34     public static int COMMAND_CLASS = 0x04;
35     public static int COMMAND_METHOD = 0x02;
36
37     /**
38      * Starting handle
39      * <p>
40      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
41      */
42     private int start;
43
44     /**
45      * Ending handle
46      * <p>
47      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
48      */
49     private int end;
50
51     /**
52      * UUID of a service. Length is 0 if no services are found.
53      * <p>
54      * BlueGiga API type is <i>uuid</i> - Java type is {@link UUID}
55      */
56     private UUID uuid;
57
58     /**
59      * Event constructor
60      */
61     public BlueGigaGroupFoundEvent(int[] inputBuffer) {
62         // Super creates deserializer and reads header fields
63         super(inputBuffer);
64
65         event = (inputBuffer[0] & 0x80) != 0;
66
67         // Deserialize the fields
68         connection = deserializeUInt8();
69         start = deserializeUInt16();
70         end = deserializeUInt16();
71         uuid = deserializeUuid();
72     }
73
74     /**
75      * Starting handle
76      * <p>
77      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
78      *
79      * @return the current start as {@link int}
80      */
81     public int getStart() {
82         return start;
83     }
84
85     /**
86      * Ending handle
87      * <p>
88      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
89      *
90      * @return the current end as {@link int}
91      */
92     public int getEnd() {
93         return end;
94     }
95
96     /**
97      * UUID of a service. Length is 0 if no services are found.
98      * <p>
99      * BlueGiga API type is <i>uuid</i> - Java type is {@link UUID}
100      *
101      * @return the current uuid as {@link UUID}
102      */
103     public UUID getUuid() {
104         return uuid;
105     }
106
107     @Override
108     public String toString() {
109         final StringBuilder builder = new StringBuilder();
110         builder.append("BlueGigaGroupFoundEvent [connection=");
111         builder.append(connection);
112         builder.append(", start=");
113         builder.append(start);
114         builder.append(", end=");
115         builder.append(end);
116         builder.append(", uuid=");
117         builder.append(uuid);
118         builder.append(']');
119         return builder.toString();
120     }
121 }