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.alarmdecoder.internal.protocol;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * The {@link VersionMessage} class represents a parsed VER message.
22 * @author Bob Adair - Initial contribution
25 public class VersionMessage extends ADMessage {
27 // Example: !VER:ffffffff,V2.2a.8.2,TX;RX;SM;VZ;RF;ZX;RE;AU;3X;CG;DD;MF;LR;KE;MK;CB;DS;ER
30 public final String serial;
32 /** Firmware version */
33 public final String version;
35 /** Firmware capabilities */
36 public final String capabilities;
38 public VersionMessage(String message) throws IllegalArgumentException {
41 String[] topLevel = message.split(":");
42 if (topLevel.length != 2) {
43 throw new IllegalArgumentException("Multiple colons found in VER message");
46 List<String> parts = splitMsg(topLevel[1]);
48 if (parts.size() != 3) {
49 throw new IllegalArgumentException("Invalid number of parts in VER message");
52 serial = parts.get(0);
53 version = parts.get(1);
54 capabilities = parts.get(2);