]> git.basschouten.com Git - openhab-addons.git/blob
cddc071d45c82ce71801915b89d228314c8b0230
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.bondhome.internal.api;
14
15 import static org.openhab.binding.bondhome.internal.BondHomeBindingConstants.*;
16
17 import java.util.Arrays;
18 import java.util.List;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22
23 import com.google.gson.annotations.Expose;
24 import com.google.gson.annotations.SerializedName;
25
26 /**
27  * This POJO represents a bond device
28  *
29  * The incoming JSON looks like this:
30  *
31  * {"name": "My Fan", "type": "CF", "template": "A1", "location": "Kitchen",
32  * "actions": {"_": "7fc1e84b"}, "properties": {"_": "84cd8a43"}, "state": {"_":
33  * "ad9bcde4"}, "commands": {"_": "ad9bcde4" }}
34  *
35  * @author Sara Geleskie Damiano - Initial contribution
36  */
37 @NonNullByDefault
38 public class BondDevice {
39     // The current device hash
40     @SerializedName("_")
41     @Expose(serialize = false, deserialize = true)
42     public @Nullable String hash;
43     // The name associated with the device in the bond app
44     @Expose(serialize = true, deserialize = true)
45     public @Nullable String name;
46     // The device type
47     @Expose(serialize = true, deserialize = true)
48     public BondDeviceType type = BondDeviceType.GENERIC_DEVICE;
49     // The remote control template being used
50     @Expose(serialize = true, deserialize = true)
51     public @Nullable String template;
52     // A list of the available actions
53     @Expose(serialize = false, deserialize = true)
54     public List<BondDeviceAction> actions = Arrays.asList(BondDeviceAction.TURN_ON);
55     // The current hash of the properties object
56     @Expose(serialize = false, deserialize = true)
57     public @Nullable BondHash properties;
58     // The current hash of the state object
59     @Expose(serialize = false, deserialize = true)
60     public @Nullable BondHash state;
61     // The current hash of the commands object - only applies to a bridge
62     @Expose(serialize = false, deserialize = true)
63     public @Nullable BondHash commands;
64 }