2 * Copyright (c) 2010-2024 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.nibeuplink.internal.model;
15 import java.util.ArrayList;
16 import java.util.HashMap;
17 import java.util.List;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
25 import com.google.gson.annotations.SerializedName;
28 * data class to map the json status response
30 * @author Alexander Friese - initial contribution
33 public class GenericDataResponse implements DataResponse {
34 private final Logger logger = LoggerFactory.getLogger(GenericDataResponse.class);
36 public static class Value {
37 @SerializedName("VariableId")
38 private @Nullable String variableId;
39 @SerializedName("CurrentValue")
40 private @Nullable String currentValue;
41 @SerializedName("CurrentIntValue")
42 private @Nullable Long currentIntValue;
43 @SerializedName("IsLoading")
44 private boolean isLoading;
47 @SerializedName("IsOffline")
48 private @Nullable String isOffline;
49 @SerializedName("OnlineImage")
50 private @Nullable String onlineImage;
51 @SerializedName("Date")
52 private @Nullable String date;
53 @SerializedName("FuzzyDate")
54 private @Nullable String fuzzyDate;
55 @SerializedName("Values")
56 private List<Value> values = new ArrayList<>();
59 public Map<String, @Nullable Long> getValues() {
60 Map<String, @Nullable Long> valueMap = new HashMap<>();
61 for (Value value : values) {
62 String id = value.variableId;
63 if (!value.isLoading && id != null) {
64 if (logger.isDebugEnabled()) {
65 logger.debug("Channel {} updated to: {} ({})", value.variableId, value.currentIntValue,
68 valueMap.put(id, value.currentIntValue);
74 public @Nullable String getIsOffline() {
78 public @Nullable String getOnlineImage() {
82 public @Nullable String getDate() {
86 public @Nullable String getFuzzyDate() {