]> git.basschouten.com Git - openhab-addons.git/blob
e4f3816299f33f5cec3a6c21649f774af457409a
[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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaDeviceResponse;
17 import org.openhab.binding.bluetooth.bluegiga.internal.enumeration.BgApiResponse;
18
19 /**
20  * Class to implement the BlueGiga command <b>procedureCompletedEvent</b>.
21  * <p>
22  * This event is produced at the GATT client when an attribute protocol event is completed and a
23  * new operation can be issued
24  * <p>
25  * This class provides methods for processing BlueGiga API commands.
26  * <p>
27  * Note that this code is autogenerated. Manual changes may be overwritten.
28  *
29  * @author Chris Jackson - Initial contribution of Java code generator
30  */
31 @NonNullByDefault
32 public class BlueGigaProcedureCompletedEvent extends BlueGigaDeviceResponse {
33     public static final int COMMAND_CLASS = 0x04;
34     public static final int COMMAND_METHOD = 0x01;
35
36     /**
37      * 0: The operation was successful. Otherwise: attribute protocol error code returned by
38      * remote device
39      * <p>
40      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
41      */
42     private BgApiResponse result;
43
44     /**
45      * Characteristic handle at which the event ended
46      * <p>
47      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
48      */
49     private int chrHandle;
50
51     /**
52      * Event constructor
53      */
54     public BlueGigaProcedureCompletedEvent(int[] inputBuffer) {
55         // Super creates deserializer and reads header fields
56         super(inputBuffer);
57
58         event = (inputBuffer[0] & 0x80) != 0;
59
60         // Deserialize the fields
61         connection = deserializeUInt8();
62         result = deserializeBgApiResponse();
63         chrHandle = deserializeUInt16();
64     }
65
66     /**
67      * 0: The operation was successful. Otherwise: attribute protocol error code returned by
68      * remote device
69      * <p>
70      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
71      *
72      * @return the current result as {@link BgApiResponse}
73      */
74     public BgApiResponse getResult() {
75         return result;
76     }
77
78     /**
79      * Characteristic handle at which the event ended
80      * <p>
81      * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
82      *
83      * @return the current chr_handle as {@link int}
84      */
85     public int getChrHandle() {
86         return chrHandle;
87     }
88
89     @Override
90     public String toString() {
91         final StringBuilder builder = new StringBuilder();
92         builder.append("BlueGigaProcedureCompletedEvent [connection=");
93         builder.append(connection);
94         builder.append(", result=");
95         builder.append(result);
96         builder.append(", chrHandle=");
97         builder.append(chrHandle);
98         builder.append(']');
99         return builder.toString();
100     }
101 }