2 * Copyright 2017-2018 Gregory Moyer and contributors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openhab.binding.lametrictime.api.local.model;
20 private Boolean active;
23 * API sometimes calls this field 'mac' and other times calls it 'address'.
24 * Additionally, Gson uses fields only (not methods). Therefore, if use the
25 * same instance of this class to read one value and then try to write the
26 * other without calling the setter, it won't work (the other value will be
30 private String address;
32 private Boolean available;
33 private String encryption;
36 * API sometimes calls this field 'ssid' and other times calls it 'essid'.
37 * Additionally, Gson uses fields only (not methods). Therefore, if use the
38 * same instance of this class to read one value and then try to write the
39 * other without calling the setter, it won't work (the other value will be
46 * API sometimes calls this field 'ip' and other times calls it 'ipv4'.
47 * Additionally, Gson uses fields only (not methods). Therefore, if use the
48 * same instance of this class to read one value and then try to write the
49 * other without calling the setter, it won't work (the other value will be
56 private String netmask;
59 * API sometimes calls this field 'signal_strength' and other times calls it
60 * 'strength'. Additionally, Gson uses fields only (not methods). Therefore,
61 * if use the same instance of this class to read one value and then try to
62 * write the other without calling the setter, it won't work (the other
63 * value will be null).
65 private Integer signalStrength;
66 private Integer strength;
68 public Boolean isActive()
73 public void setActive(Boolean active)
78 public Wifi withActive(Boolean active)
84 public String getMac()
86 return mac == null ? address : mac;
89 public void setMac(String mac)
95 public Wifi withMac(String mac)
101 public Boolean isAvailable()
106 public void setAvailable(Boolean available)
108 this.available = available;
111 public Wifi withAvailable(Boolean available)
113 this.available = available;
117 public String getEncryption()
122 public void setEncryption(String encryption)
124 this.encryption = encryption;
127 public Wifi withEncryption(String encryption)
129 this.encryption = encryption;
133 public String getSsid()
135 return ssid == null ? essid : ssid;
138 public void setSsid(String ssid)
144 public Wifi withSsid(String ssid)
150 public String getIp()
152 return ip == null ? ipv4 : ip;
155 public void setIp(String ip)
161 public Wifi withIp(String ip)
167 public String getMode()
172 public void setMode(String mode)
177 public Wifi withMode(String mode)
183 public String getNetmask()
188 public void setNetmask(String netmask)
190 this.netmask = netmask;
193 public Wifi withNetmask(String netmask)
195 this.netmask = netmask;
199 public Integer getSignalStrength()
201 return signalStrength == null ? strength : signalStrength;
204 public void setSignalStrength(Integer signalStrength)
206 this.signalStrength = signalStrength;
207 this.strength = signalStrength;
210 public Wifi withSignalStrength(Integer signalStrength)
212 setSignalStrength(signalStrength);
217 public String toString()
219 StringBuilder builder = new StringBuilder();
220 builder.append("Wifi [active=");
221 builder.append(active);
222 builder.append(", mac=");
223 builder.append(getMac());
224 builder.append(", available=");
225 builder.append(available);
226 builder.append(", encryption=");
227 builder.append(encryption);
228 builder.append(", ssid=");
229 builder.append(getSsid());
230 builder.append(", ip=");
231 builder.append(getIp());
232 builder.append(", mode=");
233 builder.append(mode);
234 builder.append(", netmask=");
235 builder.append(netmask);
236 builder.append(", signalStrength=");
237 builder.append(getSignalStrength());
239 return builder.toString();