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.attributeclient;
15 import java.util.UUID;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaDeviceCommand;
21 * Class to implement the BlueGiga command <b>findByTypeValue</b>.
23 * This command can be used to find specific attributes on a remote device based on their 16-bit
24 * UUID value and value. The search can be limited by a starting and ending handle values.
26 * This class provides methods for processing BlueGiga API commands.
28 * Note that this code is autogenerated. Manual changes may be overwritten.
30 * @author Chris Jackson - Initial contribution of Java code generator
33 public class BlueGigaFindByTypeValueCommand extends BlueGigaDeviceCommand {
34 public static int COMMAND_CLASS = 0x04;
35 public static int COMMAND_METHOD = 0x00;
38 * First requested handle number
40 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
45 * Last requested handle number
47 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
52 * 2 octet UUID to find
54 * BlueGiga API type is <i>uuid</i> - Java type is {@link UUID}
56 private UUID uuid = new UUID(0, 0);
59 * Attribute value to find
61 * BlueGiga API type is <i>uint8array</i> - Java type is {@link int[]}
63 private int[] value = new int[0];
66 * First requested handle number
68 * @param start the start to set as {@link int}
70 public void setStart(int start) {
75 * Last requested handle number
77 * @param end the end to set as {@link int}
79 public void setEnd(int end) {
84 * 2 octet UUID to find
86 * @param uuid the uuid to set as {@link UUID}
88 public void setUuid(UUID uuid) {
93 * Attribute value to find
95 * @param value the value to set as {@link int[]}
97 public void setValue(int[] value) {
102 public int[] serialize() {
103 // Serialize the header
104 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
106 // Serialize the fields
107 serializeUInt8(connection);
108 serializeUInt16(start);
109 serializeUInt16(end);
111 serializeUInt8Array(value);
117 public String toString() {
118 final StringBuilder builder = new StringBuilder();
119 builder.append("BlueGigaFindByTypeValueCommand [connection=");
120 builder.append(connection);
121 builder.append(", start=");
122 builder.append(start);
123 builder.append(", end=");
125 builder.append(", uuid=");
126 builder.append(uuid);
127 builder.append(", value=");
128 for (int c = 0; c < value.length; c++) {
132 builder.append(String.format("%02X", value[c]));
135 return builder.toString();