2 * Copyright (c) 2010-2022 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>readMultiple</b>.
21 * This command can be used to read multiple attributes from a server.
23 * This class provides methods for processing BlueGiga API commands.
25 * Note that this code is autogenerated. Manual changes may be overwritten.
27 * @author Chris Jackson - Initial contribution of Java code generator
30 public class BlueGigaReadMultipleCommand extends BlueGigaDeviceCommand {
31 public static int COMMAND_CLASS = 0x04;
32 public static int COMMAND_METHOD = 0x0B;
35 * List of attribute handles to read from the remote device
37 * BlueGiga API type is <i>uint8array</i> - Java type is {@link int[]}
39 private int[] handles = new int[0];
42 * List of attribute handles to read from the remote device
44 * @param handles the handles to set as {@link int[]}
46 public void setHandles(int[] handles) {
47 this.handles = handles;
51 public int[] serialize() {
52 // Serialize the header
53 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
55 // Serialize the fields
56 serializeUInt8(connection);
57 serializeUInt8Array(handles);
63 public String toString() {
64 final StringBuilder builder = new StringBuilder();
65 builder.append("BlueGigaReadMultipleCommand [connection=");
66 builder.append(connection);
67 builder.append(", handles=");
68 for (int c = 0; c < handles.length; c++) {
72 builder.append(String.format("%02X", handles[c]));
75 return builder.toString();