2 * Copyright (c) 2010-2020 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.miio.internal.basic;
15 import java.util.ArrayList;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.miio.internal.MiIoCommand;
22 import com.google.gson.annotations.Expose;
23 import com.google.gson.annotations.SerializedName;
26 * Mapping devices from json
28 * @author Marcel Verpaalen - Initial contribution
31 public class DeviceMapping {
35 private List<String> id = new ArrayList<>();
36 @SerializedName("propertyMethod")
38 private @Nullable String propertyMethod;
39 @SerializedName("maxProperties")
41 private @Nullable Integer maxProperties;
42 @SerializedName("channels")
44 private List<MiIoBasicChannel> miIoBasicChannels = new ArrayList<>();
46 public List<String> getId() {
50 public void setId(List<String> id) {
54 public String getPropertyMethod() {
55 final String propertyMethod = this.propertyMethod;
56 return propertyMethod != null ? propertyMethod : MiIoCommand.GET_PROPERTY.getCommand();
59 public void setPropertyMethod(String propertyMethod) {
60 this.propertyMethod = propertyMethod;
63 public int getMaxProperties() {
64 final Integer maxProperties = this.maxProperties;
65 return maxProperties != null ? maxProperties.intValue() : 5;
68 public void setMaxProperties(int maxProperties) {
69 this.maxProperties = maxProperties;
72 public List<MiIoBasicChannel> getChannels() {
73 return miIoBasicChannels;
76 public void setChannels(List<MiIoBasicChannel> miIoBasicChannels) {
77 this.miIoBasicChannels = miIoBasicChannels;