]> git.basschouten.com Git - openhab-addons.git/blob
b77c90540d4b8fe79e8f9bf7317a21a6f4570ba0
[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.modbus.internal.config;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * Configuration for poller thing
20  *
21  * @author Sami Salonen - Initial contribution
22  *
23  */
24 @NonNullByDefault
25 public class ModbusPollerConfiguration {
26     private long refresh;
27     private int start;
28     private int length;
29     private @Nullable String type;
30     private int maxTries = 3;// backwards compatibility and tests
31     private long cacheMillis = 50L;
32
33     /**
34      * Gets refresh period in milliseconds
35      */
36     public long getRefresh() {
37         return refresh;
38     }
39
40     /**
41      * Sets refresh period in milliseconds
42      */
43
44     public void setRefresh(long refresh) {
45         this.refresh = refresh;
46     }
47
48     /**
49      * Get address of the first register, coil, or discrete input to poll. Input as zero-based index number.
50      *
51      */
52     public int getStart() {
53         return start;
54     }
55
56     /**
57      * Sets address of the first register, coil, or discrete input to poll. Input as zero-based index number.
58      *
59      */
60     public void setStart(int start) {
61         this.start = start;
62     }
63
64     /**
65      * Gets number of registers, coils or discrete inputs to read.
66      */
67     public int getLength() {
68         return length;
69     }
70
71     /**
72      * Sets number of registers, coils or discrete inputs to read.
73      */
74     public void setLength(int length) {
75         this.length = length;
76     }
77
78     /**
79      * Gets type of modbus items to poll
80      *
81      */
82     public @Nullable String getType() {
83         return type;
84     }
85
86     /**
87      * Sets type of modbus items to poll
88      *
89      */
90     public void setType(String type) {
91         this.type = type;
92     }
93
94     public int getMaxTries() {
95         return maxTries;
96     }
97
98     public void setMaxTries(int maxTries) {
99         this.maxTries = maxTries;
100     }
101
102     /**
103      * Gets time to cache data.
104      *
105      * This is used for reusing cached data with explicit refresh calls.
106      */
107     public long getCacheMillis() {
108         return cacheMillis;
109     }
110
111     /**
112      * Sets time to cache data, in milliseconds
113      *
114      */
115     public void setCacheMillis(long cacheMillis) {
116         this.cacheMillis = cacheMillis;
117     }
118 }