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