]> git.basschouten.com Git - openhab-addons.git/blob
38e197d8983dee0582065cc54eadf6db7f8e5f17
[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.dsmr.internal.device;
14
15 /**
16  * Class describing the DSMR bridge user configuration
17  *
18  * @author M. Volaart - Initial contribution
19  * @author Hilbrand Bouwkamp - added receivedTimeout configuration
20  */
21 public class DSMRDeviceConfiguration {
22     /**
23      * Serial port name
24      */
25     public String serialPort;
26
27     /**
28      * Serial port baud rate
29      */
30     public int baudrate;
31
32     /**
33      * Serial port data bits
34      */
35     public int databits;
36
37     /**
38      * Serial port parity
39      */
40     public String parity;
41
42     /**
43      * Serial port stop bits
44      */
45     public String stopbits;
46
47     /**
48      * The Luxembourgish smart meter decryption key
49      */
50     public String decryptionKey;
51
52     /**
53      * When no message was received after the configured number of seconds action will be taken.
54      */
55     public int receivedTimeout;
56
57     /**
58      * @return true if serial port settings are all set.
59      */
60     public boolean isSerialFixedSettings() {
61         return baudrate > 0 && databits > 0 && !(parity != null && parity.isBlank())
62                 && !(stopbits != null && stopbits.isBlank());
63     }
64
65     @Override
66     public String toString() {
67         return "DSMRDeviceConfiguration [serialPort=" + serialPort + ", Baudrate=" + baudrate + ", Databits=" + databits
68                 + ", Parity=" + parity + ", Stopbits=" + stopbits + ", decryptionKey=" + decryptionKey
69                 + ", receivedTimeout=" + receivedTimeout + "]";
70     }
71 }