]> git.basschouten.com Git - openhab-addons.git/blob
f0804c83120dfe85458e377a14f3fd5f59993fa2
[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.opensprinkler.internal;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.core.types.StateOption;
21
22 import com.google.gson.annotations.SerializedName;
23
24 /**
25  * The {@link OpenSprinklerState} class holds the state and replies for an OpenSprinkler device.
26  *
27  * @author Matthew Skinner - Initial contribution
28  */
29 @NonNullByDefault
30 public class OpenSprinklerState {
31     public JcResponse jcReply = new JcResponse();
32     public JoResponse joReply = new JoResponse();
33     public JsResponse jsReply = new JsResponse();
34     public JpResponse jpReply = new JpResponse();
35     public JnResponse jnReply = new JnResponse();
36     public List<StateOption> programs = new ArrayList<>();
37     public List<StateOption> stations = new ArrayList<>();
38
39     public static class JsResponse {
40         public int[] sn = new int[8];
41         public int nstations = 8;
42     }
43
44     public static class JpResponse {
45         public int nprogs = 0;
46         public Object[] pd = {};
47     }
48
49     public static class JoResponse {
50         public int wl;
51         public int fwv = -1;
52     }
53
54     public static class JcResponse {
55         public @Nullable List<List<Integer>> ps;
56         @SerializedName(value = "sn1", alternate = "rs")
57         public int rs;
58         public long devt = 0;
59         public long rdst = 0;
60         public int en = 1;
61         public int sn2 = -1;
62         @SerializedName(value = "RSSI", alternate = "rssi") // json reply uses all uppercase
63         public int rssi = 1;
64         public int flcrt = -1;
65         public int curr = -1;
66         public int pt = -1;
67         public int nq = -1;
68         public int otcs = -1;
69     }
70
71     public static class JnResponse {
72         public List<String> snames = new ArrayList<>();
73         @SerializedName(value = "ignore_rain", alternate = "ignoreRain")
74         public byte[] ignoreRain = { 0 };
75     }
76 }