2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.bluetooth.bluegiga.internal.command.attributedb;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaResponse;
17 import org.openhab.binding.bluetooth.bluegiga.internal.enumeration.BgApiResponse;
20 * Class to implement the BlueGiga command <b>readType</b>.
22 * This command reads the given attribute's type (UUID) from the local database.
24 * This class provides methods for processing BlueGiga API commands.
26 * Note that this code is autogenerated. Manual changes may be overwritten.
28 * @author Chris Jackson - Initial contribution of Java code generator
31 public class BlueGigaReadTypeResponse extends BlueGigaResponse {
32 public static final int COMMAND_CLASS = 0x02;
33 public static final int COMMAND_METHOD = 0x02;
36 * Handle of the attribute which was read
38 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
43 * 0 : the command was successful. Otherwise an error occurred
45 * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
47 private BgApiResponse result;
50 * Value of the attribute type (UUID)
52 * BlueGiga API type is <i>uint8array</i> - Java type is {@link int[]}
57 * Response constructor
59 public BlueGigaReadTypeResponse(int[] inputBuffer) {
60 // Super creates deserializer and reads header fields
63 event = (inputBuffer[0] & 0x80) != 0;
65 // Deserialize the fields
66 handle = deserializeUInt16();
67 result = deserializeBgApiResponse();
68 value = deserializeUInt8Array();
72 * Handle of the attribute which was read
74 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
76 * @return the current handle as {@link int}
78 public int getHandle() {
83 * 0 : the command was successful. Otherwise an error occurred
85 * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
87 * @return the current result as {@link BgApiResponse}
89 public BgApiResponse getResult() {
94 * Value of the attribute type (UUID)
96 * BlueGiga API type is <i>uint8array</i> - Java type is {@link int[]}
98 * @return the current value as {@link int[]}
100 public int[] getValue() {
105 public String toString() {
106 final StringBuilder builder = new StringBuilder();
107 builder.append("BlueGigaReadTypeResponse [handle=");
108 builder.append(handle);
109 builder.append(", result=");
110 builder.append(result);
111 builder.append(", value=");
112 for (int c = 0; c < value.length; c++) {
116 builder.append(String.format("%02X", value[c]));
119 return builder.toString();