]> git.basschouten.com Git - openhab-addons.git/blob
5046d2235345b46c86fe780599927a44ebfad735
[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.account;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.bticinosmarther.internal.api.dto.Notification;
17 import org.openhab.binding.bticinosmarther.internal.api.exception.SmartherGatewayException;
18 import org.openhab.core.thing.binding.ThingHandler;
19
20 /**
21  * The {@code SmartherNotificationHandler} interface is used to decouple the Smarther notification handler
22  * implementation from other Bridge code.
23  *
24  * @author Fabio Possieri - Initial contribution
25  */
26 @NonNullByDefault
27 public interface SmartherNotificationHandler extends ThingHandler {
28
29     /**
30      * Tells whether the Smarther Bridge associated with this handler supports notifications.
31      *
32      * @return {@code true} if the Bridge supports notifications, {@code false} otherwise
33      */
34     boolean useNotifications();
35
36     /**
37      * Calls the Smarther API to register a new notification endpoint to the C2C Webhook service.
38      *
39      * @param plantId
40      *            the identifier of the plant the notification endpoint belongs to
41      *
42      * @throws SmartherGatewayException in case of communication issues with the Smarther API
43      */
44     void registerNotification(String plantId) throws SmartherGatewayException;
45
46     /**
47      * Handles a new notifications received from the C2C Webhook notification service.
48      *
49      * @param notification
50      *            the received notification
51      */
52     void handleNotification(Notification notification);
53
54     /**
55      * Calls the Smarther API to unregister a notification endpoint already registered to the C2C Webhook service.
56      *
57      * @param plantId
58      *            the identifier of the plant the notification endpoint belongs to
59      *
60      * @throws SmartherGatewayException in case of communication issues with the Smarther API
61      */
62     void unregisterNotification(String plantId) throws SmartherGatewayException;
63 }