]> git.basschouten.com Git - openhab-addons.git/blob
8340d117e6fa3347d9f9ea270852c8914f0ebb7e
[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.draytonwiser.internal.handler;
14
15 import static org.openhab.binding.draytonwiser.internal.DraytonWiserBindingConstants.PROP_SERIAL_NUMBER;
16
17 import java.util.Map;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.draytonwiser.internal.model.DeviceDTO;
21
22 /**
23  *
24  * @author Andrew Schofield - Initial contribution
25  * @author Hilbrand Bouwkamp - Put all device property setting in a separate class
26  */
27 @NonNullByDefault
28 public final class DraytonWiserPropertyHelper {
29
30     private DraytonWiserPropertyHelper() {
31         // helper class
32     }
33
34     public static void setPropertiesWithSerialNumber(final DeviceDTO device, final Map<String, Object> properties) {
35         properties.put(PROP_SERIAL_NUMBER, device.getSerialNumber());
36         setGeneralDeviceProperties(device, properties);
37     }
38
39     public static void setGeneralDeviceProperties(final DeviceDTO device,
40             final Map<String, ? super String> properties) {
41         properties.put("Device Type", device.getProductIdentifier());
42         properties.put("Firmware Version", device.getActiveFirmwareVersion());
43         properties.put("Manufacturer", device.getManufacturer());
44         properties.put("Model", device.getModelIdentifier());
45     }
46 }