]> git.basschouten.com Git - openhab-addons.git/blob
90d6615b7150d537925df617433ee97d43438026
[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.velux.internal.bridge;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.velux.internal.bridge.common.RunProductSearch;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * The {@link VeluxBridgeDeviceCheckLostNodes} represents a complete set of transactions
22  * for querying device status on the <B>Velux</B> bridge.
23  * <P>
24  * It therefore provides a method
25  * <UL>
26  * <LI>{@link #initiate} for starting the detection.
27  * </UL>
28  *
29  * @see VeluxBridgeProvider
30  *
31  * @author Guenther Schreiner - Initial contribution
32  */
33 @NonNullByDefault
34 public class VeluxBridgeDeviceCheckLostNodes {
35     private final Logger logger = LoggerFactory.getLogger(VeluxBridgeDeviceCheckLostNodes.class);
36
37     // Class access methods
38
39     /**
40      * Login into bridge, query the bridge for device status and logout from bridge
41      * based on a well-prepared environment of a {@link VeluxBridgeProvider}.
42      *
43      * @param bridge Initialized Velux bridge handler.
44      */
45     public void initiate(VeluxBridge bridge) {
46         logger.trace("initiate() called.");
47         RunProductSearch bcp = bridge.bridgeAPI().runProductSearch();
48         if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) {
49             logger.trace("initiate() finished successfully.");
50         } else {
51             logger.trace("initiate() finished with failure.");
52         }
53         return;
54     }
55 }