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.daikin.internal.api;
15 import java.util.HashMap;
17 import java.util.Optional;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 * Holds information from the basic_info call.
26 * @author Jimmy Tanagra - Initial contribution
30 public class BasicInfo {
31 private static final Logger LOGGER = LoggerFactory.getLogger(BasicInfo.class);
33 public String mac = "";
34 public String ret = "";
35 public String ssid = "";
40 public static BasicInfo parse(String response) {
41 LOGGER.trace("Parsing string: \"{}\"", response);
43 Map<String, String> responseMap = InfoParser.parse(response);
45 BasicInfo info = new BasicInfo();
46 info.mac = Optional.ofNullable(responseMap.get("mac")).orElse("");
47 info.ret = Optional.ofNullable(responseMap.get("ret")).orElse("");
48 info.ssid = Optional.ofNullable(responseMap.get("ssid")).orElse("");
52 public Map<String, String> getParamString() {
53 Map<String, String> params = new HashMap<>();
54 params.put("ssid", ssid);