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.smartmeter.internal.helper;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
19 * @author Matthias Steigenberger - Initial contribution
23 public enum Baudrate {
26 public String toString() {
42 private Baudrate(int baudrate) {
43 this.baudrate = baudrate;
46 public int getBaudrate() {
50 public static Baudrate fromBaudrate(int baudrate) {
51 for (Baudrate baud : values()) {
52 if (baud.getBaudrate() == baudrate) {
56 return Baudrate._9600;
59 public static Baudrate fromString(String baudrate) {
61 if (baudrate.equalsIgnoreCase(AUTO.name())) {
64 return valueOf("_" + baudrate.toUpperCase());
65 } catch (Exception e) {
71 public String toString() {
72 return getBaudrate() + "bd";