]> git.basschouten.com Git - openhab-addons.git/blob
cf363270a013ca5a5820c9ebaa5dac7b045cd6f8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.velux.internal.things;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.velux.internal.VeluxBindingConstants;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * <B>Velux</B> product representation.
22  * <P>
23  * Combined set of information describing a single Velux product.
24  *
25  * @author Guenther Schreiner - initial contribution.
26  */
27 @NonNullByDefault
28 public class VeluxGwLAN {
29     private final Logger logger = LoggerFactory.getLogger(VeluxGwLAN.class);
30
31     // Class internal
32
33     private String ipAddress = VeluxBindingConstants.UNKNOWN;
34     private String subnetMask = VeluxBindingConstants.UNKNOWN;
35     private String defaultGW = VeluxBindingConstants.UNKNOWN;
36     private boolean enabledDHCP = false;
37
38     // Constructor
39
40     public VeluxGwLAN(String ipAddress, String subnetMask, String defaultGW, boolean enabledDHCP) {
41         logger.trace("VeluxGwLAN() created.");
42
43         this.ipAddress = ipAddress;
44         this.subnetMask = subnetMask;
45         this.defaultGW = defaultGW;
46         this.enabledDHCP = enabledDHCP;
47     }
48
49     // Class access methods
50
51     public String getIpAddress() {
52         logger.trace("getIpAddress() returns {}.", this.ipAddress);
53         return this.ipAddress;
54     }
55
56     public String getSubnetMask() {
57         logger.trace("getSubnetMask() returns {}.", this.subnetMask);
58         return this.subnetMask;
59     }
60
61     public String getDefaultGW() {
62         logger.trace("getDefaultGW() returns {}.", this.defaultGW);
63         return this.defaultGW;
64     }
65
66     public boolean getDHCP() {
67         logger.trace("getDHCP() returns {}.", this.enabledDHCP ? "enabled" : "disabled");
68         return this.enabledDHCP;
69     }
70
71     @Override
72     public String toString() {
73         return String.format("ip %s, nm %s, gw %s, DHCP %s", this.ipAddress, this.subnetMask, this.defaultGW,
74                 this.enabledDHCP ? "enabled" : "disabled");
75     }
76 }