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.globalcache.internal.command;
15 import java.util.concurrent.LinkedBlockingQueue;
17 import org.openhab.binding.globalcache.internal.GlobalCacheBindingConstants.CommandType;
18 import org.openhab.core.thing.Thing;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * The {@link CommandGetversion} class implements the GlobalCache getversion command, which retrieves software
24 * version of the device.
26 * @author Mark Hilbush - Initial contribution
28 public class CommandGetversion extends AbstractCommand {
30 private final Logger logger = LoggerFactory.getLogger(CommandGetversion.class);
32 private String version;
34 public CommandGetversion(Thing thing, LinkedBlockingQueue<RequestMessage> requestQueue) {
35 super(thing, requestQueue, "getversion", CommandType.COMMAND);
36 deviceCommand = "getversion";
40 public void parseSuccessfulReply() {
41 if (deviceReply == null) {
44 // decode response of form <textversionstring>
45 version = deviceReply;
48 public String getVersion() {
53 public void logSuccess() {
54 logger.debug("Execute '{}' succeeded on thing {} at {}, version={}", commandName, thing.getUID().getId(),
59 public void logFailure() {
60 logger.error("Execute '{}' failed for thing {} at {}, errorCode={}, errorMessage={}", commandName,
61 thing.getUID().getId(), ipAddress, errorCode, errorMessage);