]> git.basschouten.com Git - openhab-addons.git/blob
1dd8da833ca0b675bb5650d4054ce7a1c6834031
[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>readByType</b>.
21  * <p>
22  * The command reads the value of each attribute of a given type (UUID) and in a given attribute
23  * handle range. The command can for example be used to discover the characteristic
24  * declarations (UUID: 0x2803) within a service.
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 BlueGigaReadByTypeResponse extends BlueGigaDeviceResponse {
34     public static int COMMAND_CLASS = 0x04;
35     public static int COMMAND_METHOD = 0x02;
36
37     /**
38      * 0 : the command was successful. Otherwise an error occurred
39      * <p>
40      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
41      */
42     private BgApiResponse result;
43
44     /**
45      * Response constructor
46      */
47     public BlueGigaReadByTypeResponse(int[] inputBuffer) {
48         // Super creates deserializer and reads header fields
49         super(inputBuffer);
50
51         event = (inputBuffer[0] & 0x80) != 0;
52
53         // Deserialize the fields
54         connection = deserializeUInt8();
55         result = deserializeBgApiResponse();
56     }
57
58     /**
59      * 0 : the command was successful. Otherwise an error occurred
60      * <p>
61      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
62      *
63      * @return the current result as {@link BgApiResponse}
64      */
65     public BgApiResponse getResult() {
66         return result;
67     }
68
69     @Override
70     public String toString() {
71         final StringBuilder builder = new StringBuilder();
72         builder.append("BlueGigaReadByTypeResponse [connection=");
73         builder.append(connection);
74         builder.append(", result=");
75         builder.append(result);
76         builder.append(']');
77         return builder.toString();
78     }
79 }