2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.bticinosmarther.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * The {@code BridgeStatus} class defines the internal status of a Smarther Bridge.
20 * @author Fabio Possieri - Initial contribution
23 public class BridgeStatus {
25 private long apiCallsHandled;
26 private long notificationsReceived;
27 private long notificationsRejected;
30 * Constructs a new {@code BridgeStatus}.
32 public BridgeStatus() {
33 this.apiCallsHandled = 0;
34 this.notificationsReceived = 0;
35 this.notificationsRejected = 0;
39 * Returns the total number of API gateway calls made by the bridge.
41 * @return the total number of API calls made.
43 public long getApiCallsHandled() {
44 return apiCallsHandled;
48 * Increment the total number of API gateway calls made by the bridge.
50 * @return the total number of API calls made, after the increment.
52 public long incrementApiCallsHandled() {
53 return ++apiCallsHandled;
57 * Sets the total number of API gateway calls made by the bridge.
60 * the total number of API calls to be set as made
62 public void setApiCallsHandled(long totalNumber) {
63 this.apiCallsHandled = totalNumber;
67 * Returns the total number of module status notifications received by the bridge.
69 * @return the total number of received notifications.
71 public long getNotificationsReceived() {
72 return notificationsReceived;
76 * Increment the total number of module status notifications received by the bridge.
78 * @return the total number of received notification, after the increment.
80 public long incrementNotificationsReceived() {
81 return ++notificationsReceived;
85 * Sets the total number of module status notifications received by the bridge.
88 * the total number of notifications to be set as received
90 public void setNotificationsReceived(long totalNumber) {
91 this.notificationsReceived = totalNumber;
95 * Returns the total number of module status notifications rejected by the bridge.
97 * @return the total number of rejected notifications.
99 public long getNotificationsRejected() {
100 return notificationsRejected;
104 * Increment the total number of module status notifications rejected by the bridge.
106 * @return the total number of rejected notification, after the increment.
108 public long incrementNotificationsRejected() {
109 return ++notificationsRejected;
113 * Sets the total number of module status notifications rejected by the bridge.
116 * the total number of notifications to be set as rejected
118 public void setNotificationsRejected(long totalNumber) {
119 this.notificationsRejected = totalNumber;
123 public String toString() {
124 return String.format("apiCallsHandled=%s, notifsReceived=%s, notifsRejected=%s", apiCallsHandled,
125 notificationsReceived, notificationsRejected);