]> git.basschouten.com Git - openhab-addons.git/blob
26e46adbdcc61779c925f2d28729d18b87be3491
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.gardena.internal.model.command;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * Base class for a Gardena command with parameters.
19  *
20  * @author Gerhard Riegler - Initial contribution
21  */
22 public abstract class Command {
23
24     @SerializedName(value = "name")
25     protected String command;
26     protected CommandParameters parameters;
27
28     /**
29      * Creates a command with the given name.
30      */
31     public Command(String command) {
32         this.command = command;
33     }
34
35     /**
36      * Returns the command name.
37      */
38     public String getCommand() {
39         return command;
40     }
41
42     /**
43      * Returns the parameters of the command.
44      */
45     public CommandParameters getParameters() {
46         return parameters;
47     }
48
49     /**
50      * Sets the parameters of the command.
51      */
52     public void setParameters(CommandParameters parameters) {
53         this.parameters = parameters;
54     }
55
56     /**
57      * Class to hold the command parameters.
58      *
59      * @author Gerhard Riegler - Initial contribution
60      */
61     public class CommandParameters {
62         private String duration;
63         @SerializedName("manual_override")
64         private String manualOverride;
65
66         /**
67          * Returns the duration parameter.
68          */
69         public String getDuration() {
70             return duration;
71         }
72
73         /**
74          * Sets the duration parameter.
75          */
76         public void setDuration(String duration) {
77             this.duration = duration;
78         }
79
80         /**
81          * Returns the manual override parameter.
82          */
83         public String getManualOverride() {
84             return manualOverride;
85         }
86
87         /**
88          * Sets the manual override parameter.
89          */
90         public void setManualOverride(String manualOverride) {
91             this.manualOverride = manualOverride;
92         }
93     }
94 }