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.unifi.internal.api.dto;
15 import org.openhab.binding.unifi.internal.api.cache.UniFiControllerCache;
17 import com.google.gson.annotations.SerializedName;
20 * @author Hilbrand Bouwkamp - Initial contribution
22 public class UniFiWlan implements HasId {
24 protected final transient UniFiControllerCache cache;
26 @SerializedName("_id")
31 private boolean enabled;
33 private String security; // ": "wpapsk",
34 private String wlanBand; // ": "both",
35 private String wpaEnc; // ": "ccmp",
36 private String wpaMode;// ": "wpa2",
37 private String xPassphrase; // : "1234",
38 private Boolean hideSsid;
39 private String siteId;
41 public UniFiWlan(final UniFiControllerCache cache) {
46 public String getId() {
50 public String getName() {
54 public boolean isEnabled() {
58 public UniFiSite getSite() {
59 return cache.getSite(siteId);
62 public String getSecurity() {
66 public String getWlanBand() {
70 public String getWpaEnc() {
74 public String getWpaMode() {
78 public String getXPassphrase() {
82 public boolean isHideSsid() {
83 return Boolean.TRUE.equals(hideSsid);
87 public String toString() {
88 final String xPassphraseString = xPassphrase == null ? ""
89 : (xPassphrase.substring(0, Math.min(5, xPassphrase.length())) + "*".repeat(10));
92 "UniFiWlan{id: '%s', name: '%s', enable: '%b', security: '%s', wlanBand: '%s', wpaEnc: '%s', wpaMode: '%s', xPassphrase: '%s', hideSsid: '%b', site: '%s'}",
93 id, name, enabled, security, wlanBand, wpaEnc, wpaMode, xPassphraseString, hideSsid, getSite());