]> git.basschouten.com Git - openhab-addons.git/blob
ef69996a52eefc093f3f1e134b232e7f7ed81286
[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.ecovacs.internal.api.impl.dto.request.portal;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * @author Danny Baumann - Initial contribution
19  */
20 public class PortalIotCommandRequest {
21
22     @SerializedName("auth")
23     final PortalAuthRequestParameter auth;
24
25     @SerializedName("cmdName")
26     final String commandName;
27
28     @SerializedName("payload")
29     final Object payload;
30
31     @SerializedName("payloadType")
32     final String payloadType;
33
34     @SerializedName("td")
35     final String td = "q";
36
37     @SerializedName("toId")
38     final String targetDeviceId;
39
40     @SerializedName("toRes")
41     final String targetResource;
42
43     @SerializedName("toType")
44     final String targetClass;
45
46     public PortalIotCommandRequest(PortalAuthRequestParameter auth, String commandName, Object payload,
47             String targetDeviceId, String targetResource, String targetClass, boolean json) {
48         this.auth = auth;
49         this.commandName = commandName;
50         this.payload = payload;
51         this.targetDeviceId = targetDeviceId;
52         this.targetResource = targetResource;
53         this.targetClass = targetClass;
54         this.payloadType = json ? "j" : "x";
55     }
56
57     public static class JsonPayloadHeader {
58         @SerializedName("pri")
59         public final int pri = 1;
60         @SerializedName("ts")
61         public final long timestamp;
62         @SerializedName("tzm")
63         public final int tzm = 480;
64         @SerializedName("ver")
65         public final String version = "0.0.50";
66
67         public JsonPayloadHeader() {
68             timestamp = System.currentTimeMillis();
69         }
70     }
71 }