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.robonect.internal.model;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * An enumeration for the possible mower status.
21 * @author Marco Meyer - Initial contribution
23 public enum MowerStatus {
26 * Status is being detected.
30 * Mower is in charging station.
40 * Mower searches charging station
42 SEARCH_CHARGING_STATION(3),
50 * Mower is searching the remote start point.
55 * Mower is in error state.
60 * Mower lost WLAN signal.
75 * Mower waits for door to open
80 * unknown status. If the module return any not listed code here it will result in this state in the binding.
84 private static final Logger LOGGER = LoggerFactory.getLogger(MowerStatus.class);
86 private int statusCode;
88 MowerStatus(int statusCode) {
89 this.statusCode = statusCode;
93 * translates a numeric code into an enum value. If code is not known the value {@link #UNKNOWN} is returned.
95 * @param code - the code to translate
96 * @return - the correpsonding enum value.
98 public static MowerStatus fromCode(int code) {
99 for (MowerStatus status : MowerStatus.values()) {
100 if (status.statusCode == code) {
104 LOGGER.debug("Got an unknown state with code {}", code);
109 * returns the numeric code of the status.
113 public int getStatusCode() {