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.security;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaCommand;
19 * Class to implement the BlueGiga command <b>encryptStart</b>.
21 * This command starts the encryption for a given connection.
23 * This class provides methods for processing BlueGiga API commands.
25 * Note that this code is autogenerated. Manual changes may be overwritten.
27 * @author Chris Jackson - Initial contribution of Java code generator
30 public class BlueGigaEncryptStartCommand extends BlueGigaCommand {
31 public static int COMMAND_CLASS = 0x05;
32 public static int COMMAND_METHOD = 0x00;
35 * Bonding handle of a device. This handle can be obtained for example from events like: Scan
36 * Response Status - If handle is 0xFF, all bondings will be deleted
38 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
43 * Create bonding if devices are not already bonded. 0: Do not create bonding. 1: Creating
46 * BlueGiga API type is <i>boolean</i> - Java type is {@link boolean}
48 private boolean bonding;
51 * Bonding handle of a device. This handle can be obtained for example from events like: Scan
52 * Response Status - If handle is 0xFF, all bondings will be deleted
54 * @param handle the handle to set as {@link int}
56 public void setHandle(int handle) {
61 * Create bonding if devices are not already bonded. 0: Do not create bonding. 1: Creating
64 * @param bonding the bonding to set as {@link boolean}
66 public void setBonding(boolean bonding) {
67 this.bonding = bonding;
71 public int[] serialize() {
72 // Serialize the header
73 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
75 // Serialize the fields
76 serializeUInt8(handle);
77 serializeBoolean(bonding);
83 public String toString() {
84 final StringBuilder builder = new StringBuilder();
85 builder.append("BlueGigaEncryptStartCommand [handle=");
86 builder.append(handle);
87 builder.append(", bonding=");
88 builder.append(bonding);
90 return builder.toString();