]> git.basschouten.com Git - openhab-addons.git/blob
3a4cfbe009ec72f5e724a048a032d1a108e96eaa
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.bluetooth.bluegiga.internal.command.attributeclient;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaDeviceResponse;
17 import org.openhab.binding.bluetooth.bluegiga.internal.enumeration.BgApiResponse;
18
19 /**
20  * Class to implement the BlueGiga command <b>prepareWrite</b>.
21  * <p>
22  * This command will send a prepare write request to a remote device for queued writes. Queued
23  * writes can for example be used to write large attribute values by transmitting the data in
24  * chunks using prepare write command. Once the data has been transmitted with multiple
25  * prepare write commands the write must then be executed or canceled with Execute Write
26  * command, which if acknowledged by the remote device triggers a Procedure Completed event.
27  * <p>
28  * This class provides methods for processing BlueGiga API commands.
29  * <p>
30  * Note that this code is autogenerated. Manual changes may be overwritten.
31  *
32  * @author Chris Jackson - Initial contribution of Java code generator
33  */
34 @NonNullByDefault
35 public class BlueGigaPrepareWriteResponse extends BlueGigaDeviceResponse {
36     public static int COMMAND_CLASS = 0x04;
37     public static int COMMAND_METHOD = 0x09;
38
39     /**
40      * Command result.
41      * <p>
42      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
43      */
44     private BgApiResponse result;
45
46     /**
47      * Response constructor
48      */
49     public BlueGigaPrepareWriteResponse(int[] inputBuffer) {
50         // Super creates deserializer and reads header fields
51         super(inputBuffer);
52
53         event = (inputBuffer[0] & 0x80) != 0;
54
55         // Deserialize the fields
56         connection = deserializeUInt8();
57         result = deserializeBgApiResponse();
58     }
59
60     /**
61      * Command result.
62      * <p>
63      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
64      *
65      * @return the current result as {@link BgApiResponse}
66      */
67     public BgApiResponse getResult() {
68         return result;
69     }
70
71     @Override
72     public String toString() {
73         final StringBuilder builder = new StringBuilder();
74         builder.append("BlueGigaPrepareWriteResponse [connection=");
75         builder.append(connection);
76         builder.append(", result=");
77         builder.append(result);
78         builder.append(']');
79         return builder.toString();
80     }
81 }