]> git.basschouten.com Git - openhab-addons.git/blob
32fec443d7323e3b6d0fa51bddd0ed1b210cdcc7
[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.smartmeter.internal;
14
15 import javax.measure.Quantity;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * Listener which can be notified whenever new values are read form a meter device.
21  *
22  * @author Matthias Steigenberger - Initial contribution
23  *
24  */
25 @NonNullByDefault
26 public interface MeterValueListener {
27
28     /**
29      * Called whenever some (reading-) error occurred.
30      *
31      * @param e The Exception that was thrown.
32      */
33     void errorOccurred(Throwable e);
34
35     /**
36      * Called whenever some value was added or changed for a meter device.
37      *
38      * @param value The changed value.
39      */
40     <Q extends Quantity<Q>> void valueChanged(MeterValue<Q> value);
41
42     /**
43      * Called whenever some value was removed from the meter device (not available anymore).
44      *
45      * @param value The removed value.
46      */
47     <Q extends Quantity<Q>> void valueRemoved(MeterValue<Q> value);
48 }