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.dsmr.internal.device.connector;
15 import java.util.Locale;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * Error events from a connector.
22 * @author M. Volaart - Initial contribution
23 * @author Hilbrand Bouwkamp - Refactored all error into one enum
26 public enum DSMRErrorStatus {
28 * The smarty telegram was successfully received but could not be decoded because of an invalid decryption key.
30 INVALID_DECRYPTION_KEY(false),
32 * Serial port could not be found.
34 PORT_DONT_EXISTS(true),
36 * Serial port is already in use by another application.
40 * Internal error in the serial port communication.
42 PORT_INTERNAL_ERROR(true),
44 * Serial port doesn't support the configured settings.
46 PORT_NOT_COMPATIBLE(true),
48 * Reading data from the serial port failed.
50 SERIAL_DATA_READ_ERROR(false),
52 * The telegram CRC16 checksum failed (only DSMR V4 and up).
54 TELEGRAM_CRC_ERROR(false),
56 * The P1 telegram has syntax errors.
58 TELEGRAM_DATA_CORRUPTION(false),
60 * Received telegram data, but after parsing no data is present. Possibly all data corrupted.
62 TELEGRAM_NO_DATA(false);
64 private final boolean fatal;
66 private DSMRErrorStatus(final boolean fatal) {
71 * @return Returns true if this error is not something possible temporary, but something that can't be recovered
74 public boolean isFatal() {
79 * @return the event details
81 public String getEventDetails() {
82 return "@text/addon.dsmr.error.status." + name().toLowerCase(Locale.ROOT);