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.lametrictime.internal.api.local.dto;
18 * @author Gregory Moyer - Initial contribution
21 private Boolean active;
24 * API sometimes calls this field 'mac' and other times calls it 'address'.
25 * Additionally, Gson uses fields only (not methods). Therefore, if use the
26 * same instance of this class to read one value and then try to write the
27 * other without calling the setter, it won't work (the other value will be
31 private String address;
33 private Boolean available;
34 private String encryption;
37 * API sometimes calls this field 'ssid' and other times calls it 'essid'.
38 * Additionally, Gson uses fields only (not methods). Therefore, if use the
39 * same instance of this class to read one value and then try to write the
40 * other without calling the setter, it won't work (the other value will be
47 * API sometimes calls this field 'ip' and other times calls it 'ipv4'.
48 * Additionally, Gson uses fields only (not methods). Therefore, if use the
49 * same instance of this class to read one value and then try to write the
50 * other without calling the setter, it won't work (the other value will be
57 private String netmask;
60 * API sometimes calls this field 'signal_strength' and other times calls it
61 * 'strength'. Additionally, Gson uses fields only (not methods). Therefore,
62 * if use the same instance of this class to read one value and then try to
63 * write the other without calling the setter, it won't work (the other
64 * value will be null).
66 private Integer signalStrength;
67 private Integer strength;
69 public Boolean isActive() {
73 public void setActive(Boolean active) {
77 public Wifi withActive(Boolean active) {
82 public String getMac() {
83 return mac == null ? address : mac;
86 public void setMac(String mac) {
91 public Wifi withMac(String mac) {
96 public Boolean isAvailable() {
100 public void setAvailable(Boolean available) {
101 this.available = available;
104 public Wifi withAvailable(Boolean available) {
105 this.available = available;
109 public String getEncryption() {
113 public void setEncryption(String encryption) {
114 this.encryption = encryption;
117 public Wifi withEncryption(String encryption) {
118 this.encryption = encryption;
122 public String getSsid() {
123 return ssid == null ? essid : ssid;
126 public void setSsid(String ssid) {
131 public Wifi withSsid(String ssid) {
136 public String getIp() {
137 return ip == null ? ipv4 : ip;
140 public void setIp(String ip) {
145 public Wifi withIp(String ip) {
150 public String getMode() {
154 public void setMode(String mode) {
158 public Wifi withMode(String mode) {
163 public String getNetmask() {
167 public void setNetmask(String netmask) {
168 this.netmask = netmask;
171 public Wifi withNetmask(String netmask) {
172 this.netmask = netmask;
176 public Integer getSignalStrength() {
177 return signalStrength == null ? strength : signalStrength;
180 public void setSignalStrength(Integer signalStrength) {
181 this.signalStrength = signalStrength;
182 this.strength = signalStrength;
185 public Wifi withSignalStrength(Integer signalStrength) {
186 setSignalStrength(signalStrength);
191 public String toString() {
192 StringBuilder builder = new StringBuilder();
193 builder.append("Wifi [active=");
194 builder.append(active);
195 builder.append(", mac=");
196 builder.append(getMac());
197 builder.append(", available=");
198 builder.append(available);
199 builder.append(", encryption=");
200 builder.append(encryption);
201 builder.append(", ssid=");
202 builder.append(getSsid());
203 builder.append(", ip=");
204 builder.append(getIp());
205 builder.append(", mode=");
206 builder.append(mode);
207 builder.append(", netmask=");
208 builder.append(netmask);
209 builder.append(", signalStrength=");
210 builder.append(getSignalStrength());
212 return builder.toString();