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.homematic.internal.communicator.parser;
15 import java.io.IOException;
19 * Parses a getDeviceDescription message and extracts the type and firmware version.
21 * @author Gerhard Riegler - Initial contribution
23 public class GetDeviceDescriptionParser extends CommonRpcParser<Object[], GetDeviceDescriptionParser> {
25 private String firmware;
26 private String deviceInterface;
28 @SuppressWarnings("unchecked")
30 public GetDeviceDescriptionParser parse(Object[] message) throws IOException {
31 if (message != null && message.length > 0 && message[0] instanceof Map) {
32 Map<String, ?> mapMessage = (Map<String, ?>) message[0];
33 type = toString(mapMessage.get("TYPE"));
34 firmware = toString(mapMessage.get("FIRMWARE"));
35 deviceInterface = toString(mapMessage.get("INTERFACE"));
41 * Returns the parsed type.
43 public String getType() {
48 * Returns the parsed firmware version.
50 public String getFirmware() {
51 return firmware == null ? "" : firmware;
55 * Returns the interface of the device.
57 public String getDeviceInterface() {
58 return deviceInterface;