]> git.basschouten.com Git - openhab-addons.git/blob
c477ab8830681a5f670e8df2bb1de6899c64b846
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.bigassfan.internal.discovery;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@link BigAssFanDevice} is responsible for storing information about a fan.
19  *
20  * @author Mark Hilbush - Initial contribution
21  */
22 @NonNullByDefault
23 public class BigAssFanDevice {
24     /**
25      * Name of device (e.g. Master Bedroom Fan)
26      */
27     private String label = "";
28
29     /**
30      * IP address of the device extracted from UDP packet
31      */
32     private String ipAddress = "";
33
34     /**
35      * MAC address of the device extracted from discovery message
36      */
37     private String macAddress = "";
38
39     /**
40      * Type of device extracted from discovery message (e.g. FAN or SWITCH)
41      */
42     private String type = "";
43
44     /**
45      * Model of device extracted from discovery message (e.g. HSERIES)
46      */
47     private String model = "";
48
49     /**
50      * The raw discovery message
51      */
52     private String discoveryMessage = "";
53
54     public String getLabel() {
55         return label;
56     }
57
58     public void setLabel(String label) {
59         this.label = label;
60     }
61
62     public String getIpAddress() {
63         return ipAddress;
64     }
65
66     public void setIpAddress(String ipAddress) {
67         this.ipAddress = ipAddress;
68     }
69
70     public String getMacAddress() {
71         return macAddress;
72     }
73
74     public void setMacAddress(String macAddress) {
75         this.macAddress = macAddress;
76     }
77
78     public String getModel() {
79         return model;
80     }
81
82     public void setModel(String model) {
83         this.model = model;
84     }
85
86     public String getType() {
87         return type;
88     }
89
90     public void setType(String type) {
91         this.type = type;
92     }
93
94     public String getDiscoveryMessage() {
95         return discoveryMessage;
96     }
97
98     public void setDiscoveryMessage(String discoveryMessage) {
99         this.discoveryMessage = discoveryMessage;
100     }
101
102     public boolean isFan() {
103         return type.toUpperCase().contains("FAN") ? true : false;
104     }
105
106     public boolean isSwitch() {
107         return type.toUpperCase().contains("SWITCH") ? true : false;
108     }
109
110     public boolean isLight() {
111         return type.toUpperCase().contains("LIGHT") ? true : false;
112     }
113
114     public void reset() {
115         label = "";
116         ipAddress = "";
117         macAddress = "";
118         type = "";
119         model = "";
120         discoveryMessage = "";
121     }
122
123     @Override
124     public String toString() {
125         return "BigAssFanDevice{label=" + label + ", ipAddress=" + ipAddress + ", macAddress=" + macAddress + ", model="
126                 + model + ", type=" + type + "}";
127     }
128 }