]> git.basschouten.com Git - openhab-addons.git/blob
3ce6c1c71d8eab7e80ccfea832f39043233819c4
[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.gap;
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>setAdvData</b>.
21  * <p>
22  * This commands set advertisement or scan response data used in the advertisement and scan
23  * response packets. The command allows application specific data to be broadcasts either in
24  * advertisement or scan response packets. The data set with this command is only used when the
25  * GAP discoverable mode is set to gap_user_data. Notice that advertisement or scan response
26  * data must be formatted in accordance to the Bluetooth Core Specification. See BLUETOOTH
27  * SPECIFICATION Version 4.0 [Vol 3 - Part C - Chapter 11].
28  * <p>
29  * This class provides methods for processing BlueGiga API commands.
30  * <p>
31  * Note that this code is autogenerated. Manual changes may be overwritten.
32  *
33  * @author Chris Jackson - Initial contribution of Java code generator
34  */
35 @NonNullByDefault
36 public class BlueGigaSetAdvDataResponse extends BlueGigaResponse {
37     public static int COMMAND_CLASS = 0x06;
38     public static int COMMAND_METHOD = 0x09;
39
40     /**
41      * 0: Command was successfully executed. Non-zero: An error occurred
42      * <p>
43      * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
44      */
45     private BgApiResponse result;
46
47     /**
48      * Response constructor
49      */
50     public BlueGigaSetAdvDataResponse(int[] inputBuffer) {
51         // Super creates deserializer and reads header fields
52         super(inputBuffer);
53
54         event = (inputBuffer[0] & 0x80) != 0;
55
56         // Deserialize the fields
57         result = deserializeBgApiResponse();
58     }
59
60     /**
61      * 0: Command was successfully executed. Non-zero: An error occurred
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("BlueGigaSetAdvDataResponse [result=");
75         builder.append(result);
76         builder.append(']');
77         return builder.toString();
78     }
79 }