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.BlueGigaDeviceCommand;
19 * Class to implement the BlueGiga command <b>userWriteResponse</b>.
21 * This command is used by the GATT server to acknowledge to the remote device that the
22 * attribute's value was written. This feature again allows the user application to
23 * acknowledged the attribute write operations instead of the Smart stack doing it
24 * automatically. Bluetooth The command should be used when an event is received where the
25 * reason why value has changed Value corresponds to
26 * attributes_attribute_change_reason_write_request_user. This response must be sent
27 * within 30 seconds or otherwise a timeout will occur.
29 * This class provides methods for processing BlueGiga API commands.
31 * Note that this code is autogenerated. Manual changes may be overwritten.
33 * @author Chris Jackson - Initial contribution of Java code generator
36 public class BlueGigaUserWriteResponseCommand extends BlueGigaDeviceCommand {
37 public static int COMMAND_CLASS = 0x02;
38 public static int COMMAND_METHOD = 0x04;
41 * 0: User Read Request is responded with data. In case of an error an application specific error
44 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
49 * 0: User Read Request is responded with data. In case of an error an application specific error
52 * @param attError the attError to set as {@link int}
54 public void setAttError(int attError) {
55 this.attError = attError;
59 public int[] serialize() {
60 // Serialize the header
61 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
63 // Serialize the fields
64 serializeUInt8(connection);
65 serializeUInt8(attError);
71 public String toString() {
72 final StringBuilder builder = new StringBuilder();
73 builder.append("BlueGigaUserWriteResponseCommand [connection=");
74 builder.append(connection);
75 builder.append(", attError=");
76 builder.append(attError);
78 return builder.toString();