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.BlueGigaDeviceResponse;
19 * Class to implement the BlueGiga command <b>userReadRequestEvent</b>.
21 * This event is generated when a remote device tries to read an attribute which has the user
22 * property enabled. This event should be responded within 30 seconds with User Read Response
23 * command either containing the data or an error code.
25 * This class provides methods for processing BlueGiga API commands.
27 * Note that this code is autogenerated. Manual changes may be overwritten.
29 * @author Chris Jackson - Initial contribution of Java code generator
32 public class BlueGigaUserReadRequestEvent extends BlueGigaDeviceResponse {
33 public static final int COMMAND_CLASS = 0x02;
34 public static final int COMMAND_METHOD = 0x01;
37 * Attribute handle requested
39 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
44 * Attribute offset to send data from
46 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
51 * Maximum data size to respond with. If more data is sent than indicated by this parameter, the
52 * extra bytes will be ignored.
54 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
61 public BlueGigaUserReadRequestEvent(int[] inputBuffer) {
62 // Super creates deserializer and reads header fields
65 event = (inputBuffer[0] & 0x80) != 0;
67 // Deserialize the fields
68 connection = deserializeUInt8();
69 handle = deserializeUInt16();
70 offset = deserializeUInt16();
71 maxsize = deserializeUInt8();
75 * Attribute handle requested
77 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
79 * @return the current handle as {@link int}
81 public int getHandle() {
86 * Attribute offset to send data from
88 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
90 * @return the current offset as {@link int}
92 public int getOffset() {
97 * Maximum data size to respond with. If more data is sent than indicated by this parameter, the
98 * extra bytes will be ignored.
100 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
102 * @return the current maxsize as {@link int}
104 public int getMaxsize() {
109 public String toString() {
110 final StringBuilder builder = new StringBuilder();
111 builder.append("BlueGigaUserReadRequestEvent [connection=");
112 builder.append(connection);
113 builder.append(", handle=");
114 builder.append(handle);
115 builder.append(", offset=");
116 builder.append(offset);
117 builder.append(", maxsize=");
118 builder.append(maxsize);
120 return builder.toString();