]> git.basschouten.com Git - openhab-addons.git/blob
d6eeae2dd4894f826efaff63e063a5c212b650ad
[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.SetSceneVelocity;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 /**
21  * The {@link VeluxBridgeSetSceneVelocity} represents a complete set of transactions
22  * for modifying the silent-mode of a scene defined on the <B>Velux</B> bridge.
23  * <P>
24  * It therefore provides a method
25  * <UL>
26  * <LI>{@link VeluxBridgeSetSceneVelocity#setSilentMode} for modifying the behaviour of a scene.
27  * </UL>
28  * Any parameters are controlled by {@link org.openhab.binding.velux.internal.config.VeluxBridgeConfiguration}.
29  *
30  * @see VeluxBridgeProvider
31  *
32  * @author Guenther Schreiner - Initial contribution
33  */
34 @Deprecated
35 @NonNullByDefault
36 public class VeluxBridgeSetSceneVelocity {
37     private final Logger logger = LoggerFactory.getLogger(VeluxBridgeSetSceneVelocity.class);
38
39     // Class access methods
40
41     /**
42      * Login into bridge, modify the scene parameters and logout from bridge based
43      * on a well-prepared environment of a {@link VeluxBridgeProvider}.
44      *
45      * @param bridge Initialized Velux bridge handler.
46      * @param sceneNo Number of scene to be modified.
47      * @param silentMode Mode of this mentioned scene.
48      * @return true if successful, and false otherwise.
49      */
50     public boolean setSilentMode(VeluxBridge bridge, int sceneNo, boolean silentMode) {
51         logger.trace("setSilentMode({},{}) called.", sceneNo, silentMode);
52
53         SetSceneVelocity bcp = bridge.bridgeAPI().setSceneVelocity();
54         bcp.setMode(sceneNo, silentMode);
55         if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) {
56             logger.trace("setSilentMode() finished successfully.");
57             return true;
58         }
59         logger.trace("setSilentMode() finished with failure.");
60         return false;
61     }
62 }