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;
17 import org.openhab.binding.bluetooth.bluegiga.internal.enumeration.SmpIoCapabilities;
20 * Class to implement the BlueGiga command <b>setParameters</b>.
22 * This command is used to configure the local Security Manager and its features
24 * This class provides methods for processing BlueGiga API commands.
26 * Note that this code is autogenerated. Manual changes may be overwritten.
28 * @author Chris Jackson - Initial contribution of Java code generator
31 public class BlueGigaSetParametersCommand extends BlueGigaCommand {
32 public static int COMMAND_CLASS = 0x05;
33 public static int COMMAND_METHOD = 0x03;
36 * 1: Man-in-the-middle protection required. 0: No Man-in-the-middle protection. Default:
39 * BlueGiga API type is <i>boolean</i> - Java type is {@link boolean}
41 private boolean requireMitm;
44 * Minimum key size in Bytes. Range: 7-16. Default: 7 (56bits)
46 * BlueGiga API type is <i>uint8</i> - Java type is {@link int}
48 private int minKeySize;
51 * Configures the local devices I/O capabilities. See: SMP IO Capabilities for options.
52 * Default: No Input and No Output
54 * BlueGiga API type is <i>SmpIoCapabilities</i> - Java type is {@link SmpIoCapabilities}
56 private SmpIoCapabilities ioCapabilities = SmpIoCapabilities.UNKNOWN;
59 * 1: Man-in-the-middle protection required. 0: No Man-in-the-middle protection. Default:
62 * @param requireMitm the requireMitm to set as {@link boolean}
64 public void setRequireMitm(boolean requireMitm) {
65 this.requireMitm = requireMitm;
69 * Minimum key size in Bytes. Range: 7-16. Default: 7 (56bits)
71 * @param minKeySize the minKeySize to set as {@link int}
73 public void setMinKeySize(int minKeySize) {
74 this.minKeySize = minKeySize;
78 * Configures the local devices I/O capabilities. See: SMP IO Capabilities for options.
79 * Default: No Input and No Output
81 * @param ioCapabilities the ioCapabilities to set as {@link SmpIoCapabilities}
83 public void setIoCapabilities(SmpIoCapabilities ioCapabilities) {
84 this.ioCapabilities = ioCapabilities;
88 public int[] serialize() {
89 // Serialize the header
90 serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
92 // Serialize the fields
93 serializeBoolean(requireMitm);
94 serializeUInt8(minKeySize);
95 serializeSmpIoCapabilities(ioCapabilities);
101 public String toString() {
102 final StringBuilder builder = new StringBuilder();
103 builder.append("BlueGigaSetParametersCommand [requireMitm=");
104 builder.append(requireMitm);
105 builder.append(", minKeySize=");
106 builder.append(minKeySize);
107 builder.append(", ioCapabilities=");
108 builder.append(ioCapabilities);
110 return builder.toString();