]> git.basschouten.com Git - openhab-addons.git/blob
bbe2b5f4494583b07a8e052205001852e305f533
[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>findInformationFoundEvent</b>.
22  * <p>
23  * This event is generated when characteristics type mappings are found. This happens
24  * typically after Find Information command has been issued to discover all attributes of a
25  * service.
26  * <p>
27  * This class provides methods for processing BlueGiga API commands.
28  * <p>
29  * Note that this code is autogenerated. Manual changes may be overwritten.
30  *
31  * @author Chris Jackson - Initial contribution of Java code generator
32  */
33 @NonNullByDefault
34 public class BlueGigaFindInformationFoundEvent extends BlueGigaDeviceResponse {
35     public static int COMMAND_CLASS = 0x04;
36     public static int COMMAND_METHOD = 0x04;
37
38     /**
39      * Characteristics handle
40      * <p>
41      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
42      */
43     private int chrHandle;
44
45     /**
46      * Characteristics type (UUID)
47      * <p>
48      * BlueGiga API type is <i>uuid</i> - Java type is {@link UUID}
49      */
50     private UUID uuid;
51
52     /**
53      * Event constructor
54      */
55     public BlueGigaFindInformationFoundEvent(int[] inputBuffer) {
56         // Super creates deserializer and reads header fields
57         super(inputBuffer);
58
59         event = (inputBuffer[0] & 0x80) != 0;
60
61         // Deserialize the fields
62         connection = deserializeUInt8();
63         chrHandle = deserializeUInt16();
64         uuid = deserializeUuid();
65     }
66
67     /**
68      * Characteristics handle
69      * <p>
70      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
71      *
72      * @return the current chr_handle as {@link int}
73      */
74     public int getChrHandle() {
75         return chrHandle;
76     }
77
78     /**
79      * Characteristics type (UUID)
80      * <p>
81      * BlueGiga API type is <i>uuid</i> - Java type is {@link UUID}
82      *
83      * @return the current uuid as {@link UUID}
84      */
85     public UUID getUuid() {
86         return uuid;
87     }
88
89     @Override
90     public String toString() {
91         final StringBuilder builder = new StringBuilder();
92         builder.append("BlueGigaFindInformationFoundEvent [connection=");
93         builder.append(connection);
94         builder.append(", chrHandle=");
95         builder.append(chrHandle);
96         builder.append(", uuid=");
97         builder.append(uuid);
98         builder.append(']');
99         return builder.toString();
100     }
101 }