2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.livisismarthome.internal.client.api.entity.action;
16 * Special {@link ActionDTO} needed to control shutters.
18 * @author Marco Mans - Initial contribution
20 public class ShutterActionDTO extends ActionDTO {
22 private static final String TYPE_STOP_RAMP = "StopRamp";
23 private static final String TYPE_START_RAMP = "StartRamp";
24 private static final String DIRECTION_RAMP_UP = "RampUp";
25 private static final String DIRECTION_RAMP_DOWN = "RampDown";
26 private static final String CONSTANT = "Constant";
27 private static final String NAMESPACE_COSIP = "CosipDevices.RWE";
30 * Describes a Shutteraction
32 * @param capabilityId String of the 32 character capability id
33 * @param action Which action to perform (UP, DOWN, STOP)
35 public ShutterActionDTO(String capabilityId, ShutterActionType action) {
36 setTargetCapabilityById(capabilityId);
37 setNamespace(NAMESPACE_COSIP);
38 final ActionParamsDTO params = new ActionParamsDTO();
40 if (ShutterActionType.STOP.equals(action)) {
41 setType(TYPE_STOP_RAMP);
42 } else if (ShutterActionType.UP.equals(action)) {
43 setType(TYPE_START_RAMP);
44 params.setRampDirection(new StringActionParamDTO(CONSTANT, DIRECTION_RAMP_UP));
45 } else if (ShutterActionType.DOWN.equals(action)) {
46 setType(TYPE_START_RAMP);
47 params.setRampDirection(new StringActionParamDTO(CONSTANT, DIRECTION_RAMP_DOWN));