2 * Copyright (c) 2010-2020 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>readByType</b>.
23 * The command reads the value of each attribute of a given type (UUID) and in a given attribute
24 * handle range. The command can for example be used to discover the characteristic
25 * declarations (UUID: 0x2803) within a service.
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 BlueGigaReadByTypeCommand extends BlueGigaDeviceCommand {
35 public static int COMMAND_CLASS = 0x04;
36 public static int COMMAND_METHOD = 0x02;
39 * First attribute handle
41 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
46 * Last attribute handle
48 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
53 * Attribute type (UUID)
55 * BlueGiga API type is <i>uuid</i> - Java type is {@link UUID}
57 private UUID uuid = new UUID(0, 0);
60 * First attribute handle
62 * @param start the start to set as {@link int}
64 public void setStart(int start) {
69 * Last attribute handle
71 * @param end the end to set as {@link int}
73 public void setEnd(int end) {
78 * Attribute type (UUID)
80 * @param uuid the uuid to set as {@link UUID}
82 public void setUuid(UUID uuid) {
87 public int[] serialize() {
88 // Serialize the header
89 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
91 // Serialize the fields
92 serializeUInt8(connection);
93 serializeUInt16(start);
101 public String toString() {
102 final StringBuilder builder = new StringBuilder();
103 builder.append("BlueGigaReadByTypeCommand [connection=");
104 builder.append(connection);
105 builder.append(", start=");
106 builder.append(start);
107 builder.append(", end=");
109 builder.append(", uuid=");
110 builder.append(uuid);
112 return builder.toString();