]> git.basschouten.com Git - openhab-addons.git/blob
b49a0953eda60fd0f3f17ce7866eddade028490a
[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.silvercrestwifisocket.internal.handler;
14
15 import java.util.Set;
16
17 import org.openhab.binding.silvercrestwifisocket.internal.discovery.SilvercrestWifiSocketDiscoveryService;
18 import org.openhab.binding.silvercrestwifisocket.internal.entities.SilvercrestWifiSocketResponse;
19 import org.openhab.binding.silvercrestwifisocket.internal.runnable.SilvercrestWifiSocketUpdateReceiverRunnable;
20 import org.openhab.core.thing.Thing;
21
22 /**
23  * The {@link SilvercrestWifiSocketMediator} is responsible for receiving all the UDP packets and route correctly to
24  * each handler.
25  *
26  * @author Jaime Vaz - Initial contribution
27  */
28 public interface SilvercrestWifiSocketMediator {
29
30     /**
31      * This method is called by the {@link SilvercrestWifiSocketUpdateReceiverRunnable}, when one new message has been
32      * received.
33      *
34      * @param receivedMessage the {@link SilvercrestWifiSocketResponse} message.
35      */
36     void processReceivedPacket(final SilvercrestWifiSocketResponse receivedMessage);
37
38     /**
39      * Registers a new {@link Thing} and the corresponding {@link SilvercrestWifiSocketHandler}.
40      *
41      * @param thing the {@link Thing}.
42      * @param handler the {@link SilvercrestWifiSocketHandler}.
43      */
44     void registerThingAndWifiSocketHandler(final Thing thing, final SilvercrestWifiSocketHandler handler);
45
46     /**
47      * Unregisters a {@link SilvercrestWifiSocketHandler} by the corresponding {@link Thing}.
48      *
49      * @param thing the {@link Thing}.
50      */
51     void unregisterWifiSocketHandlerByThing(final Thing thing);
52
53     /**
54      * Returns all the {@link Thing} registered.
55      *
56      * @return all the {@link Thing}.
57      */
58     Set<Thing> getAllThingsRegistred();
59
60     /**
61      * Sets the discovery service to inform the when one new thing has been found.
62      *
63      * @param discoveryService the discovery service.
64      */
65     void setDiscoveryService(SilvercrestWifiSocketDiscoveryService discoveryService);
66 }