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>sendAttributes</b>.
21 * This command will send an attribute value, identified by handle, via a notification or an
22 * indication to a remote device, but does not modify the current corresponding value in the
23 * local GATT database. If this attribute, identified by handle, does not have notification or
24 * indication property, or no remote device has registered for notifications or indications
25 * of this attribute, then an error will be returned.
27 * This class provides methods for processing BlueGiga API commands.
29 * Note that this code is autogenerated. Manual changes may be overwritten.
31 * @author Chris Jackson - Initial contribution of Java code generator
34 public class BlueGigaSendAttributesCommand extends BlueGigaDeviceCommand {
35 public static int COMMAND_CLASS = 0x02;
36 public static int COMMAND_METHOD = 0x02;
39 * Attribute handle to send.
41 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
48 * BlueGiga API type is <i>uint8array</i> - Java type is {@link int[]}
50 private int[] value = new int[0];
53 * Attribute handle to send.
55 * @param handle the handle to set as {@link int}
57 public void setHandle(int handle) {
64 * @param value the value to set as {@link int[]}
66 public void setValue(int[] value) {
71 public int[] serialize() {
72 // Serialize the header
73 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
75 // Serialize the fields
76 serializeUInt8(connection);
77 serializeUInt16(handle);
78 serializeUInt8Array(value);
84 public String toString() {
85 final StringBuilder builder = new StringBuilder();
86 builder.append("BlueGigaSendAttributesCommand [connection=");
87 builder.append(connection);
88 builder.append(", handle=");
89 builder.append(handle);
90 builder.append(", value=");
91 for (int c = 0; c < value.length; c++) {
95 builder.append(String.format("%02X", value[c]));
98 return builder.toString();