]> git.basschouten.com Git - openhab-addons.git/blob
dac701d77ef7953a905028178321befb18ef37b7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.security;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaResponse;
17 import org.openhab.binding.bluetooth.bluegiga.internal.enumeration.BgApiResponse;
18
19 /**
20  * Class to implement the BlueGiga command <b>encryptStart</b>.
21  * <p>
22  * This command starts the encryption for a given connection.
23  * <p>
24  * This class provides methods for processing BlueGiga API commands.
25  * <p>
26  * Note that this code is autogenerated. Manual changes may be overwritten.
27  *
28  * @author Chris Jackson - Initial contribution of Java code generator
29  */
30 @NonNullByDefault
31 public class BlueGigaEncryptStartResponse extends BlueGigaResponse {
32     public static final int COMMAND_CLASS = 0x05;
33     public static final int COMMAND_METHOD = 0x00;
34
35     /**
36      * Connection handle
37      * <p>
38      * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
39      */
40     private int handle;
41
42     /**
43      * 0 : the encryption was started successfully
44      * <p>
45      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
46      */
47     private BgApiResponse result;
48
49     /**
50      * Response constructor
51      */
52     public BlueGigaEncryptStartResponse(int[] inputBuffer) {
53         // Super creates deserializer and reads header fields
54         super(inputBuffer);
55
56         event = (inputBuffer[0] & 0x80) != 0;
57
58         // Deserialize the fields
59         handle = deserializeUInt8();
60         result = deserializeBgApiResponse();
61     }
62
63     /**
64      * Connection handle
65      * <p>
66      * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
67      *
68      * @return the current handle as {@link int}
69      */
70     public int getHandle() {
71         return handle;
72     }
73
74     /**
75      * 0 : the encryption was started successfully
76      * <p>
77      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
78      *
79      * @return the current result as {@link BgApiResponse}
80      */
81     public BgApiResponse getResult() {
82         return result;
83     }
84
85     @Override
86     public String toString() {
87         final StringBuilder builder = new StringBuilder();
88         builder.append("BlueGigaEncryptStartResponse [handle=");
89         builder.append(handle);
90         builder.append(", result=");
91         builder.append(result);
92         builder.append(']');
93         return builder.toString();
94     }
95 }