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