]> git.basschouten.com Git - openhab-addons.git/blob
628e81de50b635fb9b7ea4b4645eae37c70a3b03
[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.knx.internal.client;
14
15 import tuwien.auto.calimero.datapoint.Datapoint;
16
17 /**
18  * Information about a data point which is queued to be read from the KNX bus.
19  *
20  * @author Karel Goderis - Initial contribution
21  */
22 public class ReadDatapoint {
23
24     private final Datapoint datapoint;
25     private int retries;
26     private final int limit;
27
28     public ReadDatapoint(Datapoint datapoint, int limit) {
29         this.datapoint = datapoint;
30         this.retries = 0;
31         this.limit = limit;
32     }
33
34     public Datapoint getDatapoint() {
35         return datapoint;
36     }
37
38     public int getRetries() {
39         return retries;
40     }
41
42     public void incrementRetries() {
43         this.retries++;
44     }
45
46     public int getLimit() {
47         return limit;
48     }
49
50     @Override
51     public int hashCode() {
52         final int prime = 31;
53         int result = 1;
54         result = prime * result + ((datapoint.getMainAddress() == null) ? 0 : datapoint.getMainAddress().hashCode());
55         return result;
56     }
57
58     @Override
59     public boolean equals(Object obj) {
60         if (this == obj) {
61             return true;
62         }
63         if (obj == null) {
64             return false;
65         }
66         if (getClass() != obj.getClass()) {
67             return false;
68         }
69         ReadDatapoint other = (ReadDatapoint) obj;
70         if (datapoint == null) {
71             if (other.datapoint != null) {
72                 return false;
73             }
74         } else if (!datapoint.getMainAddress().equals(other.datapoint.getMainAddress())) {
75             return false;
76         }
77         return true;
78     }
79 }