]> git.basschouten.com Git - openhab-addons.git/blob
3e35168ff538deea1a84e8f04f2f18b197549e6e
[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.folding.internal.discovery;
14
15 import org.openhab.core.thing.ThingUID;
16
17 /**
18  * Singleton instance to connect the Client handler and the discovery
19  * service.
20  *
21  * @author Marius Bjoernstad - Initial contribution
22  */
23 public class FoldingDiscoveryProxy {
24
25     private static FoldingDiscoveryProxy instance;
26     private FoldingSlotDiscoveryService discoveryService = null;
27
28     private FoldingDiscoveryProxy() {
29     }
30
31     public static FoldingDiscoveryProxy getInstance() {
32         if (instance == null) {
33             instance = new FoldingDiscoveryProxy();
34         }
35         return instance;
36     }
37
38     public void setService(FoldingSlotDiscoveryService service) {
39         this.discoveryService = service;
40     }
41
42     public void newSlot(ThingUID bridgeUID, String host, String id, String description) {
43         if (instance != null) {
44             discoveryService.newSlot(bridgeUID, host, id, description);
45         }
46     }
47 }