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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaDeviceCommand;
19 * Class to implement the BlueGiga command <b>findInformation</b>.
21 * This command can be used to find specific attributes on a remote device based on their 16-bit
22 * UUID value and value. The search can be limited by a starting and ending handle values.
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
29 * @author Pauli Anttila - Added message builder
32 public class BlueGigaFindInformationCommand extends BlueGigaDeviceCommand {
33 public static final int COMMAND_CLASS = 0x04;
34 public static final int COMMAND_METHOD = 0x03;
36 private BlueGigaFindInformationCommand(CommandBuilder builder) {
37 super.setConnection(builder.connection);
38 this.start = builder.start;
39 this.end = builder.end;
43 * First attribute handle
45 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
50 * Last attribute handle
52 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
57 public int[] serialize() {
58 // Serialize the header
59 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
61 // Serialize the fields
62 serializeUInt8(connection);
63 serializeUInt16(start);
70 public String toString() {
71 final StringBuilder builder = new StringBuilder();
72 builder.append("BlueGigaFindInformationCommand [connection=");
73 builder.append(connection);
74 builder.append(", start=");
75 builder.append(start);
76 builder.append(", end=");
79 return builder.toString();
82 public static class CommandBuilder {
83 private int connection;
88 * Set connection handle.
90 * @param connection the connection to set as {@link int}
92 public CommandBuilder withConnection(int connection) {
93 this.connection = connection;
98 * First requested handle number
100 * @param start the start to set as {@link int}
102 public CommandBuilder withStart(int start) {
108 * Last requested handle number
110 * @param end the end to set as {@link int}
112 public CommandBuilder withEnd(int end) {
117 public BlueGigaFindInformationCommand build() {
118 return new BlueGigaFindInformationCommand(this);