]> git.basschouten.com Git - openhab-addons.git/blob
749fae29dbe914d223a4c064cdebc6881eff2ca5
[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.system;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bluetooth.bluegiga.internal.BlueGigaCommand;
17
18 /**
19  * Class to implement the BlueGiga command <b>whitelistAppend</b>.
20  * <p>
21  * Add an entry to the running white list. By the white list you can define for example the remote
22  * devices which are allowed to establish a connection. See also Set Filtering Connect
23  * Selective and (if the white list is empty they will not be active). Do not use this command
24  * while advertising, scanning, or while being connected. The current list is discarded upon
25  * reset or power-cycle.
26  * <p>
27  * This class provides methods for processing BlueGiga API commands.
28  * <p>
29  * Note that this code is autogenerated. Manual changes may be overwritten.
30  *
31  * @author Chris Jackson - Initial contribution of Java code generator
32  */
33 @NonNullByDefault
34 public class BlueGigaWhitelistAppendCommand extends BlueGigaCommand {
35     public static final int COMMAND_CLASS = 0x00;
36     public static final int COMMAND_METHOD = 0x0A;
37
38     /**
39      * Bluetooth device address to add to the running white list. Maximum of 8 can be stored before
40      * you must clear or remove entries.
41      * <p>
42      * BlueGiga API type is <i>bd_addr</i> - Java type is {@link String}
43      */
44     private String address = "";
45
46     /**
47      * Bluetooth device address to add to the running white list. Maximum of 8 can be stored before
48      * you must clear or remove entries.
49      *
50      * @param address the address to set as {@link String}
51      */
52     public void setAddress(String address) {
53         this.address = address;
54     }
55
56     @Override
57     public int[] serialize() {
58         // Serialize the header
59         serializeHeader(COMMAND_CLASS, COMMAND_METHOD);
60
61         // Serialize the fields
62         serializeAddress(address);
63
64         return getPayload();
65     }
66
67     @Override
68     public String toString() {
69         final StringBuilder builder = new StringBuilder();
70         builder.append("BlueGigaWhitelistAppendCommand [address=");
71         builder.append(address);
72         builder.append(']');
73         return builder.toString();
74     }
75 }