]> git.basschouten.com Git - openhab-addons.git/blob
253c3420a30be1ac583c8373e7424a8c196adb63
[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.bticinosmarther.internal.model;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@code BridgeStatus} class defines the internal status of a Smarther Bridge.
19  *
20  * @author Fabio Possieri - Initial contribution
21  */
22 @NonNullByDefault
23 public class BridgeStatus {
24
25     private long apiCallsHandled;
26     private long notificationsReceived;
27     private long notificationsRejected;
28
29     /**
30      * Constructs a new {@code BridgeStatus}.
31      */
32     public BridgeStatus() {
33         this.apiCallsHandled = 0;
34         this.notificationsReceived = 0;
35         this.notificationsRejected = 0;
36     }
37
38     /**
39      * Returns the total number of API gateway calls made by the bridge.
40      *
41      * @return the total number of API calls made.
42      */
43     public long getApiCallsHandled() {
44         return apiCallsHandled;
45     }
46
47     /**
48      * Increment the total number of API gateway calls made by the bridge.
49      *
50      * @return the total number of API calls made, after the increment.
51      */
52     public long incrementApiCallsHandled() {
53         return ++apiCallsHandled;
54     }
55
56     /**
57      * Sets the total number of API gateway calls made by the bridge.
58      *
59      * @param totalNumber
60      *            the total number of API calls to be set as made
61      */
62     public void setApiCallsHandled(long totalNumber) {
63         this.apiCallsHandled = totalNumber;
64     }
65
66     /**
67      * Returns the total number of module status notifications received by the bridge.
68      *
69      * @return the total number of received notifications.
70      */
71     public long getNotificationsReceived() {
72         return notificationsReceived;
73     }
74
75     /**
76      * Increment the total number of module status notifications received by the bridge.
77      *
78      * @return the total number of received notification, after the increment.
79      */
80     public long incrementNotificationsReceived() {
81         return ++notificationsReceived;
82     }
83
84     /**
85      * Sets the total number of module status notifications received by the bridge.
86      *
87      * @param totalNumber
88      *            the total number of notifications to be set as received
89      */
90     public void setNotificationsReceived(long totalNumber) {
91         this.notificationsReceived = totalNumber;
92     }
93
94     /**
95      * Returns the total number of module status notifications rejected by the bridge.
96      *
97      * @return the total number of rejected notifications.
98      */
99     public long getNotificationsRejected() {
100         return notificationsRejected;
101     }
102
103     /**
104      * Increment the total number of module status notifications rejected by the bridge.
105      *
106      * @return the total number of rejected notification, after the increment.
107      */
108     public long incrementNotificationsRejected() {
109         return ++notificationsRejected;
110     }
111
112     /**
113      * Sets the total number of module status notifications rejected by the bridge.
114      *
115      * @param totalNumber
116      *            the total number of notifications to be set as rejected
117      */
118     public void setNotificationsRejected(long totalNumber) {
119         this.notificationsRejected = totalNumber;
120     }
121
122     @Override
123     public String toString() {
124         return String.format("apiCallsHandled=%s, notifsReceived=%s, notifsRejected=%s", apiCallsHandled,
125                 notificationsReceived, notificationsRejected);
126     }
127 }