]> git.basschouten.com Git - openhab-addons.git/blob
4b01cf22bdb066317f4e921c1e1144fe194f50cc
[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.mqtt.generic;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Interface to keep track of the availability of device using an availability topic or messages received
19  *
20  * @author Jochen Klein - Initial contribution
21  */
22 @NonNullByDefault
23 public interface AvailabilityTracker {
24
25     /**
26      * Adds an availability topic to determine the availability of a device.
27      * <p>
28      * Availability topics are usually set by the device as LWT.
29      *
30      * @param availability_topic
31      * @param payload_available
32      * @param payload_not_available
33      */
34     public void addAvailabilityTopic(String availability_topic, String payload_available, String payload_not_available);
35
36     public void removeAvailabilityTopic(String availability_topic);
37
38     public void clearAllAvailabilityTopics();
39
40     /**
41      * resets the indicator, if messages have been received.
42      * <p>
43      * This is used to time out the availability of the device after some time without receiving a message.
44      */
45     public void resetMessageReceived();
46 }