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;
18 public class Bluetooth
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 Boolean discoverable;
35 private Boolean pairable;
37 public Boolean isActive()
42 public void setActive(Boolean active)
47 public Bluetooth withActive(Boolean active)
53 public String getMac()
55 return mac == null ? address : mac;
58 public void setMac(String mac)
64 public Bluetooth withMac(String mac)
70 public Boolean isAvailable()
75 public void setAvailable(Boolean available)
77 this.available = available;
80 public Bluetooth withAvailable(Boolean available)
82 this.available = available;
86 public Boolean isDiscoverable()
91 public void setDiscoverable(Boolean discoverable)
93 this.discoverable = discoverable;
96 public Bluetooth withDiscoverable(Boolean discoverable)
98 this.discoverable = discoverable;
102 public String getName()
107 public void setName(String name)
112 public Bluetooth withName(String name)
118 public Boolean isPairable()
123 public void setPairable(Boolean pairable)
125 this.pairable = pairable;
128 public Bluetooth withPairable(Boolean pairable)
130 this.pairable = pairable;
135 public String toString()
137 StringBuilder builder = new StringBuilder();
138 builder.append("Bluetooth [active=");
139 builder.append(active);
140 builder.append(", mac=");
141 builder.append(getMac());
142 builder.append(", available=");
143 builder.append(available);
144 builder.append(", discoverable=");
145 builder.append(discoverable);
146 builder.append(", name=");
147 builder.append(name);
148 builder.append(", pairable=");
149 builder.append(pairable);
151 return builder.toString();