2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.ecovacs.internal.api.impl.dto.request.portal;
15 import com.google.gson.annotations.SerializedName;
18 * @author Danny Baumann - Initial contribution
20 public class PortalIotCommandRequest {
22 @SerializedName("auth")
23 final PortalAuthRequestParameter auth;
25 @SerializedName("cmdName")
26 final String commandName;
28 @SerializedName("payload")
31 @SerializedName("payloadType")
32 final String payloadType;
35 final String td = "q";
37 @SerializedName("toId")
38 final String targetDeviceId;
40 @SerializedName("toRes")
41 final String targetResource;
43 @SerializedName("toType")
44 final String targetClass;
46 public PortalIotCommandRequest(PortalAuthRequestParameter auth, String commandName, Object payload,
47 String targetDeviceId, String targetResource, String targetClass, boolean json) {
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";
57 public static class JsonPayloadHeader {
58 @SerializedName("pri")
59 public final int pri = 1;
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";
67 public JsonPayloadHeader() {
68 timestamp = System.currentTimeMillis();