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>readLong</b>.
21 * This command can be used to read long attribute values, which are longer than 22 bytes and
22 * cannot be read with a simple Read by Handle command. The command starts a procedure, where the
23 * client first sends a normal read command to the server and if the returned attribute value
24 * length is equal to MTU, the client will send further read long read requests until rest of the
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 BlueGigaReadLongCommand extends BlueGigaDeviceCommand {
35 public static int COMMAND_CLASS = 0x04;
36 public static int COMMAND_METHOD = 0x08;
41 * BlueGiga API type is <i>uint16</i> - Java type is {@link int}
43 private int chrHandle;
48 * @param chrHandle the chrHandle to set as {@link int}
50 public void setChrHandle(int chrHandle) {
51 this.chrHandle = chrHandle;
55 public int[] serialize() {
56 // Serialize the header
57 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
59 // Serialize the fields
60 serializeUInt8(connection);
61 serializeUInt16(chrHandle);
67 public String toString() {
68 final StringBuilder builder = new StringBuilder();
69 builder.append("BlueGigaReadLongCommand [connection=");
70 builder.append(connection);
71 builder.append(", chrHandle=");
72 builder.append(chrHandle);
74 return builder.toString();