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.gap;
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;
20 * Class to implement the BlueGiga command <b>connectSelective</b>.
22 * This command will start the GAP direct connection establishment procedure to a set of
23 * dedicated Bluetooth Smart devices. When this command is issued the the module will enter a
24 * state where it scans connectable Bluetooth advertisement packets from the remote devices
25 * which are registered in the local white list. Upon receiving an advertisement packet from
26 * one of the registered devices, the module will send a connection request to this device, and a
27 * successful connection will produce a connection status event. The connect selective
28 * command can be cancelled with End Procedure command. When in Initiating State there are no
29 * scan response events.
31 * This class provides methods for processing BlueGiga API commands.
33 * Note that this code is autogenerated. Manual changes may be overwritten.
35 * @author Chris Jackson - Initial contribution of Java code generator
38 public class BlueGigaConnectSelectiveResponse extends BlueGigaResponse {
39 public static int COMMAND_CLASS = 0x06;
40 public static int COMMAND_METHOD = 0x05;
43 * 0 : procedure was successfully started Non-zero: An error occurred
45 * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
47 private BgApiResponse result;
50 * Connection handle that is reserved for new connection
52 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
54 private int connectionHandle;
57 * Response constructor
59 public BlueGigaConnectSelectiveResponse(int[] inputBuffer) {
60 // Super creates deserializer and reads header fields
63 event = (inputBuffer[0] & 0x80) != 0;
65 // Deserialize the fields
66 result = deserializeBgApiResponse();
67 connectionHandle = deserializeUInt8();
71 * 0 : procedure was successfully started Non-zero: An error occurred
73 * BlueGiga API type is <i>BgApiResponse</i> - Java type is {@link BgApiResponse}
75 * @return the current result as {@link BgApiResponse}
77 public BgApiResponse getResult() {
82 * Connection handle that is reserved for new connection
84 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
86 * @return the current connection_handle as {@link int}
88 public int getConnectionHandle() {
89 return connectionHandle;
93 public String toString() {
94 final StringBuilder builder = new StringBuilder();
95 builder.append("BlueGigaConnectSelectiveResponse [result=");
96 builder.append(result);
97 builder.append(", connectionHandle=");
98 builder.append(connectionHandle);
100 return builder.toString();